1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Autodesk.Revit.DB;
- namespace FWindSoft.Revit
- {
- public static class LocationExtension
- {
- /// <summary>
- /// 转换成线
- /// </summary>
- /// <param name="loc"></param>
- /// <returns></returns>
- public static Curve ConvertToCurve(this Location loc)
- {
- if (loc is LocationCurve lc)
- {
- return lc.Curve;
- }
- return null;
- }
- /// <summary>
- /// 转换成点
- /// </summary>
- /// <param name="loc"></param>
- /// <returns></returns>
- public static XYZ ConvertToPoint(this Location loc)
- {
- if (loc is LocationPoint lp)
- {
- return lp.Point;
- }
- return null;
- }
- /// <summary>
- /// 转换成直线线
- /// </summary>
- /// <param name="loc"></param>
- /// <returns></returns>
- public static Line ConvertToLine(this Location loc)
- {
- if (loc is LocationCurve lc)
- {
- return lc.Curve as Line;
- }
- return null;
- }
- }
- }
|