Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Assign Layers to Materials

77 REPLIES 77
SOLVED
Reply
Message 1 of 78
Anonymous
10013 Views, 77 Replies

Assign Layers to Materials

Is there a way to associate layers to materials so when they are placed in a drawing they are automatically placed on the proper layer. I have line weights set for each individual layer and would like each material component to have its own line weight.

77 REPLIES 77
Message 61 of 78
Anonymous
in reply to: Anonymous

hello MjDeck,

 

To start I wish you a happy New Year.

 

I try your solution and it's work good on Inventor 2013. My computer work hard because we have very big layout assembly.

 

Have you got the same solution to use the appearance to assign to layers ?

Because all of my equipments are in stainless steel and I work for Layout and assign an appearance by zone.

 

Example : an assembly for Existing equipments with a specific color, an other assembly and color for customer suppler, ...

 

Thank you very much for you reply.

 

Best Regards

François.

 

Message 62 of 78
Anonymous
in reply to: MjDeck

This is a great bit of iLogic, very useful. Just wondering if its possible to assign a layer to a custom iProperty, rather than the material? I started a new thread here: http://forums.autodesk.com/t5/Inventor-Customization/Assign-Layers-based-on-Custom-iProperty/m-p/506...

Message 63 of 78
kadscad
in reply to: MjDeck

I'm new to Inventor so I'm guessing I would need 2 layers for each material used. One for solid line and one for the hidden line.

Kirk
Inventor 2023
Message 64 of 78
kadscad
in reply to: Anonymous

 


@Anonymous wrote:

You only want to use 00-Stone-Magenta (and maybe 00-Stone-Magenta-Hidden) in the section views, right?

 

Correct

 

I might have to include a table in the rule, where you can list the names of layers  to be used in the projected and section views.

 

Projected views would be 00-Stone-Cyan & 00-Stone-Cyan-Hidden

Section, Auxiliary & Detail views would be 00-Stone-Magenta & 00-Stone-Magenta-Hidden

 

 

Correct for each material used in a drawing

 



 

Kirk
Inventor 2023
Message 65 of 78
TKRdam
in reply to: MjDeck

hello MjDeck,

It does not seems to wrok for me, or am I missing a step?

 

I get the box with this text but no new layers? (see attachement)

I have an assembly with 1 part that contains the material "rubber"

 

what am I doing wrong?

 

I create new rule

and paste the code from message 48 (latest version)

then i go to ilogic browser and run rule

then  I get a pop up screen that says

"the following layers where not found"

and mentions the layers it is suppose to make. i.e. "Rubber"

 

 

 

Message 66 of 78
MjDeck
in reply to: TKRdam

@TKRdam , the rule won't automatically create the layer for a material. You have to create that layer before running the rule. The idea is that you might want these layers to look different, probably with a different color. The rule doesn't know what color (or line type or weight) to choose.

It might be possible to change it to create layers (if not found) by copying the default Visible layer. Then it would be up to you to change the layer appearance after running the rule.


Mike Deck
Software Developer
Autodesk, Inc.

Message 67 of 78
TKRdam
in reply to: MjDeck

Thank you so much, I tried it out some time ago  did not remembre I had to make the meterial layers myself

 

it does generate "materialname-hidden" layers.

it does not generate "materialname-view" layers

the view-layers are not useful for us. as I cannot write code is it easy to delete from the code?

that all layers from all views go to either:

 

materialname

materialname-hidden

 

and i only have to make the layer(s) "materialname" myself

 

view missing.png

 

Tags (3)
Message 68 of 78
MjDeck
in reply to: TKRdam

@TKRdam , here's a new version of the rule. It includes some documentation and a new option. Change the line:

Const AllViewsTheSame As Boolean = False

to:

Const AllViewsTheSame As Boolean = True

This is near the top of the rule. If you make that change, then layers like "MaterialName-View" will not be required.


Mike Deck
Software Developer
Autodesk, Inc.

Message 69 of 78
TKRdam
in reply to: MjDeck

Hello MjDeck,

 

Thank you so much, this is much better.

the little adjustment for the view layers worked perfect

thank you for that!

 

as we have many many different materials and also new materials in our projects.

the workflow would be so much more workable if the rule makes a new layer from the existing materials

we dont need to change colours per material.

 

I dont know how to do it

maybe there is an easy hack you can give me just as you did with the true/false?

 or tel me which part of the code to replace by a new code block you can provide?

I can olny ask and hope you are willing to do it.

 

thank you for the good work!

 

Tom Kroos

 

 

Message 70 of 78
MjDeck
in reply to: TKRdam

@TKRdam , yes I can do it. The tricky part is finding which layer to copy. I'll try to get a new version posted soon.


Mike Deck
Software Developer
Autodesk, Inc.

Message 71 of 78
TKRdam
in reply to: MjDeck

   Our standard layer is "visible iso" Is it possible or not d'Or the rule to get the layer out of the drawing Standard  by object defaults?

 

A workable solution would be that we enter the standard layer once in the rule and that the rule then works for that particular drawing.

Message 72 of 78
MjDeck
in reply to: TKRdam

Here's a version of the rule with a new option you can set to make it not require existing layers. As before, change this option to True:

Public Const AllViewsTheSame As Boolean = True

And now change this option to False:

Public Const RequireExistingLayers As Boolean = False

By default, it will create any required new layers by copying the Visible and Hidden layers of the drawing standard. Or you can edit the values of VisibleLineSourceLayerName and HiddenLineSourceLayerName if you want to use other layers instead.

 

The rule has a limitation that I hadn't noticed before: it doesn't do anything with the Visible Narrow and Hidden Narrow layers. Those are used for tangent edges.


Mike Deck
Software Developer
Autodesk, Inc.

Message 73 of 78
TKRdam
in reply to: MjDeck

Thank you for this reply,

 

however i am getting errors, see attachment (sorry it is in dutch)

line 201
line 211
line 334
line 340

"Thisrule is not declaired"

 

Tom

 

 

 

 

Message 74 of 78
MjDeck
in reply to: TKRdam

Tom,

 Sorry about that. Are you running Inventor 2018 or earlier? Here's a new version of the rule that should work on all versions.


Mike Deck
Software Developer
Autodesk, Inc.

Message 75 of 78
Anonymous
in reply to: MjDeck

will this work on 2020?

Message 76 of 78
MjDeck
in reply to: Anonymous

Yes, it will work on 2020 as well.


Mike Deck
Software Developer
Autodesk, Inc.

Message 77 of 78
Anonymous
in reply to: Anonymous

is it possible to move subassemblies or parts on a layer and give the layer the name of what you move?

Message 78 of 78
ppccad8
in reply to: MjDeck

Late reply, but where in the string on text do I name the materials and the layers I want then to be?

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report