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


C# CurveArray类代码示例

本文整理汇总了C#中CurveArray的典型用法代码示例。如果您正苦于以下问题:C# CurveArray类的具体用法?C# CurveArray怎么用?C# CurveArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CreateHelix

        public void CreateHelix()
        {
            double increment = 0.1;
            double current = 0;
            XYZ startPt;
            XYZ endPt;
            XYZ zAxis = GeomUtils.kZAxis;
            XYZ origin = GeomUtils.kOrigin;
            Line line;
            Plane plane = m_revitApp.Application.Create.NewPlane(zAxis, origin);
            SketchPlane sketchPlane = SketchPlane.Create(m_revitApp.ActiveUIDocument.Document, plane);
            CurveArray curveArray = new CurveArray();

            startPt = new XYZ(Math.Cos(current), Math.Sin(current), current);
            current += increment;

            while (current <= GeomUtils.kTwoPi) {
                endPt = new XYZ(Math.Cos(current), Math.Sin(current), current);

                line = Line.CreateBound(startPt, endPt);
                curveArray.Append(line);

                startPt = endPt;
                current += increment;
            }

            m_revitApp.ActiveUIDocument.Document.Create.NewModelCurveArray(curveArray, sketchPlane);
        }
开发者ID:halad,项目名称:RevitLookup,代码行数:28,代码来源:TestGeometry.cs

示例2: Execute

        public IExternalCommand.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Application revit = commandData.Application;
            Document curDoc = revit.ActiveDocument;

            //配置几何曲线
            CurveArray curves = new CurveArray();
            if (null == curves)
            {
                message = "Create the curves failed.";
                return IExternalCommand.Result.Failed;
            }
            XYZ first = new XYZ(0, 0, 0);
            XYZ second = new XYZ(10, 0, 0);
            XYZ third = new XYZ(10, 10, 0);
            XYZ fourth = new XYZ(0, 10, 0);
            curves.Append(revit.Create.NewLine(ref first, ref second, true));
            curves.Append(revit.Create.NewLine(ref second, ref third, true));
            curves.Append(revit.Create.NewLine(ref third, ref fourth, true));
            curves.Append(revit.Create.NewLine(ref fourth, ref first, true));
            // 利用几何曲线,类型,标高等创建地板对象
            Floor createdFloor = curDoc.Create.NewFloor(curves, true);
            if (null == createdFloor)
            {
                message = "Create floor failed.!";
                return IExternalCommand.Result.Failed;
            }

            return IExternalCommand.Result.Succeeded;
        }
开发者ID:guchanghai,项目名称:Cut,代码行数:30,代码来源:NewFloor.cs

示例3: CreateFloor

 private static Autodesk.Revit.DB.Floor CreateFloor(IEnumerable<Value> edges, FloorType floorType, Autodesk.Revit.DB.Level level)
 {
     var ca = new CurveArray();
     edges.ToList().ForEach(x => ca.Append((Curve) ((Value.Container) x).Item));
     var floor = dynRevitSettings.Doc.Document.Create.NewFloor(ca, floorType, level, false);
     return floor;
 }
开发者ID:kah-heng,项目名称:Dynamo,代码行数:7,代码来源:Floor.cs

示例4: FindFloorViewDirection

 /// <summary>
 /// Find the view direction vector, 
 /// which is the same meaning of ViewDirection property in View class
 /// </summary>
 /// <param name="curveArray">the curve array which form floor's AnalyticalModel</param>
 /// <returns>the view direction vector</returns>
 public static Autodesk.Revit.DB.XYZ FindFloorViewDirection(CurveArray curveArray)
 {
     // Because the floor is always on the level,
     // so each curve can give the direction information.
     Curve curve = curveArray.get_Item(0);
     Autodesk.Revit.DB.XYZ first = curve.get_EndPoint(0);
     Autodesk.Revit.DB.XYZ second = curve.get_EndPoint(1);
     return FindDirection(first, second);
 }
开发者ID:AMEE,项目名称:revit,代码行数:15,代码来源:XYZMath.cs

示例5: Floor

        /// <summary>
        /// Private constructor
        /// </summary>
        private Floor(CurveArray curveArray, Autodesk.Revit.DB.FloorType floorType, Autodesk.Revit.DB.Level level)
        {
            TransactionManager.Instance.EnsureInTransaction(Document);

            // we assume the floor is not structural here, this may be a bad assumption
            var floor = Document.Create.NewFloor(curveArray, floorType, level, false);

            InternalSetFloor( floor );

            TransactionManager.Instance.TransactionTaskDone();

            ElementBinder.CleanupAndSetElementForTrace(Document, InternalFloor);
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:16,代码来源:Floor.cs

示例6: Execute

        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Autodesk.Revit.UI.UIApplication uiapp = commandData.Application;
              Autodesk.Revit.UI.UIDocument uidoc = uiapp.ActiveUIDocument;
              Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
              Autodesk.Revit.DB.Document doc = uidoc.Document;

              // Build a wall profile for the wall creation
              XYZ[] pts = new XYZ[] {
            XYZ.Zero,
            new XYZ(20, 0,  0),
            new XYZ(20, 0, 15),
            new XYZ(10, 0, 30),
            new XYZ( 0, 0, 15)
            };

              // Get application creation object
              Autodesk.Revit.Creation.Application appCreation = app.Create;

              // Create wall profile
              CurveArray profile = new CurveArray();
              XYZ q = pts[pts.Length - 1];

              foreach (XYZ p in pts)
              {
            profile.Append(appCreation.NewLineBound(q, p));
            q = p;
              }

              XYZ normal = XYZ.BasisY;

              WallType wallType
            = new FilteredElementCollector(doc)
              .OfClass(typeof(WallType))
              .First<Element>()
            as WallType;

              Level level
            = new FilteredElementCollector(doc)
              .OfClass(typeof(Level))
              .First<Element>(e
            => e.Name.Equals("Level 1"))
              as Level;

              Transaction trans = new Transaction(doc);
              trans.Start("Test Gable Wall");
              Wall wall = doc.Create.NewWall(profile, wallType, level, true, normal);
              trans.Commit();

              return Result.Succeeded;
        }
开发者ID:dalefugier,项目名称:Sockeye,代码行数:51,代码来源:CmdTestGableWall.cs

示例7: CreateBeamSystem

 /// <summary>
 /// create beam system according to given profile and property
 /// </summary>
 public void CreateBeamSystem()
 {
     Autodesk.Revit.Creation.Document docCreation = m_data.CommandData.Application.ActiveUIDocument.Document.Create;
     // create CurveArray and insert Lines in order
     CurveArray curves = new CurveArray();
     foreach (Line line in m_data.Lines)
     {
         curves.Append(line);
     }
     // create beam system takes closed profile consist of lines
     BeamSystem aBeamSystem = docCreation.NewBeamSystem(curves, m_data.CommandData.Application.ActiveUIDocument.Document.ActiveView.SketchPlane);
     // set created beam system's layout rule and beam type property
     aBeamSystem.LayoutRule = m_data.Param.Layout;
     aBeamSystem.BeamType   = m_data.Param.BeamType;
 }
开发者ID:AMEE,项目名称:revit,代码行数:18,代码来源:BeamSystemBuilder.cs

示例8: CreateCurveArrayByOffset

 /// <summary>
 /// The method is used to create a CurveArray along to an origin CurveArray and an offset value
 /// </summary>
 /// <param name="origin">the original CurveArray</param>
 /// <param name="offset">the offset value</param>
 /// <returns>CurveArray</returns>
 public CurveArray CreateCurveArrayByOffset(CurveArray origin, double offset)
 {
     Line line;
     Line temp;
     int counter = 0;
     CurveArray curveArr = m_appCreator.NewCurveArray();
     Autodesk.Revit.DB.XYZ offsetx = new Autodesk.Revit.DB.XYZ (offset, 0, 0);
     Autodesk.Revit.DB.XYZ offsetz = new Autodesk.Revit.DB.XYZ (0, 0, offset);
     Autodesk.Revit.DB.XYZ p0 = new Autodesk.Revit.DB.XYZ ();
     Autodesk.Revit.DB.XYZ p1 = new Autodesk.Revit.DB.XYZ (); ;
     Autodesk.Revit.DB.XYZ p2 = new Autodesk.Revit.DB.XYZ ();
     Autodesk.Revit.DB.XYZ p3 = new Autodesk.Revit.DB.XYZ ();
     foreach (Curve curve in origin)
     {
         temp = curve as Line;
         if (temp != null)
         {
             if (counter == 0)
             {
                 p0 = temp.get_EndPoint(0).Subtract(offsetz).Subtract(offsetx);
             }
             else if (counter == 1)
             {
                 p1 = temp.get_EndPoint(0).Subtract(offsetz).Add(offsetx);
             }
             else if (counter == 2)
             {
                 p2 = temp.get_EndPoint(0).Add(offsetx).Add(offsetz);
             }
             else
             {
                 p3 = temp.get_EndPoint(0).Subtract(offsetx).Add(offsetz);
             }
         }
         counter++;
     }
     line = m_appCreator.NewLineBound(p0, p1);
     curveArr.Append(line);
     line = m_appCreator.NewLineBound(p1, p2);
     curveArr.Append(line);
     line = m_appCreator.NewLineBound(p2, p3);
     curveArr.Append(line);
     line = m_appCreator.NewLineBound(p3, p0);
     curveArr.Append(line);
     return curveArr;
 }
开发者ID:AMEE,项目名称:revit,代码行数:52,代码来源:CreateExtrusion.cs

示例9: MakeArc

 /// <summary>
 /// Create arc element by three points
 /// </summary>
 /// <param name="app">revit application</param>
 /// <param name="ptA">point a</param>
 /// <param name="ptB">point b</param>
 /// <param name="ptC">point c</param>
 /// <returns></returns>
 public static ModelCurve MakeArc(UIApplication app, Autodesk.Revit.DB.XYZ ptA, Autodesk.Revit.DB.XYZ ptB, Autodesk.Revit.DB.XYZ ptC)
 {
     Document doc = app.ActiveUIDocument.Document;
      Arc arc = app.Application.Create.NewArc(ptA, ptB, ptC);
      // Create three lines and a plane by the points
      Line line1 = app.Application.Create.NewLine(ptA, ptB, true);
      Line line2 = app.Application.Create.NewLine(ptB, ptC, true);
      Line line3 = app.Application.Create.NewLine(ptC, ptA, true);
      CurveArray ca = new CurveArray();
      ca.Append(line1);
      ca.Append(line2);
      ca.Append(line3);
      Plane plane = app.Application.Create.NewPlane(ca);
      SketchPlane skplane = doc.FamilyCreate.NewSketchPlane(plane);
      // Create arc here
      ModelCurve modelcurve = doc.FamilyCreate.NewModelCurve(arc, skplane);
      return modelcurve;
 }
开发者ID:AMEE,项目名称:revit,代码行数:26,代码来源:Command.cs

示例10: CreateFootPrintRoof

        /// <summary>
        /// Create a footprint roof.
        /// </summary>
        /// <param name="footPrint">The footprint is a curve loop, or a wall loop, or loops combined of walls and curves</param>
        /// <param name="level">The base level of the roof to be created.</param>
        /// <param name="roofType">The type of the newly created roof.</param>
        /// <returns>Return a new created footprint roof.</returns>
        public FootPrintRoof CreateFootPrintRoof(CurveArray footPrint, Level level, RoofType roofType)
        {
            FootPrintRoof footprintRoof = null;
            Transaction createRoofTransaction = new Transaction(m_commandData.Application.ActiveUIDocument.Document, "FootPrintRoof");
            createRoofTransaction.Start();
            try
            {
                ModelCurveArray footPrintToModelCurveMapping = new ModelCurveArray();
                footprintRoof = m_creationDoc.NewFootPrintRoof(footPrint, level, roofType, out footPrintToModelCurveMapping);
                createRoofTransaction.Commit();
            }
            catch (System.Exception e)
            {
                createRoofTransaction.RollBack();
                throw e;
            }

            return footprintRoof;
        }
开发者ID:AMEE,项目名称:revit,代码行数:26,代码来源:FootPrintRoofManager.cs

示例11: CreateExtrusionRoof

        /// <summary>
        /// Create a extrusion roof.
        /// </summary>
        /// <param name="profile">The profile combined of straight lines and arcs.</param>
        /// <param name="refPlane">The reference plane for the extrusion roof.</param>
        /// <param name="level">The reference level of the roof to be created.</param>
        /// <param name="roofType">The type of the newly created roof.</param>
        /// <param name="extrusionStart">The extrusion start point.</param>
        /// <param name="extrusionEnd">The extrusion end point.</param>
        /// <returns>Return a new created extrusion roof.</returns>
        public ExtrusionRoof CreateExtrusionRoof(CurveArray profile, ReferencePlane refPlane, Level level, RoofType roofType,
            double extrusionStart, double extrusionEnd)
        {
            ExtrusionRoof extrusionRoof = null;
            Transaction createRoofTransaction = new Transaction(m_commandData.Application.ActiveUIDocument.Document, "ExtrusionRoof");
            createRoofTransaction.Start();
            try
            {
                extrusionRoof = m_creationDoc.NewExtrusionRoof(profile, refPlane, level, roofType, extrusionStart, extrusionEnd);
                createRoofTransaction.Commit();
            }
            catch (System.Exception e)
            {
                createRoofTransaction.RollBack();
                throw e;
            }

            return extrusionRoof;
        }
开发者ID:AMEE,项目名称:revit,代码行数:29,代码来源:ExtrusionRoofManager.cs

示例12: IsRectangular

        const double PRECISION = 0.00001; //precision when judge whether two doubles are equal

        #endregion Fields

        #region Methods

        /// <summary>
        /// judge whether given 4 lines can form a rectangular
        /// </summary>
        /// <param name="lines"></param>
        /// <returns>is rectangular</returns>
        /// <summary>
        /// judge whether given 4 lines can form a rectangular
        /// </summary>
        /// <param name="lines"></param>
        /// <returns>is rectangular</returns>
        public static bool IsRectangular(CurveArray curves)
        {
            if (curves.Size != 4)
            {
                return false;
            }

            Line[] lines = new Line[4];
            for (int i = 0; i < 4; i++)
            {
                lines[i] = curves.get_Item(i) as Line;
                if (null == lines[i])
                {
                    return false;
                }
            }

            Line iniLine = lines[0];
            Line[] verticalLines = new Line[2];
            Line paraLine = null;
            int index = 0;
            for (int i = 1; i < 4; i++)
            {
                if (IsVertical(lines[0], lines[i]))
                {
                    verticalLines[index] = lines[i];
                    index++;
                }
                else
                {
                    paraLine = lines[i];
                }
            }
            if (index != 2)
            {
                return false;
            }
            bool flag = IsVertical(paraLine, verticalLines[0]);
            return flag;
        }
开发者ID:AMEE,项目名称:revit,代码行数:56,代码来源:GeomUtil.cs

示例13: GetFloorGeom

        /// <summary>
        /// get necessary data when create AreaReinforcement on a horizontal floor
        /// </summary>
        /// <param name="floor">floor on which to create AreaReinforcemen</param>
        /// <param name="refer">reference of the horizontal face on the floor</param>
        /// <param name="curves">curves compose the horizontal face of the floor</param>
        /// <returns>is successful</returns>
        public bool GetFloorGeom(Floor floor, ref Reference refer, ref CurveArray curves)
        {
            //get horizontal face's reference
            FaceArray faces = GeomUtil.GetFaces(floor);
            foreach (Face face in faces)
            {
                if (GeomUtil.IsHorizontalFace(face))
                {
                    refer = face.Reference;
                    break;
                }
            }
            if (null == refer)
            {
                return false;
            }
            //get analytical model profile
            AnalyticalModel model = floor.GetAnalyticalModel();
            if (null == model)
            {
                return false;
            }

            IList<Curve> curveList = model.GetCurves(AnalyticalCurveType.ActiveCurves);
            curves = m_currentDoc.Application.Create.NewCurveArray();
            foreach (Curve curve in curveList)
            {
                curves.Append(curve);
            }

            if (!GeomUtil.IsRectangular(curves))
            {
                return false;
            }
            curves = AddInlaidCurves(curves, 0.5);

            return true;
        }
开发者ID:AMEE,项目名称:revit,代码行数:45,代码来源:GeomHelper.cs

示例14: SimpleFloor

        /// <summary>
        ///  Used by the SimpleShed to create its floors and the fake roof
        /// </summary>
        /// <param name="profile"></param>
        public Revit.ElementId SimpleFloor( CurveArray profile, Level level )
        {
            Autodesk.Revit.Creation.Document doc = m_revitApp.ActiveUIDocument.Document.Create;
              Autodesk.Revit.Creation.Application applic = m_revitApp.Application.Create;

              // Obtain the required floor type
              FloorType floorType = null;

              try
              {
            FilteredElementCollector fec = new FilteredElementCollector( m_revitApp.ActiveUIDocument.Document );
            ElementClassFilter elementsAreWanted = new ElementClassFilter( typeof( FloorType ) );
            fec.WherePasses( elementsAreWanted );
            List<Element> elements = fec.ToElements() as List<Element>;

            foreach( Element element in elements )
            {
              FloorType fType = element as FloorType;

              if( fType == null )
              {
            continue;
              }

              if( fType.Name == "Generic - 12\"" )
              {
            floorType = fType;
              }
            }
              }
              catch( Exception e )
              {
            throw e;
              }

              // Set the stuctural value
              bool structural = true;

              Revit.ElementId elemId = new ElementId( 0 );

              // Create the floor instance
              try
              {
            if( level.Name == "Level 2" )
            {
              level.Elevation = 10.0;

              Floor f = doc.NewFloor( profile, floorType, level, structural );

              Revit.ElementId fId = f.Id;
              m_shedElements.Add( fId );

              // This param need to be set for any level above Level 1 for the floor to move to the correct level
              Revit.Parameter midFloorparam = f.get_Parameter( BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM );
              midFloorparam.Set( 0.0 );

              return f.LevelId;
            }

            if( level.Name == "Level 1" )
            {

              Floor f = doc.NewFloor( profile, floorType, level, structural );

              Revit.ElementId fId = f.Id;
              m_shedElements.Add( fId );

              return f.LevelId;
            }

            // if none of the types match
            return elemId;
              }
              catch( Exception e )
              {
            throw e;
              }
        }
开发者ID:halad,项目名称:RevitLookup,代码行数:82,代码来源:TestElements.cs

示例15: CreateBlend

        static Blend CreateBlend( Document doc )
        {
            Debug.Assert( doc.IsFamilyDocument,
            "this method will only work in a family document" );

              Application app = doc.Application;

              Autodesk.Revit.Creation.Application creApp
            = app.Create;

              Autodesk.Revit.Creation.FamilyItemFactory factory
            = doc.FamilyCreate;

              double startAngle = 0;
              double midAngle = Math.PI;
              double endAngle = 2 * Math.PI;

              XYZ xAxis = XYZ.BasisX;
              XYZ yAxis = XYZ.BasisY;

              XYZ center = XYZ.Zero;
              XYZ normal = -XYZ.BasisZ;
              double radius = 0.7579;

              //Arc arc1 = creApp.NewArc( center, radius, startAngle, midAngle, xAxis, yAxis ); // 2013
              //Arc arc2 = creApp.NewArc( center, radius, midAngle, endAngle, xAxis, yAxis ); // 2013

              Arc arc1 = Arc.Create( center, radius, startAngle, midAngle, xAxis, yAxis ); // 2014
              Arc arc2 = Arc.Create( center, radius, midAngle, endAngle, xAxis, yAxis ); // 2014

              CurveArray baseProfile = new CurveArray();

              baseProfile.Append( arc1 );
              baseProfile.Append( arc2 );

              // create top profile:

              CurveArray topProfile = new CurveArray();

              bool circular_top = false;

              if( circular_top )
              {
            // create a circular top profile:

            XYZ center2 = new XYZ( 0, 0, 1.27 );

            //Arc arc3 = creApp.NewArc( center2, radius, startAngle, midAngle, xAxis, yAxis ); // 2013
            //Arc arc4 = creApp.NewArc( center2, radius, midAngle, endAngle, xAxis, yAxis ); // 2013

            Arc arc3 = Arc.Create( center2, radius, startAngle, midAngle, xAxis, yAxis ); // 2014
            Arc arc4 = Arc.Create( center2, radius, midAngle, endAngle, xAxis, yAxis ); // 2014

            topProfile.Append( arc3 );
            topProfile.Append( arc4 );
              }
              else
              {
            // create a skewed rectangle top profile:

            XYZ[] pts = new XYZ[] {
              new XYZ(0,0,3),
              new XYZ(2,0,3),
              new XYZ(3,2,3),
              new XYZ(0,4,3)
            };

            for( int i = 0; i < 4; ++i )
            {
              //topProfile.Append( creApp.NewLineBound( // 2013

              topProfile.Append( Line.CreateBound( // 2014
            pts[0 == i ? 3 : i - 1], pts[i] ) );
            }
              }

              Plane basePlane = creApp.NewPlane(
            normal, center );

              //SketchPlane sketch = factory.NewSketchPlane( basePlane ); // 2013
              SketchPlane sketch = SketchPlane.Create( doc, basePlane ); // 2014

              Blend blend = factory.NewBlend( true,
            topProfile, baseProfile, sketch );

              return blend;
        }
开发者ID:nbright,项目名称:the_building_coder_samples,代码行数:87,代码来源:CmdNewBlend.cs


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