BuildingCoder.CmdFaceWall.CreateMassExtrusion C# (CSharp) Метод

CreateMassExtrusion() статический приватный Метод

Create an extrusion form in the given conceptual mass family document.
static private CreateMassExtrusion ( Document doc ) : void
doc Document
Результат void
        static void CreateMassExtrusion(
            Document doc)
        {
            using( Transaction tx = new Transaction( doc ) )
              {
            tx.Start( "Create Mass" );

            // Create profile

            ReferenceArray refar = new ReferenceArray();

            XYZ[] pts = new XYZ[] {
            new XYZ( -10, -10, 0 ),
            new XYZ( +10, -10, 0 ),
            new XYZ( +10, +10, 0 ),
            new XYZ( -10, +10, 0 ) };

            int j, n = pts.Length;

            for( int i = 0; i < n; ++i )
            {
              j = i + 1;

              if( j >= n ) { j = 0; }

              // The Creator.CreateModelLine method creates
              // pretty arbitrary sketch planes, which causes
              // the NewExtrusionForm method to fail, saying
              // "Cannot create extrude form."

              //ModelCurve c = Creator.CreateModelLine( doc, pts[i], pts[j] );

              ModelCurve c = MakeLine( doc, pts[i], pts[j] );

              refar.Append( c.GeometryCurve.Reference );
            }

            //doc.Regenerate();

            // The extrusion form direction and length.
            // The direction must be perpendicular to the
            // plane determined by profile. The length
            // must be non-zero.

            XYZ direction = new XYZ( /*-6*/ 0, 0, 20 );

            Form form = doc.FamilyCreate.NewExtrusionForm( // Cannot create extrude form.
              true, refar, direction );

            tx.Commit();
              }
        }