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: 

Previous constrain

3 REPLIES 3
Reply
Message 1 of 4
stefaanboel
205 Views, 3 Replies

Previous constrain

When I place a constraint sometimes I need to re-edit it. Then I have to search for it in the model browser.

Anyone having a piece of code so I can create a button that makes you edit the latest placed constraint?

thanks in advance!

Stefaan
http://www.inventorwizard.be Edited by: stefaanboel on Jan 8, 2010 1:57 PM


If this is the solution, push the solution button Smiley Wink (and maybe some kudos)

3 REPLIES 3
Message 2 of 4

There's an OnNewConstraint event in the Application.AssemblyEvents. You can catch the After one and keep track of the name of the constraint. If you want to get tricky, you can watch the Document OnChange event for a Context Internal Name involving the string "RenameConstraint". On the After for that, you can get the new name of the constraint.
Message 3 of 4
clemsoh
in reply to: stefaanboel

Also, the last item in an assembly document's constraints is always the last created constraint (not necessarily the last 'edited' constraint).

e.g. The following code will display the name of the very last constraint placed in an assembly of the active document (assuming the active document is an assembly)

Dim oCNs as AssemblyConstraints
Set oCNs = ThisApplication.ActiveDocument.ComponentDefinition.Constraints
If oCNs.Count > 0 Then MsgBox oCNs.Item(oCNs.Count).Name
Message 4 of 4
stefaanboel
in reply to: stefaanboel

That code indeed works fine giving me the correct name of the constraint.
How can I then make sure it gives me the edit constraint box of that placed constraint?


If this is the solution, push the solution button Smiley Wink (and maybe some kudos)

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

Post to forums  

Autodesk Design & Make Report