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: 

How to open an .iam document from it's part using iLogic Rules

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
619 Views, 5 Replies

How to open an .iam document from it's part using iLogic Rules

So I'm quite new to the Ilogic system and my Programming skills are not very good.

Now the thing is, I want to open an Assembly and update it once I've saved the part underneath it using iLogic Rules and such. The part I'm referring to is a basic thing with a few parameters that can be changed in a pop up field I already made, once these parameters are changed I will save the part and then I want the Assembly to be automatically opened and updated. I've tried a few codes but non so far seems to work. 

5 REPLIES 5
Message 2 of 6
mcgyvr
in reply to: Anonymous

How will you define which assembly the part is used in?

An assembly knows which parts are used in it..

A part does NOT know which assemblies its used in.

 

What happens when your part is used in more than one assembly?



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 3 of 6
Anonymous
in reply to: mcgyvr

As far as I know It will not be used in another assembly, and I was thinking about telling it which exact document it should open. not just to tell it open assembly but open that assembly

Message 4 of 6
chandra.shekar.g
in reply to: Anonymous

@Anonymous,

 

There is no direct approach to determine the assembly from a part. Try attributes(https://modthemachine.typepad.com/my_weblog/2009/07/introduction-to-attributes.html) or custom iProperties which can store assembly name of part used in.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 5 of 6
WCrihfield
in reply to: Anonymous

If the assembly has either been initialized (but not fully open) or fully open (but in the background), you could use the part documents' (oPDoc.ReferencingDocuments property to get all in-memory documents that are referencing the active part.  Then loop through them, checking if it is an assembly, to get that document, then open or activate it.  Then you can also update it and save it, if you want.

Otherwise, to simply open the assembly, with a supplied full file name, you can use something like this:

 

Dim oADoc As AssemblyDocument =  ThisApplication.Documents.Open(oAssemblyFullFileName,True) 'True = visibly, False = in the background

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 6
J-Camper
in reply to: Anonymous

You can access referencing documents of a part, which should have all assemblies/drawings/derived parts that reference the Part.  You would need to eliminate any non-assembly files and if there is more than 1 left, specify which of them is the true parent. [maybe with a input-listbox for user interaction]

 

Code below is a proof of concept, hard-coded for the first referencing document, and will have more possibilities if the part is used by multiple documents:

Dim pDoc As PartDocument = ThisDoc.Document
MessageBox.Show("Referencing documents: " & pDoc.ReferencingDocuments.Count & "     Item 1: " & pDoc.ReferencingDocuments.Item(1).DisplayName, "Placed Inside Assembly:")

 

Let me know if something doesn't make sense or if this is not what you are looking for.

 

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

Post to forums  

Autodesk Design & Make Report