Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

To get the latest sketch in a partdocument

1 REPLY 1
SOLVED
Reply
Message 1 of 2
colli123
200 Views, 1 Reply

To get the latest sketch in a partdocument

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

1 REPLY 1
Message 2 of 2
colli123
in reply to: colli123

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?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report