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


C# Arc.get_EndParameter方法代码示例

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


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

示例1: OffsetArc

        /// <summary>
        /// Offsets an arc along the offset direction from the point on the arc.
        /// </summary>
        /// <param name="arc">The arc.</param>
        /// <param name="offsetPntOnArc">The point on the arc.</param>
        /// <param name="offset">The offset vector.</param>
        /// <returns>The offset Arc.</returns>
        private static Arc OffsetArc(Arc arc, XYZ offsetPntOnArc, XYZ offset)
        {
            if (arc == null || offset == null)
                throw new ArgumentNullException();

            if (offset.IsZeroLength())
                return arc;

            XYZ axis = arc.Normal.Normalize();

            XYZ offsetAlongAxis = axis.Multiply(offset.DotProduct(axis));
            XYZ offsetOrthAxis = offset - offsetAlongAxis;
            XYZ offsetPntToCenter = (arc.Center - offsetPntOnArc).Normalize(); ;

            double signedOffsetLengthTowardCenter = offsetOrthAxis.DotProduct(offsetPntToCenter);
            double newRadius = arc.Radius - signedOffsetLengthTowardCenter; // signedOffsetLengthTowardCenter > 0, minus, < 0, add

            Arc offsetArc = m_appCreation.NewArc(arc.Center, newRadius, arc.get_EndParameter(0), arc.get_EndParameter(1), arc.XDirection, arc.YDirection);

            offsetArc = GeometryUtil.MoveCurve(offsetArc, offsetAlongAxis) as Arc;

            return offsetArc;
        }
开发者ID:whztt07,项目名称:RevitIFC,代码行数:30,代码来源:SimpleSweptSolidAnalyzer.cs

示例2: CreateArc

        /// <summary>
        /// Creates an IFC arc from a Revit arc object.
        /// </summary>
        /// <param name="exporterIFC">The exporter.</param>
        /// <param name="arc">The arc.</param>
        /// <param name="scaledPlane">The scaled plane.</param>
        /// <returns>The arc handle.</returns>
        public static IFCAnyHandle CreateArc(ExporterIFC exporterIFC, Arc arc, Plane scaledPlane)
        {
            IFCFile file = exporterIFC.GetFile();

            XYZ centerPoint = ExporterIFCUtils.TransformAndScalePoint(exporterIFC, arc.Center);

            IFCAnyHandle centerPointHandle;
            if (scaledPlane != null)
            {
                List<double> centerPointValues = ConvertPointToLocalCoordinatesCommon(scaledPlane, centerPoint);
                centerPointHandle = ExporterUtil.CreateCartesianPoint(file, centerPointValues);
            }
            else
                centerPointHandle = ExporterUtil.CreateCartesianPoint(file, centerPoint);

            XYZ xDirection = ExporterIFCUtils.TransformAndScaleVector(exporterIFC, arc.XDirection);
            IFCAnyHandle axis;
            if (scaledPlane != null)
            {
                List<double> xDirectionValues = ConvertVectorToLocalCoordinates(scaledPlane, xDirection);
                IFCAnyHandle xDirectionHandle = ExporterUtil.CreateDirection(file, xDirectionValues);
                axis = IFCInstanceExporter.CreateAxis2Placement2D(file, centerPointHandle, null, xDirectionHandle);
            }
            else
                axis = ExporterUtil.CreateAxis2Placement3D(file, centerPoint, arc.Normal, xDirection);

            double arcRadius = arc.Radius * exporterIFC.LinearScale;

            IFCAnyHandle circle = IFCInstanceExporter.CreateCircle(file, axis, arcRadius);

            IFCAnyHandle arcHandle = circle;
            if (arc.IsBound)
            {
                double endParam0 = arc.get_EndParameter(0);
                double endParam1 = arc.get_EndParameter(1);
                if (scaledPlane != null && MustFlipCurve(scaledPlane, arc))
                {
                    double oldParam0 = endParam0;
                    endParam0 = Math.PI * 2 - endParam1;
                    endParam1 = Math.PI * 2 - oldParam0;
                }
                IFCData firstParam = IFCDataUtil.CreateAsParameterValue(MathUtil.PutInRange(endParam0, Math.PI, 2 * Math.PI) * (180 / Math.PI));
                IFCData secondParam = IFCDataUtil.CreateAsParameterValue(MathUtil.PutInRange(endParam1, Math.PI, 2 * Math.PI) * (180 / Math.PI));

                // todo: check that firstParam != secondParam.
                HashSet<IFCData> trim1 = new HashSet<IFCData>();
                trim1.Add(firstParam);
                HashSet<IFCData> trim2 = new HashSet<IFCData>();
                trim2.Add(secondParam);

                arcHandle = IFCInstanceExporter.CreateTrimmedCurve(file, circle, trim1, trim2, true, IFCTrimmingPreference.Parameter);
            }
            return arcHandle;
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:61,代码来源:GeometryUtil.cs

示例3: TransformArc

        /// <summary>
        /// Get the arc to create grid according to the specified bubble location
        /// </summary>
        /// <param name="arc">The original selected line</param>
        /// <param name="bubLoc">bubble location</param>
        /// <returns>The arc to create grid</returns>
        protected Arc TransformArc(Arc arc, BubbleLocation bubLoc)
        {
            Arc arcToCreate;

            if (bubLoc == BubbleLocation.StartPoint)
            {
                arcToCreate = arc;
            }
            else
            {
                // Get start point, end point of the arc and the middle point on it
                Autodesk.Revit.DB.XYZ startPoint = arc.get_EndPoint(0);
                Autodesk.Revit.DB.XYZ endPoint = arc.get_EndPoint(1);
                bool clockwise = (arc.Normal.Z == -1);

                // Get start angel and end angel of arc
                double startDegree = arc.get_EndParameter(0);
                double endDegree = arc.get_EndParameter(1);

                // Handle the case that the arc is clockwise
                if (clockwise && startDegree > 0 && endDegree > 0)
                {
                    startDegree = 2 * Values.PI - startDegree;
                    endDegree = 2 * Values.PI - endDegree;
                }
                else if (clockwise && startDegree < 0)
                {
                    double temp = endDegree;
                    endDegree = -1 * startDegree;
                    startDegree = -1 * temp;
                }

                double sumDegree = (startDegree + endDegree) / 2;
                while (sumDegree > 2 * Values.PI)
                {
                    sumDegree -= 2 * Values.PI;
                }

                while (sumDegree < -2 * Values.PI)
                {
                    sumDegree += 2 * Values.PI;
                }

                Autodesk.Revit.DB.XYZ midPoint = new Autodesk.Revit.DB.XYZ (arc.Center.X + arc.Radius * Math.Cos(sumDegree),
                    arc.Center.Y + arc.Radius * Math.Sin(sumDegree), 0);

                arcToCreate = m_appCreator.NewArc(endPoint, startPoint, midPoint);
            }

            return arcToCreate;
        }
开发者ID:AMEE,项目名称:revit,代码行数:57,代码来源:CreateGridsData.cs


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