Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using iLogic to set component visiblitity based on Postional REpresentation

5 REPLIES 5
Reply
Message 1 of 6
NickRuberg
524 Views, 5 Replies

Using iLogic to set component visiblitity based on Postional REpresentation

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

 

5 REPLIES 5
Message 2 of 6
pcrawley
in reply to: NickRuberg

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

Peter
Message 3 of 6
pcrawley
in reply to: pcrawley

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.

Peter
Message 4 of 6
NickRuberg
in reply to: pcrawley

Hi,



I know that line and it is very useful, however my question is: how do I
read the pos rep in order to apply that line. What I want is the correct
iLogic syntax of:



If positional representation = raised, then

Component.isactive(... = false



If positional representation = lowered, then

..



So what is the correct way to query whether the pos rep is in position A (in
my case I call it raised) or position B or maybe position C



Thanks,

Nick
Message 5 of 6

 

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

Message 6 of 6

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

Post to forums  

Autodesk Design & Make Report