当前位置: 首页>>代码示例>>C#>>正文


C# Autodesk.ToXyz方法代码示例

本文整理汇总了C#中Autodesk.ToXyz方法的典型用法代码示例。如果您正苦于以下问题:C# Autodesk.ToXyz方法的具体用法?C# Autodesk.ToXyz怎么用?C# Autodesk.ToXyz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Autodesk的用法示例。


在下文中一共展示了Autodesk.ToXyz方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToRevitBoundingBox

        public static Autodesk.Revit.DB.BoundingBoxXYZ ToRevitBoundingBox(
            Autodesk.DesignScript.Geometry.CoordinateSystem cs,
            Autodesk.DesignScript.Geometry.Point minPoint,
            Autodesk.DesignScript.Geometry.Point maxPoint, bool convertUnits = true)
        {
            var rbb = new BoundingBoxXYZ();
            rbb.Enabled = true;

            rbb.Transform = cs.ToTransform(convertUnits);

            rbb.Max = maxPoint.ToXyz(convertUnits);
            rbb.Min = minPoint.ToXyz(convertUnits);

            return rbb;
        }
开发者ID:whztt07,项目名称:Dynamo,代码行数:15,代码来源:GeometryPrimitiveConverter.cs

示例2: ByStartPointEndPoint

        /// <summary>
        /// Create a Revit Grid Element in a project between two end points
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public static Grid ByStartPointEndPoint(Autodesk.DesignScript.Geometry.Point start, Autodesk.DesignScript.Geometry.Point end)
        {
            if (Document.IsFamilyDocument)
            {
                throw new Exception("A Grid Element can only be created in a Revit Project");
            }

            if (start == null)
            {
                throw new ArgumentNullException("start");
            }

            if (end == null)
            {
                throw new ArgumentNullException("end");
            }

            var line = Autodesk.Revit.DB.Line.CreateBound(start.ToXyz(), end.ToXyz());

            return new Grid(line);
        }
开发者ID:algobasket,项目名称:Dynamo,代码行数:27,代码来源:Grid.cs

示例3: ByCurveLevelUpVectorAndType

        /// <summary>
        /// Create a Revit Structural Member - a special FamilyInstance
        /// </summary>
        /// <param name="curve">The curve path for the structural member</param>
        /// <param name="upVector">The up vector for the element - this is required to determine the orientation of the element</param>
        /// <param name="level">The level on which the member should appear</param>
        /// <param name="structuralType">The type of the structural element - a beam, column, etc</param>
        /// <param name="structuralFramingType">The structural framing type representing the structural type</param>
        /// <returns></returns>
        public static StructuralFraming ByCurveLevelUpVectorAndType(Autodesk.DesignScript.Geometry.Curve curve, Level level, 
            Autodesk.DesignScript.Geometry.Vector upVector, StructuralType structuralType, FamilySymbol structuralFramingType)
        {
            if (curve == null)
            {
                throw new System.ArgumentNullException("curve");
            }

            if (level == null)
            {
                throw new System.ArgumentNullException("level");
            }

            if (upVector == null)
            {
                throw new System.ArgumentNullException("upVector");
            }

            if (structuralFramingType == null)
            {
                throw new System.ArgumentNullException("structuralFramingType");
            }            

            return new StructuralFraming(curve.ToRevitType(), upVector.ToXyz(), level.InternalLevel,
                structuralType.ToRevitType(), structuralFramingType.InternalFamilySymbol);
        }
开发者ID:whztt07,项目名称:Dynamo,代码行数:35,代码来源:StucturalFraming.cs

示例4: ByEyePointTargetAndBoundingBox

        /// <summary>
        /// Create a Revit Perspective View from an Eye position and target position and Bounding Box
        /// </summary>
        /// <param name="eyePoint">Eye point in meters</param>
        /// <param name="target">Target of view in meters</param>
        /// <param name="boundingBox">Bounding box represented in meters</param>
        /// <param name="name"></param>
        /// <param name="isolateElement"></param>
        /// <returns></returns>
        public static PerspectiveView ByEyePointTargetAndBoundingBox(Autodesk.DesignScript.Geometry.Point eyePoint, Autodesk.DesignScript.Geometry.Point target, Autodesk.DesignScript.Geometry.BoundingBox boundingBox, string name, bool isolateElement)
        {
            if (boundingBox == null)
            {
                throw new ArgumentNullException("boundingBox");
            }

            if (eyePoint == null)
            {
                throw new ArgumentNullException("eyePoint");
            }

            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            return new PerspectiveView(eyePoint.ToXyz(), target.ToXyz(), boundingBox.ToRevitType(), name, isolateElement);
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:33,代码来源:PerspectiveView.cs

示例5: ByEyePointTargetAndElement

        /// <summary>
        /// Create a Revit Perspective View from an Eye position and target position and Element
        /// </summary>
        /// <param name="eyePoint"></param>
        /// <param name="target"></param>
        /// <param name="element"></param>
        /// <param name="name"></param>
        /// <param name="isolateElement"></param>
        /// <returns></returns>
        public static PerspectiveView ByEyePointTargetAndElement(Autodesk.DesignScript.Geometry.Point eyePoint, Autodesk.DesignScript.Geometry.Point target, Element element, string name, bool isolateElement)
        {
            if (eyePoint == null)
            {
                throw new ArgumentNullException("eyePoint");
            }

            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            return new PerspectiveView(eyePoint.ToXyz(), target.ToXyz(), element.InternalElement, name, isolateElement);
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:33,代码来源:PerspectiveView.cs

示例6: ByPointVectorDistance

        /// <summary>
        /// Create a Reference Point Element offset from a point along a vector
        /// </summary>
        /// <param name="basePoint"></param>
        /// <param name="direction"></param>
        /// <param name="distance"></param>
        /// <returns></returns>
        public static ReferencePoint ByPointVectorDistance(Autodesk.DesignScript.Geometry.Point basePoint, Autodesk.DesignScript.Geometry.Vector direction, double distance)
        {
            if (!Document.IsFamilyDocument)
            {
                throw new Exception("ReferencePoint Elements can only be created in a Family Document");
            }

            if (basePoint == null)
            {
                throw new ArgumentNullException("basePoint");
            }

            if (direction == null)
            {
                throw new ArgumentNullException("direction");
            }

            var pt = basePoint.ToXyz() + direction.ToXyz() * distance;

            return new ReferencePoint(pt.X, pt.Y, pt.Z);
        }
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:28,代码来源:ReferencePoint.cs

示例7: Project

 public Dictionary<string, object> Project(Autodesk.DesignScript.Geometry.Point point)
 {
     try
     {
         var result = InternalFace.Project(point.ToXyz());
         return new Dictionary<string, object>()
         {
             {"point", result.XYZPoint.ToPoint()},
             {"uv", result.UVPoint.ToProtoType()},
             {"dist", result.Distance},
             {"edge", result.EdgeObject.Wrap()},
             {"edgeParm", result.EdgeParameter }
         };
     }
     catch
     {
         return null;
     }
 }
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:19,代码来源:Face.cs

示例8: Sphere

        /// <summary>
        /// Create a sphere of a given radius at a given center point. 
        /// </summary>
        /// <param name="center"></param>
        /// <param name="radius"></param>
        /// <returns></returns>
        public static Solid Sphere(Autodesk.DesignScript.Geometry.Point center, double radius)
        {
            if (center == null)
            {
                throw new ArgumentException("Center point is null.");
            }

            if (radius <= 0)
            {
                throw new ArgumentException("Radius must be greater than zero.");
            }

            var origin = center.ToXyz();

            // create semicircular arc
            var semicircle = Autodesk.Revit.DB.Arc.Create(origin, radius, 0, RevitPI, XYZ.BasisZ, XYZ.BasisX);

            // create axis curve of sphere - running from north to south pole
            var axisCurve = Autodesk.Revit.DB.Line.CreateBound(new XYZ(origin.X, origin.Y, origin.Z-radius),
                new XYZ(origin.X, origin.Y, origin.Z + radius));

            var circleLoop = Autodesk.Revit.DB.CurveLoop.Create(new List<Curve>() { semicircle, axisCurve });

            var trans = Transform.Identity;
            trans.Origin = origin;
            trans.BasisX = XYZ.BasisX;
            trans.BasisY = XYZ.BasisY;
            trans.BasisZ = XYZ.BasisZ;

            return new Solid(circleLoop, trans, 0, 2*RevitPI);
        }
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:37,代码来源:Solid.cs

示例9: Cylinder

        /// <summary>
        /// Create cylinder geometry by extruding a circle of a given radius, by a given height
        /// </summary>
        /// <param name="origin"></param>
        /// <param name="radius"></param>
        /// <param name="direction"></param>
        /// <param name="height"></param>
        /// <returns></returns>
        public static Solid Cylinder(Autodesk.DesignScript.Geometry.Point origin, double radius, Vector direction, double height)
        {
            if (radius <= 0)
            {
                throw new ArgumentException("Radius must be greater than zero.");
            }

            if (direction == null)
            {
                throw new ArgumentException("Direction can not be null.");
            }

            if (height <= 0)
            {
                throw new ArgumentException("Height must be greater than zero.");
            }

            var axis = direction.ToXyz();

            // get axis that is perp to axis by first generating random vector
            var zaxis = axis.Normalize();
            var randXyz = new XYZ(1, 0, 0);
            if (axis.IsAlmostEqualTo(randXyz)) randXyz = new XYZ(0, 1, 0);
            var yaxis = zaxis.CrossProduct(randXyz).Normalize();

            // get second axis that is perp to axis
            var xaxis = yaxis.CrossProduct(zaxis);

            // create circle (this is ridiculous, but curve loop doesn't work with a circle - you need two arcs)
            var arc1 = Autodesk.Revit.DB.Ellipse.Create(origin.ToXyz(), radius, radius, xaxis, yaxis, 0, RevitPI);
            var arc2 = Autodesk.Revit.DB.Ellipse.Create(origin.ToXyz(), radius, radius, xaxis, yaxis, RevitPI, 2 * RevitPI);

            // create curve loop from cirle
            var circleLoop = Autodesk.Revit.DB.CurveLoop.Create(new List<Curve>() { arc1, arc2 });

            return new Solid(new List<CurveLoop>{circleLoop}, axis, height);
        }
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:45,代码来源:Solid.cs


注:本文中的Autodesk.ToXyz方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。