AnsweredAssumed Answered

creating a sketch on a new plane

Question asked by M. Doga Dogan on Jul 5, 2017
Latest reply on Mar 28, 2018 by Matt Davey



I would like to write a macro that creates a new plane with a given distance dynamically, and then starts a 2D sketch on it. Therefore I need to select the newly created plane before I start the sketch. I couldn't understand how to choose a newly created plane.


My current code looks like this:


    Dim myRefPlane As Object

    Distance = Distance / 1000

    Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, Distance, 0, 0, 0, 0)

    Part.ClearSelection2 True

    boolstatus = Part.Extension.SelectByID2("Plane1", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

    Part.SketchManager.InsertSketch True


The code above just assumes that the new plane is called Plane1, however, this might not be the case. Any ideas?


Thank you