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: 

Assembly LoD keeps changing to Master after Drawing file is saved last.

26 REPLIES 26
Reply
Message 1 of 27
MegaJerk
2975 Views, 26 Replies

Assembly LoD keeps changing to Master after Drawing file is saved last.

(The following is in INV 2011)

 

I am having an issue with the Level of Detail representation of a drawing / assembly file that I’ve been working on.  Naturally I’ve set up a custom LoD (named Lenny for the purpose of this question), but at times my assembly goes back to Master LoD.

 

I have my Application options set up to open the last known LoD, and that works so long as I’m only opening one file at a time. The problem starts to happen I have both the Assembly and the Drawing file (that the Assembly is being represented on) open and I save the Drawing file last before closing out. Any time (after saving the drawing file last) that I open the Assembly file; it will automatically be set back to Master LoD.

 

Being that I’m still getting my chops with this program, I’m curious if this is the normal behavior of things. I assume that because it separates the drawing from the assembly documents (in Classes that is) when I save that drawing last, it sets the LoD last active name which will not work for the assembly due to the class difference. 

 

Is there a solution around this problem, or does anyone knows of a way to sort of easily set the LoD using a Vb rule?

 

1 million Thanks to you!



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
26 REPLIES 26
Message 21 of 27
mrattray
in reply to: Arrush80_

This was written as an external rule, hence the "disassociated technique" there. I called it as the first line in my configurator rule: iLogicVb.RunExternalRule("LOD sub") It probably could be simplified, I've learned a lot since I wrote that.

That second block of code is everything you need to use that technique. Simply copy/paste the Sub bomRef() block outside of your Sub Main() and use the line I gave you an example of like you would the Component.IsActive() method. You do need to manually create a custom View Rep, but you won't have trouble with it reverting to master unexpectedly and you wont have error messages blowing up everywhere. It also runs faster than Component.IsActive() because there's no file operations involved.
Mike (not Matt) Rattray

Message 22 of 27
Arrush80_
in reply to: mrattray

Don't think I'm doing this right, can you have a quick look at this simple script.

Message 23 of 27
mrattray
in reply to: Arrush80_

Cut/Paste your If/Then block over top of the "MyComponent" line.
Mike (not Matt) Rattray

Message 24 of 27
Arrush80_
in reply to: mrattray

Thank you, I got it working and it is unbelivibly fast compared to LoD.

 

I was expecting to have to set the BoM filter on to the view representation but this seems to not require it? It also looks like the name of the view representation does not matter.

 

I have a lot of code to supress/unsupress constraints which thankfully is outside of LoD, has this method given you any troubles?

 

 

 

 

Message 25 of 27
mrattray
in reply to: Arrush80_

You don't need to filter by view rep because that sub routine is setting the components to BOM structure reference. If that wasn't necessary you could've simply used Component.IsVisible(). And no, the name of the view rep doesn't matter, but make sure your views are set to that view rep and that associativity is toggles on.
Constraint suppression is different from component suppression. You shouldn't have any trouble with it.
Mike (not Matt) Rattray

Message 26 of 27
Arrush80_
in reply to: mrattray

Thank you very much for this, I will implement this in some real work scenerios and see how it goes. I wish I knew this upfront as we've made it pretty far with LoDs, but this seems like the more elegent solution by far. 

 

I'm guessing only the visability commands need to be in the Sub Main() with the constrains residing outside?

Also if I'm controlling visability from an assembly, within a subassembly do I need to repeat the code at both levels?

 

Arek

Message 27 of 27
mrattray
in reply to: Arrush80_

You're welcome.

Everything must be inside of Sub Main() with the sole exceptions of the Sub bomRef() block and any Options or Imports statements you might use.

All code is always within a Sub or Function (expect Option & Imports statements). This is a basic programming concept. In iLogic the compiler automatically assumes a Sub Main() if there isn't one specified. It's not smart enough to do it correctly when you actually need different subs, however, like is the case here.

You need to use this at the level that the component can be directly accessed, just like you would with IsActive(). Nothing needs to be repeated, but if you want to turn off only certain parts that are buried inside of a sub assembly then you need to write the code for it at that lowest sub assembly level. You can, just like with IsActive(), use this to toggle entire assemblies.
Mike (not Matt) Rattray

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

Post to forums  

Autodesk Design & Make Report