How to make an assembly's iProperties change when switching Levels of Detail

How to make an assembly's iProperties change when switching Levels of Detail

Anonymous
Not applicable
435 Views
4 Replies
Message 1 of 5

How to make an assembly's iProperties change when switching Levels of Detail

Anonymous
Not applicable

Is there a way to get the assembly's iProperties to change when you switch between different Levels of Detail? I figured that it's going to require iLogic, but I can't get anything to work. Now I'm only a very basic iLogic user, so I could be doing something wrong. Here's what I have:

 

SyntaxEditor Code Snippet

If LOD = "Standard" Then
	iProperties.Value("Project", "Part Number") = (65-1000)
Else If LOD = "Wide Throat" Then
        iProperties.Value("Project", "Part Number") = (65-2000)
End If

 It doesn't give me any errors, but it doesn't update the part number. Am I even representing the LOD correctly in the code? Do I need to use a case statement instead? If someone could tell me what's wrong with my code, or even just tell me that what I'm trying to do isn't possible, that would be great. Thank you.

0 Likes
Accepted solutions (1)
436 Views
4 Replies
Replies (4)
Message 2 of 5

philip1009
Advisor
Advisor
Accepted solution

It looks like you're trying to use Level of Detail to differentiate between different assemblies in the same Assembly.  I think the better solution would be to use iParts and iAssemblies, but here's the code to change the part number based on Level of Detail selected.

 

SyntaxEditor Code Snippet

oActiveLOD = ThisDoc.Document.ComponentDefinition.RepresentationsManager.ActiveLevelOfDetailRepresentation.Name
If oActiveLOD = "Standard" Then iProperties.Value("Project", "Part Number") = "65-1000"
If oActiveLOD = "Wide Throat" Then iProperties.Value("Project", "Part Number") = "65-2000"

In case you already don't know, in your Ribbon, go to Manage > iLogic > Event Triggers, and you can choose when this rule should run automatically.

Message 3 of 5

philip1009
Advisor
Advisor

Also, I forgot to mention that questions about coding are better suited for the Inventor Customization forum.

Message 4 of 5

Anonymous
Not applicable

Fantastic, thank you for the code!

I may end up going with iAssembly anyways, if you think that way is better. I've done that before, I just thought that LoD would be an easier way to control part suppression. Turns out it doesn't update any iProperties, which can easily be done with iAssembly.

I will keep that in mind about code questions going in the Customization forum.

Thank you again!

0 Likes
Message 5 of 5

jtylerbc
Mentor
Mentor

@Anonymous wrote:

I've done that before, I just thought that LoD would be an easier way to control part suppression.


 

Technically that's correct - LOD's are basically the only way to control part suppression.  The question is whether or not part suppression is really what you want in the first place.  In Inventor, Suppression is not really intended as an assembly configuration tool.  Its primary purpose is memory management in large assemblies, allowing you to unload components not needed for your current task, in order to free up memory.

 

I'm with @philip1009 in thinking that you would be better off using iAssemblies for this purpose.  I would suspect that if you get the actual code working, you'll run into other undesirable behavior from using the LOD's this way.  For example, if you have the part in two assemblies, using two different LOD's, I believe that both assemblies will show whatever the latest-solved Part Number is, rather than each showing the respective part number from the LOD.  I don't think the same file can have multiple Part Numbers at the same time, even with code.  This holds true even for iAssemblies and iParts - each different part number exists as a different child assembly / part.