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;
}