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: 

level of detail with ilogic

10 REPLIES 10
Reply
Message 1 of 11
Retselnitram
13270 Views, 10 Replies

level of detail with ilogic

Let me know if I am not going about this the right way.

I have an assembly and using ilogic to control the wide of the machine.

The wider machine has some different brackets which I am turning on and off by using  "component . IsActive" in ilogic.

I had to make a new level of detail for it to work, and this is all fine except everytime I open this assembly it defaults back to master level of detail, so I always get this error.

 

Question

How do I control level of detail with ilogic or how am i suppose to turn parts on and off.

 

I have seen some impressive assemblies controlled with ilogic how do they do it.

 

Inventor 2012

 

10 REPLIES 10
Message 2 of 11

 

Outside of iLogic, when you open the assembly, if you click the “Options” button in the open dialog you’ll have the opportunity to pick the LOD you want to have active when it opens the assembly file.

 

Please mark as a solution if this resolves this or let us know if you need more help. Thank you.



Daren Lawrence
Product Support Specialist
MFG Support - Inventor
Autodesk, Inc.


http://beinginventive.typepad.com/being-inventive/
Message 3 of 11
ravikmb5
in reply to: Retselnitram

i Assume u have three different LOD's

Master, Cover & Base

 

and u have user parameter(Multi Value)

Lod = Master , cover & Base

 

u can this rule

 

Format:HTML Format
Version:1.0
StartHTML: 165
EndHTML: 6376
StartFragment: 314
EndFragment: 6344
StartSelection: 314
EndSelection: 314

IfLOD="Master"Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Master").Activate
iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
ElseIfLOD="Cover"Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Cover").Activate
iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
ElseIfLOD="Base"Then
ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Base").Activate
iLogicVb.UpdateWhenDone=True
ThisApplication.ActiveView.Fit
EndIf

 

 

 

This is an Example u can download and u can test it

open top level assy

in ilogic assy Browser on Forms tab click on Trigger button

 

http://www.mediafire.com/?5gtz12msdkddwhi

 

 

Please mark this response as Problem Solved if it answers your question.
----------------------------------------------------------------------------------------------
Ravi Kumar MB,
i7 860 Dell Studio XPS Win 7 64 bit 12 Gb RAM & HP Z220 SFF Workstation
Autodesk Inventor Certified professional 2016
Email: ravikmb5@gmail.com





Message 4 of 11
Retselnitram
in reply to: ravikmb5

I tried to put your code into my assembly But I get this error which I don't know how to fix.

see attached

 

Message 5 of 11
Retselnitram
in reply to: Retselnitram

Never mind. I got  it figuered out. There was one more spot I had to change your code which I missed.

 

Thanks for your help I would never have got it on my own.

Message 6 of 11
ravikmb5
in reply to: Retselnitram

Always keep reference of Inventor object module

 

Which saves lot of time for debugging

most of the code works here

 

http://usa.autodesk.com/adsk/servlet/index?id=1079044&siteID=123112

Please mark this response as Problem Solved if it answers your question.
----------------------------------------------------------------------------------------------
Ravi Kumar MB,
i7 860 Dell Studio XPS Win 7 64 bit 12 Gb RAM & HP Z220 SFF Workstation
Autodesk Inventor Certified professional 2016
Email: ravikmb5@gmail.com





Message 7 of 11
Anonymous
in reply to: Retselnitram

Hello!!

 

I have got the same problem as you do, but i can not manage how to solve it. What am I doing wrong?

 

Thanks in advance

Message 8 of 11
Anonymous
in reply to: Retselnitram

I do it a little different, not to say that it’s the correct way but it works for me. I do not like to use the level of detail that much because I’m use to using different cad software. I use iLogic to turn off the visibility of the parts I don’t want then using iLogic make all invisible parts reference so they will not show up on my parts list. this way i don't make a level of detail. Here is some small code below: 

 

'Making Ribs or Lug Visible - Non Visible
Rib = iProperties.Value("Custom", "Number Of Middle Ribs")

 

If Rib = "0" Then
Component.Visible("Middle Rib 1:1")=False
Component.Visible("Middle Rib 2:1")=False
Component.Visible("Middle Rib 3:1")=False
Component.Visible("Middle Rib 2:2")=False
Component.Visible("Middle Rib 3:2")=False
End If

 

If Rib = "1" Then
Component.Visible("Middle Rib 1:1")=True
Component.Visible("Middle Rib 2:1")=False
Component.Visible("Middle Rib 3:1")=False
Component.Visible("Middle Rib 2:2")=False
Component.Visible("Middle Rib 3:2")=False
End If

 

If Rib = "2" Then
Component.Visible("Middle Rib 1:1")=False
Component.Visible("Middle Rib 2:1")=True
Component.Visible("Middle Rib 3:1")=False
Component.Visible("Middle Rib 2:2")=True
Component.Visible("Middle Rib 3:2")=False
End If

 

' set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
'check for and skip virtual components
If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
'set BOM as default if the component is visible
If Component.Visible(oOccurrence.Name) = True Then
Component.InventorComponent(oOccurrence.Name).BOMStructure = _
BOMStructureEnum.kDefaultBOMStructure
'set BOM as reference if the component is not visible
ElseIf Component.Visible(oOccurrence.Name) = False Then
Component.InventorComponent(oOccurrence.Name).BOMStructure = _
BOMStructureEnum.kReferenceBOMStructure
End If

Else
End If
Next

 

 

I hope this helps in some kind of way.

 

Thanks

JD

Message 9 of 11
mrattray
in reply to: Anonymous

I use this (attached) as an external rule. JD's method is completely valid as well, although I think I would code it a bit differently.

Mike (not Matt) Rattray

Message 10 of 11
Anonymous
in reply to: mrattray

Thanks everyone for your fast answers!! It worked perfectly as an external rule.

 

I am new to this software, and this is the first time that I use an External Rule. I  know iLogic it's not the best way to do it (with iAssemblies for example it would have much easier), but in this case it was compulsory.

 

Greetings,

 

CARLOS

 

 

Message 11 of 11

Hello Ravi. I want to know where did you learn this code?

 

ThisApplication.ActiveDocument.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Master").Activate

It looks like object oriented programming since you are using member access.

 

Many thanks

=============================================
Autodesk® Inventor® 2019
Autodesk® Plant3D 2019

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

Post to forums  

Autodesk Design & Make Report