iLogic rule to change active level of detail

iLogic rule to change active level of detail

T3H
Enthusiast Enthusiast
4,923 Views
11 Replies
Message 1 of 12

iLogic rule to change active level of detail

T3H
Enthusiast
Enthusiast

I want to run a rule and have it change the assembly to a specified LOD.

I've seen other posts with code that changes LOD's but it's in a different format that's beyond my skill level. It looks more complicated than what I need, it must be for API?

I'm just using the basic iLogic rule editor and just want one line of code that says "change LOD to X"

Is that possible?

0 Likes
Accepted solutions (1)
4,924 Views
11 Replies
Replies (11)
Message 2 of 12

philip1009
Advisor
Advisor
Accepted solution

Unfortunately there isn't an easy iLogic snippet for changing the LOD of an assembly yet, you have to go through the API.  How exactly do you want to change the LOD, through a drop-down list on a form, as a reaction to other conditions or rules?

0 Likes
Message 3 of 12

T3H
Enthusiast
Enthusiast

I want to set a trigger to run the rule on document startup to make sure it doesn't open in master and give errors. I always want to be in the same LOD.

However, I ran into another issue with LOD's. Every assembly level above this assembly now also needs a custom LOD, which just introduces unnecessary complexity. I think my best bet is to figure out a way to do this without LOD's - maybe delete/add components instead of suppress.

0 Likes
Message 4 of 12

T3H
Enthusiast
Enthusiast

I'm tired, I give up. I'm accepting Philip's solution of it cannot be done.

Here's what I ended up with:

https://grabcad.com/library/nema-enclosure-type4-12-1

If anybody with a GrabCAD account wants to download that and see if the iLogic still works, I would appreciate it. I'm curious to see what will happen with content center, sheet metal styles, etc.

Thanks.

0 Likes
Message 5 of 12

chandra.shekar.g
Autodesk Support
Autodesk Support

@T3H,

 

Unfortunately, iLogic code does not support a function (in single line) to change LOD currently. Please log this wish list at idea station using below link.

 

https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 6 of 12

philip1009
Advisor
Advisor

It's completely dependent on what you're looking for in LOD's, the main point of an LOD is to remove complexity of an assembly so it's easier and faster to work with your PC, ideally you have no more than like 5-10 LOD's built all the way up to the top.  If you're looking for some kind of configurator, then the best options would be either iAssembly or custom iLogic code, depending on how complex you want it to be.

0 Likes
Message 7 of 12

T3H
Enthusiast
Enthusiast

Understood. I just don't like that LOD's are forced down on you. You should be able to choose whether you want to use them or not. I don't understand the purpose of requiring every assembly ever created in Inventor to have a master LOD. In Solidworks you can suppress a component and save the assembly, that's it. You can create a "configuration" as they call it, if you choose, but you don't have to. Maybe I'll submit an idea for the ability to bypass LOD's.

I tried using an iAssembly for this but that wasn't very clean either. I have 14 configurable components and each generates it's own folder with instances. After cycling through the configurations I end up with 14 folders and over a 100 files. Seems a bit excessive just for a box.

Custom iLogic code probably would work, now I just have to figure out how to do that!

0 Likes
Message 8 of 12

philip1009
Advisor
Advisor

I definitely recommend learning iLogic as it is certainly a very powerful tool, here's a series on Youtube to help you get started:  https://www.youtube.com/playlist?list=PLetTiL10gBjH1duj0BKQObSejXfTD16Vh

 

iLogic is based on a code language called Visual Basic, it's not exactly the same as used in other programs, but here's a playlist to help teach you that language: https://www.youtube.com/playlist?list=PLC601DEA22187BBF1

Message 9 of 12

T3H
Enthusiast
Enthusiast

I'll be sure to check those out. Thanks for the help!

0 Likes
Message 10 of 12

llorden4
Collaborator
Collaborator

I was looking for a similar solution myself and managed to sort it out.  I was in need of switching to the Master VIEW and LOD to do a part search that included suppressed features before returning back to a known LOD or create one if missing.  This is about as basic as it comes, maybe it'll help you or the next person.

 

Dim oDoc As Document = ThisDoc.Document
Dim oAsmCompDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Master").activate
oDoc.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Master").activate

'do stuff here
Try oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("View1").activate Catch oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("View1") End Try Try oDoc.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("LevelofDetail1").activate Catch oDoc.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations.Add("LevelofDetail1") End Try

 

Autodesk Inventor Certified Professional
Message 11 of 12

RNDinov8r
Collaborator
Collaborator

I found this link...super easy to cut and paste the code. worked right out of the box...may be useful to some.

 

 

Message 12 of 12

Zackery.Breeland
Contributor
Contributor

@RNDinov8r 

I know this is super late to the thread but this was the exact thing I needed and not sure why your answer isn't marked as solution nor has more likes. Thank you.