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


C# CurveArray.Append方法代码示例

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


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

示例1: 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

示例2: 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

示例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: 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

示例5: 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

示例6: 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

示例7: CreateNewSweptBlendArc

        /// <summary>
        /// Create a new swept blend form using arcs to
        /// define circular start and end profiles and an
        /// arc path. The NewSweptBlend method requires 
        /// the input profiles to be in the XY plane.
        /// </summary>
        public void CreateNewSweptBlendArc( 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 credoc
            = doc.FamilyCreate;

              #region Original code for Revit 2012
              #if COMPILE_ORIGINAL_CODE
              XYZ pnt1 = new XYZ( 0, -1, 0 );
              XYZ pnt2 = new XYZ( 1, 0, 0 );
              XYZ pnt3 = new XYZ( 0, 1, 0 );
              XYZ pnt4 = new XYZ( -1, 0, 0 );
              Arc aArc1 = creapp.NewArc( pnt1, pnt3, pnt2 );
              Arc aArc2 = creapp.NewArc( pnt3, pnt1, pnt4 );
              CurveArrArray arrarr1 = new CurveArrArray();

              SweepProfile bottomProfile
            = creapp.NewCurveLoopsProfile( arrarr1 );

              CurveArray arr1 = new CurveArray();
              arr1.Append( aArc1 );
              arr1.Append( aArc2 );
              XYZ pnt6 = new XYZ( 0, -2, 0 );
              XYZ pnt7 = new XYZ( 2, 0, 0 );
              XYZ pnt8 = new XYZ( 0, 2, 0 );
              XYZ pnt9 = new XYZ( -2, 0, 0 );
              Arc aArc3 = creapp.NewArc( pnt6, pnt8, pnt7 );
              Arc aArc4 = creapp.NewArc( pnt8, pnt6, pnt9 );
              CurveArrArray arrarr2 = new CurveArrArray();
              CurveArray arr2 = new CurveArray();
              arr2.Append( aArc3 );
              arr2.Append( aArc4 );
              arrarr2.Append( arr2 );

              SweepProfile topProfile
            = creapp.NewCurveLoopsProfile( arrarr2 );

              XYZ pnt10 = new XYZ( 0, 0, 0 );
              XYZ pnt11 = new XYZ( 0, 5, 0 );
              XYZ pnt122 = new XYZ( 2.5, 2.5, 0 );
              Arc testArc = creapp.NewArc( pnt10, pnt11, pnt122 );
              Curve curve = (Curve) testArc;

              Plane geometryPlane = creapp.NewPlane(
            XYZ.BasisZ, XYZ.Zero );

              SketchPlane sketchPlane = doc.NewSketchPlane(
            geometryPlane );

              SweptBlend aSweptBlend = doc.NewSweptBlend(
            true, curve, sketchPlane, bottomProfile,
            topProfile );
              #endif // COMPILE_ORIGINAL_CODE
              #endregion // Original code for Revit 2012

              XYZ px = XYZ.BasisX;
              XYZ py = XYZ.BasisY;
              Arc arc1 = Arc.Create( -px, px, -py );
              Arc arc2 = Arc.Create( px, -px, py );
              CurveArray arr1 = new CurveArray();
              arr1.Append( arc1 );
              arr1.Append( arc2 );
              CurveArrArray arrarr1 = new CurveArrArray();
              arrarr1.Append( arr1 );

              SweepProfile bottomProfile
            = creapp.NewCurveLoopsProfile( arrarr1 );

              px += px;
              py += py;
              Arc arc3 = Arc.Create( -px, px, -py );
              Arc arc4 = Arc.Create( px, -px, py );
              CurveArray arr2 = new CurveArray();
              arr2.Append( arc3 );
              arr2.Append( arc4 );
              CurveArrArray arrarr2 = new CurveArrArray();
              arrarr2.Append( arr2 );

              SweepProfile topProfile
            = creapp.NewCurveLoopsProfile( arrarr2 );

              XYZ p0 = XYZ.Zero;
              XYZ p5 = 5 * XYZ.BasisY;
              XYZ pmid = new XYZ( 2.5, 2.5, 0 );
              Arc testArc = Arc.Create( p0, p5, pmid );

              Plane geometryPlane = creapp.NewPlane(
//.........这里部分代码省略.........
开发者ID:nbright,项目名称:the_building_coder_samples,代码行数:101,代码来源:CmdNewSweptBlend.cs

示例8: Execute2

        Result Execute2(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
              UIDocument uidoc = uiapp.ActiveUIDocument;
              Document doc = uidoc.Document;

              using( Transaction tx = new Transaction( doc ) )
              {
            tx.Start( "Create a Floor" );

            int n = 4;
            XYZ[] points = new XYZ[n];
            points[0] = XYZ.Zero;
            points[1] = new XYZ( 10.0, 0.0, 0.0 );
            points[2] = new XYZ( 10.0, 10.0, 0.0 );
            points[3] = new XYZ( 0.0, 10.0, 0.0 );

            CurveArray curve = new CurveArray();

            for( int i = 0; i < n; i++ )
            {
              Line line = Line.CreateBound( points[i],
            points[( i < n - 1 ) ? i + 1 : 0] );

              curve.Append( line );
            }

            doc.Create.NewFloor( curve, true );

            tx.Commit();
              }
              return Result.Succeeded;
        }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:36,代码来源:CmdEditFloor.cs

示例9: CreatePolyline

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pts"></param>
        private void CreatePolyline(IList<XYZ> pts)
        {
            if (m_sketchPlane == null) {
                XYZ zAxis = GeomUtils.kZAxis;
                XYZ origin = GeomUtils.kOrigin;
                Plane plane = m_app.Application.Create.NewPlane(zAxis, origin);

                m_sketchPlane = SketchPlane.Create(m_app.ActiveUIDocument.Document, plane);
            }

            Line line;
            XYZ startPt;
            XYZ endPt;
            CurveArray curveArray = new CurveArray();

            for (int i = 0; i < (pts.Count - 1); ++i)
            {
                startPt = pts[i];
                endPt   = pts[i + 1];

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

            m_app.ActiveUIDocument.Document.Create.NewModelCurveArray(curveArray, m_sketchPlane);
        }
开发者ID:15921050052,项目名称:RevitLookup,代码行数:30,代码来源:Tower.cs

示例10: GetCurveArray

        private CurveArray GetCurveArray(IEnumerable<LyrebirdCurve> curves)
        {
            CurveArray crvArray = new CurveArray();
            int i = 0;
            foreach (LyrebirdCurve lbc in curves)
            {
                if (lbc.CurveType == "Circle")
                {
                    XYZ pt1 = new XYZ(UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[0].X, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[0].Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[0].Z, lengthDUT));
                    XYZ pt2 = new XYZ(UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[1].X, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[1].Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[1].Z, lengthDUT));
                    XYZ pt3 = new XYZ(UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[2].X, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[2].Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[2].Z, lengthDUT));
                    XYZ pt4 = new XYZ(UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[3].X, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[3].Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[3].Z, lengthDUT));
                    XYZ pt5 = new XYZ(UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[4].X, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[4].Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[4].Z, lengthDUT));
                    Arc arc1 = Arc.Create(pt1, pt3, pt2);
                    Arc arc2 = Arc.Create(pt3, pt5, pt4);
                    crvArray.Append(arc1);
                    crvArray.Append(arc2);
                }
                else if (lbc.CurveType == "Arc")
                {
                    XYZ pt1 = new XYZ(UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[0].X, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[0].Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[0].Z, lengthDUT));
                    XYZ pt2 = new XYZ(UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[1].X, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[1].Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[1].Z, lengthDUT));
                    XYZ pt3 = new XYZ(UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[2].X, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[2].Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[2].Z, lengthDUT));
                    Arc arc = Arc.Create(pt1, pt3, pt2);
                    crvArray.Append(arc);
                }
                else if (lbc.CurveType == "Line")
                {
                    XYZ pt1 = new XYZ(UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[0].X, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[0].Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[0].Z, lengthDUT));
                    XYZ pt2 = new XYZ(UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[1].X, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[1].Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lbc.ControlPoints[1].Z, lengthDUT));
                    Line line = Line.CreateBound(pt1, pt2);
                    crvArray.Append(line);
                }
                else if (lbc.CurveType == "Spline")
                {
                    List<XYZ> controlPoints = new List<XYZ>();
                    List<double> weights = lbc.Weights;
                    List<double> knots = lbc.Knots;

                    foreach (LyrebirdPoint lp in lbc.ControlPoints)
                    {
                        XYZ pt = new XYZ(UnitUtils.ConvertToInternalUnits(lp.X, lengthDUT), UnitUtils.ConvertToInternalUnits(lp.Y, lengthDUT), UnitUtils.ConvertToInternalUnits(lp.Z, lengthDUT));
                        controlPoints.Add(pt);
                    }
                    try
                    {
                        if (lbc.Degree == 3)
                        {
                            NurbSpline spline = NurbSpline.Create(controlPoints, weights, knots, lbc.Degree, false, true);
                            crvArray.Append(spline);
                        }
                        else
                        {
                            HermiteSpline spline = HermiteSpline.Create(controlPoints, false);
                            crvArray.Append(spline);
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine("Error", ex.Message);
                    }
                }
                i++;
            }
            return crvArray;
        }
开发者ID:samuto,项目名称:Lyrebird,代码行数:66,代码来源:LyrebirdService.cs

示例11: CreateRoom

        /// <summary>
        /// Create a room on a given level.
        /// </summary>
        void CreateRoom( 
            Document doc,
            Level level)
        {
            Application app = doc.Application;

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

              Autodesk.Revit.Creation.Document
            docCreation = doc.Create;

              XYZ pt1 = new XYZ( 0, -5, 0 );
              XYZ pt2 = new XYZ( 0, 5, 0 );
              XYZ pt3 = new XYZ( 8, 5, 0 );
              XYZ pt4 = new XYZ( 8, -5, 0 );

              Line line1 = Line.CreateBound( pt1, pt2 );
              Line line2 = Line.CreateBound( pt2, pt3 );
              Line line3 = Line.CreateBound( pt3, pt4 );
              Line line4 = Line.CreateBound( pt4, pt1 );

              CurveArray curveArr = new CurveArray();

              curveArr.Append( line1 );
              curveArr.Append( line2 );
              curveArr.Append( line3 );
              curveArr.Append( line4 );

              docCreation.NewRoomBoundaryLines(
            doc.ActiveView.SketchPlane,
            curveArr, doc.ActiveView );

              // Create a new room

              UV tagPoint = new UV( 4, 0 );

              Room room = docCreation.NewRoom(
            level, tagPoint );

              if( null == room )
              {
            throw new Exception(
              "Create a new room failed." );
              }
              room.Number = "42";
              room.Name = "Lobby";

              // Creation.Document.NewRoomTag( Room, UV, View) is obsolete.
              // Use the NewRoomTag(LinkElementId, UV, ElementId) overload instead.

              //RoomTag tag = docCreation.NewRoomTag( room, tagPoint, doc.ActiveView ); // 2013

              RoomTag tag = docCreation.NewRoomTag(
            new LinkElementId( room.Id ), tagPoint,
            doc.ActiveView.Id ); // 2014
        }
开发者ID:nbright,项目名称:the_building_coder_samples,代码行数:60,代码来源:CmdPlanTopology.cs

示例12: GetCurves

        /// <summary>
        /// Recursively traverse the GeometryElement obtained from this Element, collecting the Curves
        /// </summary>
        /// <param name="geomElem"></param>
        /// <param name="curves"></param>
        private static void GetCurves(IEnumerable<Autodesk.Revit.DB.GeometryObject> geomElem, ref CurveArray curves)
        {
            foreach (Autodesk.Revit.DB.GeometryObject geomObj in geomElem)
            {
                var curve = geomObj as Autodesk.Revit.DB.Curve;
                if (null != curve)
                {
                    curves.Append(curve);
                    continue;
                }

                //If this GeometryObject is Instance, call AddCurve
                var geomInst = geomObj as GeometryInstance;
                if (null != geomInst)
                {
                    var transformedGeomElem // curves transformed into project coords
                        = geomInst.GetSymbolGeometry(geomInst.Transform.Inverse);
                    GetCurves(transformedGeomElem, ref curves);
                }
            }
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:26,代码来源:Element.cs

示例13: Execute


//.........这里部分代码省略.........
              // Determine top face of each selected floor:

              int nNullFaces = 0;
              List<Face> topFaces = new List<Face>();
              Options opt = app.Application.Create.NewGeometryOptions();

              foreach( Floor floor in floors )
              {
            GeometryElement geo = floor.get_Geometry( opt );

            //GeometryObjectArray objects = geo.Objects; // 2012

            foreach( GeometryObject obj in geo )
            {
              Solid solid = obj as Solid;
              if( solid != null )
              {
            PlanarFace f = GetTopFace( solid );
            if( null == f )
            {
              Debug.WriteLine(
                Util.ElementDescription( floor )
                + " has no top face." );
              ++nNullFaces;
            }
            topFaces.Add( f );
              }
            }
              }

              // Create new floors from the top faces found
              // before creating the new floor, we would obviously
              // apply whatever modifications are required to the
              // new floor profile:

              Autodesk.Revit.Creation.Application creApp = app.Application.Create;
              Autodesk.Revit.Creation.Document creDoc = doc.Create;

              int i = 0;
              int n = topFaces.Count - nNullFaces;

              Debug.Print(
            "{0} top face{1} found.",
            n, Util.PluralSuffix( n ) );

              foreach( Face f in topFaces )
              {
            Floor floor = floors[i++] as Floor;

            if( null != f )
            {
              EdgeArrayArray eaa = f.EdgeLoops;
              CurveArray profile;

              #region Attempt to include inner loops
            #if ATTEMPT_TO_INCLUDE_INNER_LOOPS
              bool use_original_loops = true;
              if( use_original_loops )
              {
            profile = Convert( eaa );
              }
              else
            #endif // ATTEMPT_TO_INCLUDE_INNER_LOOPS
              #endregion // Attempt to include inner loops

              {
            profile = new CurveArray();

            // Only use first edge array,
            // the outer boundary loop,
            // skip the further items
            // representing holes:

            EdgeArray ea = eaa.get_Item( 0 );
            foreach( Edge e in ea )
            {
              IList<XYZ> pts = e.Tessellate();
              int m = pts.Count;
              XYZ p = pts[0];
              XYZ q = pts[m - 1];
              Line line = Line.CreateBound( p, q );
              profile.Append( line );
            }
              }
              //Level level = floor.Level; // 2013

              Level level = doc.GetElement( floor.LevelId )
            as Level; // 2014

              floor = creDoc.NewFloor( profile,
            floor.FloorType, level, true );

              XYZ v = new XYZ( 5, 5, 0 );

              //doc.Move( floor, v ); // 2011
              ElementTransformUtils.MoveElement( doc, floor.Id, v ); // 2012
            }
              }
              return Result.Succeeded;
        }
开发者ID:JesseMom,项目名称:the_building_coder_samples,代码行数:101,代码来源:CmdEditFloor.cs

示例14: 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 reference
            FaceArray faces = GeomUtil.GetFaces(floor);
            foreach (Face face in faces)
            {
                if (GeomUtil.IsHorizontalFace(face))
                {
                    refer = face.Reference;
                    break;
                }
            }
            //no proper reference
            if (null == refer)
            {
                return false;
            }

            //check the analytical model profile is rectangular
            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;
            }

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

示例15: ByOutlineTypeAndLevel

        /// <summary>
        /// Create a Revit Floor given it's curve outline and Level
        /// </summary>
        /// <param name="outline"></param>
        /// <param name="floorType"></param>
        /// <param name="level"></param>
        /// <returns>The floor</returns>
        public static Floor ByOutlineTypeAndLevel(PolyCurve outline, FloorType floorType, Level level)
        {
            if (outline == null)
            {
                throw new ArgumentNullException("outline");
            }

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

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

            if (!outline.IsClosed)
            {
                throw new ArgumentException("The input PolyCurve is not closed");
            }

            var ca = new CurveArray();
            outline.Curves().ForEach(x => ca.Append(x.ToRevitType())); 

            return new Floor(ca, floorType.InternalFloorType, level.InternalLevel );
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:34,代码来源:Floor.cs


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