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


C# Autodesk.get_Radius方法代码示例

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


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

示例1: ExtractSurface

        public static Surface ExtractSurface(Autodesk.Revit.DB.ConicalFace face, IEnumerable<PolyCurve> edgeLoops)
        {
            // Note: Internal representation of the cone
            // S(u, v) = Origin + v*[sin(HalfAngle)*(cos(u)*Radius[0] + sin(u)*Radius[1]) + cos(HalfAngle)*Axis]

            edgeLoops = edgeLoops.ToList();

            // Get some data from the face
            var axis = face.Axis.ToVector(false);
            var x = face.get_Radius(0).ToVector(false);
            var y = face.get_Radius(1).ToVector(false);
            var tipPt = face.Origin.ToPoint(false);
            var ang = face.HalfAngle;

            // We use the max length in order to help find the lowest possible base point for the cone
            var maxLength = edgeLoops.Max(pc => pc.Length);

            // We don't know the "base" point of the cone, so we build it here
            // by projecting a point on the edge loops onto the axis
            var pt = edgeLoops.First().StartPoint;
            var dir = pt.Subtract( tipPt.AsVector() );
            var projLength = dir.AsVector().Dot(axis);
            var height = projLength + 2 * maxLength; 
            var o = tipPt.Add(axis.Normalized().Scale(height));

            // there's not an easy way to create a conical surface in protogeometry outside of this
            // note this coordinate system has the z axis reversed because we're building the cone
            // from it's flat bottom surface
            var baseCS = CoordinateSystem.ByOriginVectors(o, x, y.Reverse());

            // Construct the radius
            var rad = Math.Cos(ang)*height;
            var cone = Cone.ByCoordinateSystemHeightRadius(baseCS, height, rad);

            // PB: this is iffy code - we need to extract the surface that's not touching the origin
            //return cone.Faces.Select(f => f.SurfaceGeometry()).First(s => s.DistanceTo(o) > 1e-5);

            // the flat face of the cone is currently the second face in the Faces enumeration
            return cone.Faces[1].SurfaceGeometry(); 
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:40,代码来源:SurfaceExtractor.cs

示例2: ExtractSurface

        public static Surface ExtractSurface(Autodesk.Revit.DB.RevolvedFace face, IEnumerable<PolyCurve> edgeLoops)
        {
            var crv = face.Curve.ToProtoType();
            var axis = face.Axis.ToVector();
            var o = face.Origin.ToVector();
            var x = face.get_Radius(0).ToVector();
            var y = face.get_Radius(1).ToVector();

            // Note: The profile curve is represented in the coordinate system of the revolve
            //       so we need to transform it into the global coordinate system
            var revolveCs = CoordinateSystem.Identity();
            var globalCs = CoordinateSystem.ByOriginVectors(o.AsPoint(), x, y);

            crv = (Autodesk.DesignScript.Geometry.Curve) crv.Transform(revolveCs, globalCs);

            return Surface.ByRevolve(crv, o.AsPoint(), axis.Normalized(), 0, 360);
        }
开发者ID:algobasket,项目名称:Dynamo,代码行数:17,代码来源:SurfaceExtractor.cs


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