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


C# Curve.GetType方法代码示例

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


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

示例1: CreateReversedCurve

    /// <summary>
    /// Create a new curve with the same 
    /// geometry in the reverse direction.
    /// </summary>
    /// <param name="orig">The original curve.</param>
    /// <returns>The reversed curve.</returns>
    /// <throws cref="NotImplementedException">If the 
    /// curve type is not supported by this utility.</throws>
    static Curve CreateReversedCurve(
      Autodesk.Revit.Creation.Application creapp,
      Curve orig )
    {
      if( !IsSupported( orig ) )
      {
        throw new NotImplementedException(
          "CreateReversedCurve for type "
          + orig.GetType().Name );
      }

      if( orig is Line )
      {
        return Line.CreateBound( 
          orig.GetEndPoint( 1 ),
          orig.GetEndPoint( 0 ) );
      }
      else if( orig is Arc )
      {
        return Arc.Create( orig.GetEndPoint( 1 ), 
          orig.GetEndPoint( 0 ), 
          orig.Evaluate( 0.5, true ) );
      }
      else
      {
        throw new Exception(
          "CreateReversedCurve - Unreachable" );
      }
    }
开发者ID:mtumminello,项目名称:RoomEditorApp,代码行数:37,代码来源:ContiguousCurveSorter.cs

示例2: CreateCurveByPoints

        private Autodesk.Revit.DB.CurveByPoints CreateCurveByPoints(Autodesk.Revit.DB.CurveByPoints c, Curve gc, XYZ start, XYZ end)
        {
            //Add the geometry curves start and end points to a ReferencePointArray.
            ReferencePointArray refPtArr = new ReferencePointArray();
            if (gc.GetType() == typeof(Line))
            {
                ReferencePoint refPointStart = this.UIDocument.Document.FamilyCreate.NewReferencePoint(start);
                ReferencePoint refPointEnd = this.UIDocument.Document.FamilyCreate.NewReferencePoint(end);
                refPtArr.Append(refPointStart);
                refPtArr.Append(refPointEnd);
                //c = dynRevitSettings.Doc.Document.FamilyCreate.NewCurveByPoints(refPtArr);
            }
            else if (gc.GetType() == typeof(Arc) && foundCreateArcThroughPoints)
            {
                Type CurveByPointsUtilsType = typeof(Autodesk.Revit.DB.CurveByPointsUtils);
                MethodInfo[] curveElementMethods = CurveByPointsUtilsType.GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
                System.String nameOfMethodSetCurve = "CreateArcThroughPoints";

                foreach (MethodInfo m in curveElementMethods)
                {
                    if (m.Name == nameOfMethodSetCurve)
                    {
                        object[] argsM = new object[4];

                        ReferencePoint refPointStart = this.UIDocument.Document.FamilyCreate.NewReferencePoint(start);
                        ReferencePoint refPointEnd = this.UIDocument.Document.FamilyCreate.NewReferencePoint(end);
                        XYZ midPoint = gc.Evaluate(0.5, true);
                        ReferencePoint refMidPoint = this.UIDocument.Document.FamilyCreate.NewReferencePoint(midPoint);

                        argsM[0] = this.UIDocument.Document;
                        argsM[1] = refPointStart;
                        argsM[2] = refPointEnd;
                        argsM[3] = refMidPoint;

                        c = (Autodesk.Revit.DB.CurveByPoints)m.Invoke(null, argsM);
                        if (c != null && c.GeometryCurve.GetType() == typeof(Arc))
                           return c;
                        if (c != null)
                            this.DeleteElement(c.Id);
                        break;
                    }
                }
                foundCreateArcThroughPoints = false;
            }
            if (gc.GetType() != typeof(Line))
            {
                IList <XYZ> xyzList = gc.Tessellate();
                int numPoints = xyzList.Count;
                for (int ii = 0; ii < numPoints; ii++)
                {
                    ReferencePoint refPoint = this.UIDocument.Document.FamilyCreate.NewReferencePoint(xyzList[ii]);
                    refPtArr.Append(refPoint);
                }
            }
            c = dynRevitSettings.Doc.Document.FamilyCreate.NewCurveByPoints(refPtArr);
            return c;
        }
开发者ID:parchjs,项目名称:Dynamo,代码行数:57,代码来源:Curve.cs

示例3: handleJoinsRight

        /// <summary>
        /// Get the Insulation Layer of Right hand joined Walls
        /// </summary>
        public Tuple<Curve, Curve> handleJoinsRight(Document doc, LocationCurve wallLocCurve, Curve lower, Curve upper, ref List<int> bannedWalls)
        {
            Tuple<Curve, Curve> existing = new Tuple<Curve, Curve>(upper, lower);

            if (lower.GetType() == typeof(Arc) || lower.GetType() == typeof(NurbSpline)) return existing;
            if (upper.GetType() == typeof(Arc) || upper.GetType() == typeof(NurbSpline)) return existing;

            XYZ IntersectionPointLower = null;
            XYZ IntersectionPointUpper = null;

            ElementArray elems = wallLocCurve.get_ElementsAtJoin(1);

            if (elems == null || elems.Size == 0) return existing;

            foreach (Element elem in elems)
            {
                if (elem.GetType() == typeof(Wall))
                {
                    Wall wnext = (Wall)elem;

                    if (!bannedWalls.Contains(wnext.Id.IntegerValue))
                    {

                        Tuple<Curve, Curve> curves = getInsulationLayer(doc, wnext);
                        Curve lowerunbound = lower.Clone();
                        lowerunbound.MakeUnbound();
                        Curve upperunbound = upper.Clone();
                        upperunbound.MakeUnbound();
                        Curve lowernext = curves.Item2.Clone();
                        lowernext.MakeUnbound();

                        IntersectionResultArray result = new IntersectionResultArray();

                        lowerunbound.Intersect(lowernext, out result);
                        if (result != null && result.Size == 1)
                        {
                            IntersectionPointLower = result.get_Item(0).XYZPoint;
                        }

                        upperunbound.Intersect(lowernext, out result);
                        if (result != null && result.Size == 1)
                        {
                            IntersectionPointUpper = result.get_Item(0).XYZPoint;
                        }

                    }

                }
            }

            if (IntersectionPointLower == null || IntersectionPointUpper == null) return existing;

            return new Tuple<Curve, Curve>(Line.CreateBound(upper.GetEndPoint(0), IntersectionPointUpper), Line.CreateBound(lower.GetEndPoint(0), IntersectionPointLower));
        }
开发者ID:moethu,项目名称:Insulator,代码行数:57,代码来源:Insulator.cs

示例4: CreateCurveByPoints

        private CurveByPoints CreateCurveByPoints(CurveByPoints c, Curve gc, XYZ start, XYZ end)
        {
            //Add the geometry curves start and end points to a ReferencePointArray.
            ReferencePointArray refPtArr = new ReferencePointArray();
            if (gc.GetType() == typeof(Line))
            {
                ReferencePoint refPointStart = this.UIDocument.Document.FamilyCreate.NewReferencePoint(start);
                ReferencePoint refPointEnd = this.UIDocument.Document.FamilyCreate.NewReferencePoint(end);
                refPtArr.Append(refPointStart);
                refPtArr.Append(refPointEnd);
            }

            c = dynRevitSettings.Doc.Document.FamilyCreate.NewCurveByPoints(refPtArr);
            return c;
        }
开发者ID:epeter61,项目名称:Dynamo,代码行数:15,代码来源:dynCurves.cs

示例5: handleJoinsLeft

        /// <summary>
        /// Get the Insulation Layer of Left hand joined Walls
        /// </summary>
        public Curve handleJoinsLeft(Document doc, LocationCurve wallLocCurve, Curve lower, ref List<int> bannedWalls)
        {
            if (lower.GetType() == typeof(Arc) || lower.GetType() == typeof(NurbSpline)) return lower;

            XYZ IntersectionPoint = null;
            ElementArray elems = wallLocCurve.get_ElementsAtJoin(0);

            if (elems == null || elems.Size == 0) return lower;

            foreach (Element elem in elems)
            {
                if (elem.GetType() == typeof(Wall))
                {
                    Wall wnext = (Wall)elem;

                    if (!bannedWalls.Contains(wnext.Id.IntegerValue))
                    {

                        Tuple<Curve, Curve> curves = getInsulationLayer(doc, wnext);
                        Curve lowerunbound = lower.Clone();
                        lowerunbound.MakeUnbound();
                        Curve upper = curves.Item1.Clone();
                        upper.MakeUnbound();

                        IntersectionResultArray result = new IntersectionResultArray();

                        lowerunbound.Intersect(upper, out result);
                        if (result != null && result.Size == 1)
                        {
                            IntersectionPoint = result.get_Item(0).XYZPoint;
                        }

                    }

                }
            }

            if (IntersectionPoint == null) return lower;

            Line l = Line.CreateBound(IntersectionPoint, lower.GetEndPoint(1));

            return l;
        }
开发者ID:moethu,项目名称:Insulator,代码行数:46,代码来源:Insulator.cs


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