Hello Community!
I'm looking for a way to get the lastest sketch in a part document as an object, to edit this sketch with api commands.
For example i finish a line sketch, that is savend as "Sketch6" in the partdocument.
Now the programm shall get this sketch and sweep along this sktech.
The sweeping is not so important. But I don't know how to get the latest sketch.
Does someone have an idea?
Greetings
Colli
Solved! Go to Solution.
Solved by colli123. Go to Solution.
I got it!
Dim mApp As Inventor.Application = Marshal.GetActiveObject("Inventor.Application") Dim oDoc As Inventor.PartDocument = mApp.ActiveDocument Dim oSketches As PlanarSketches = oDoc.ComponentDefinition.Sketches Dim oLastSketch As Sketch = oSketches.Item(oSketches.Count) MsgBox(oLastSketch.Name)
But now I realized that I need an additional Function to check if the latest sketch is still edited in the sketch-modus.
Only after the sketch-modus is closed (the Finish Sketch button was pressed) i want to edit the latest sketch with a code.
Is there a way to check if the sketch is still edited?