BuildingCoder.CmdNewSweptBlend.CreateSketchPlane C# (CSharp) Method

CreateSketchPlane() private method

Create a sketch plane. This helper method is copied from the GenericModelCreation SDK sample.
private CreateSketchPlane ( Document doc, XYZ normal, XYZ origin ) : SketchPlane
doc Document
normal XYZ
origin XYZ
return SketchPlane
        SketchPlane CreateSketchPlane(
            Document doc,
            XYZ normal,
            XYZ origin)
        {
            Application app = doc.Application;

              // Create a Geometry.Plane required by the
              // NewSketchPlane() method

              //Plane geometryPlane = app.Create.NewPlane( normal, origin ); // 2016
              Plane geometryPlane = Plane.CreateByNormalAndOrigin( normal, origin ); // 2017

              if( null == geometryPlane )
              {
            throw new Exception( "Geometry plane creation failed." );
              }

              // Create a sketch plane using the Geometry.Plane

              //SketchPlane plane = doc.FamilyCreate.NewSketchPlane( geometryPlane ); // 2013

              SketchPlane plane = SketchPlane.Create(
            doc, geometryPlane ); // 2014

              if( null == plane )
              {
            throw new Exception( "Sketch plane creation failed." );
              }
              return plane;
        }