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: 

Need iLogic code for opening -or- deleting a component from within an assembly.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
loomeye
632 Views, 2 Replies

Need iLogic code for opening -or- deleting a component from within an assembly.

I realize these are two different operations, but I thought I could comine them into one post.

 

First, there is a skeleton part in my flexible assembly that I would like to have automatically open for editing (in it's own window; in the same Inventor instance) when the end user runs an iLogic rule.

 

Second, in a seperate rule, I need to be able to delete (not just supress) a component out of an assembly.

 

For both of these operations I would prefer to use the component name of the part to be opened or deleted.  For deleting this is a must, but for opening the skeleton part, using file name and path will work if needed.

 

Thanks in advance!

2 REPLIES 2
Message 2 of 3
loomeye
in reply to: loomeye

Well since I have it figured out I thought I'd post the answers to my own questions.

 

To open a part within an assembly (this opens a part with the same filename as the assembly + "_skeleton":

 

fname=ThisDoc.PathAndFileName(False)&"_Skeleton.ipt"

doc=ThisApplication.Documents.Open(fname)

 

To delete a part in an assembly:

compo = Component.InventorComponent("Form Tool")

compo.delete

Message 3 of 3
Anonymous
in reply to: loomeye

Hi!

 

Do you have a code to delete assembly?

 

Thanks for your help 🙂

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

Post to forums  

Autodesk Design & Make Report