Save Subassembly from iLogic in Master Level of Detail.

Save Subassembly from iLogic in Master Level of Detail.

Anonymous
Not applicable
421 Views
2 Replies
Message 1 of 3

Save Subassembly from iLogic in Master Level of Detail.

Anonymous
Not applicable

Hi All...

 

Used all day on this and it is driving me nuts 🙂

 

If I have a Main Assembly with a subassembly in it.

How can you have a iLogic go into the subassembly and change LOD to Master and save the file.

I can make it work with a custom LOD. But for some reason Master will not save.

 

Simple iLogic rule in Main assembly:

oAsembly = "C:\xxx\SubAssembly.iam"
doc = ThisApplication.Documents.Open(oAsembly,False) 
auto = iLogicVb.Automation
auto.RunRule(doc, "MasterLOD")

 

Simple iLogic rule (MasterLOD) in SubAssembly :

oDoc = ThisDoc.Document

oDoc
.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Master").Activate oDoc.Save

 

Any idea what is wrong. 

 

/Jacob

 

 

 

0 Likes
Accepted solutions (1)
422 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Anonymous 

 

Welcome to the forum.

 

You should be able to do all of this from the top level assembly, without opening the subassembly. First get the occurrence name, then get the document from the occurrence definition, then you can set the LOD...

 

I had to "smudge" the document with dirty = true to force it to save though.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

oOcc = Component.InventorComponent("SubAssembly:1")

Dim oDoc As Document
oDoc = oOcc.Definition.Document
oDoc.ComponentDefinition.RepresentationsManager.LevelOfDetailRepresentations("Master").Activate

oDoc.dirty = True
oDoc.save

 

EESignature

0 Likes
Message 3 of 3

Anonymous
Not applicable

.dirty = True was the trick 🙂

Thank you so much for that one. 

 

/Jacob

0 Likes