Hi guys,
Can anyone suggest what code I would use in an assembly if I want to enable and make visible certain parts depending on the positional rep I am using.
Basically I am having trouble reading the pos rep into an iLogic code
Thanks,
Nick
I would probably abandon the pos-reps in their traditional Inventor form, and look at doing everything you want with your iLogic. e.g If your pos-rep overrides an assembly constraint to move something, then your equivalent iLogic code would just set a new value for that constraint. You can build from that simple example into amazingly complex assembly configurations using logic commands that make decisions about components based on your input. (Yes - I'm a huge iLogic fan!)
Check our Curtis-the-iLogic-god's website for all the gold he shares with us mortals:
http://inventortrenches.blogspot.co.nz/
The visibility code is:
Component.Visible("PartA:1")
Which gets (or sets) the visibility of the part.
Peter
I should add this useful line:
Component.IsActive("Part1:1")
When you use this: Component.IsActive("Part1:1") = False
Not only makes "Part1:1" not visible, but it suppresses it also.
The suppression is different from LOD suppression because you'll find the component is removed from the BOM too - which makes assembly configurations through iLogic all the more useful/powerful.
Hi NickRuberg,
Here's a quick example:
'set a reference to the assembly component definition. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'record the active posistional representation name Dim sActivePosRep as String sActivePosRep = oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name 'Check the representation 'and set visibility If sActivePosRep = "Master" Then Component.Visible("Part:1") = True Component.Visible("Part:2") = True ElseIf sActivePosRep = "Raised" Then Component.Visible("Part:1") = False Component.Visible("Part:2") = True ElseIf sActivePosRep = "Lowered" Component.Visible("Part:1") = True Component.Visible("Part:2") = False End If 'zoom all ThisApplication.ActiveView.Fit
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi pcrawley,
Thanks for the kind words.
Curtis