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: 

VBA script to constrain multiple parts

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
pball
737 Views, 2 Replies

VBA script to constrain multiple parts

This is a question of how feasable an idea is to script.

 

Lets say we have a plate with 100 randomly placed holes on it and 100 parts to attach to those holes. The parts aren't content center parts so they can't inserted in an easy fashion and the random hole spacing makes component pattern useless. The parts would normally be constrained using the insert command and you'd have to do all 100 separately. Would it be possible to make a script that would let you select the 100 parts then choose the selected geometry on one part and then a hole on the plate. It would apply that insert constraint and automatically select the same geometry on another part so you could simply select another hole. Then rinse and repeat until all the parts have been constrained to holes on the plate.

 

If something like that is possible it'd cut down the number of clicks greatly and also panning/rotating to select the different parts and holes on the plate. This isn't a daily thing we'd be doing, but it comes up enough in large assemblies it could be very useful. I haven't done any scripting for things inside parts/assemblies so I don't know what's possible while scripting.

2 REPLIES 2
Message 2 of 3
jdkriek
in reply to: pball

Assign iMates to the parts, loop through the Assembly and insert each part using it's iMates

 

There are examples of this in "Assembly Constraints and iMates" in Programming Help section

 

In the same section there are examples using the AssemblyConstraints.AddInsertConstraint Method as well.

 

I've written various macros to do this exact thing and the iMates was by far the fastest and most reliable.

 

Hope this helps.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 3
dg2405
in reply to: pball

maybe this code could help you:

http://forums.autodesk.com/t5/inventor-customization/rivet-assembly/td-p/6286291/page/2

take the last posted code.

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

Post to forums  

Autodesk Design & Make Report