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
MrAcam04
9180 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 41 of 78
guyh
in reply to: MjDeck

Shaded views create a bitmap on the profile and unfortunately the quality is just not there for real publishing.... That is the opinion of colleagues. This is not something I go in to too much depth with but currently in my position I am trying to get our company to move to Inventor for it's main development software. 

 

The big advantage I am pushing is that one file (iam) controls everything and that includes the technical documentation which can be quickly produced from the work done in development.  This is appreciated by top level managers from the presentations I have made showing the power of Inventor and possible workflows.  There is however a requirement that certain documents produced obey the corporate standard.  With section views of our composite aluminium extrusions this is they are shown in solid black.  I have provided the workflow of section>associate sketch>project geometry(select as edges)>fill.  This works well but I feel can be improved.  There is also the issue that Inventor 2011 really struggles when you associate the sketch to a section view which also has been broken.  If you change the break position then the association with the view is often lost (not always but it is temperamental).

 

Sorry for the long post Mike but I wanted you to know my motivation for this.  It is more than just making this task as simple and automated as possible but more about proving Inventor is the tool we should be using for all our design development and documentation needs. 

 

Thanks for the help, it is really appreciated.

 

Guy

AutoCADM 2011 SP2
Inventor Pro 2011 SP2
Message 42 of 78
MjDeck
in reply to: guyh

You could override the color of the aluminum parts in the assembly and make them show up as black in a shaded view in the drawing.  (Unfortunately, they would also show up as black in the assembly.)  But you only want to fill in the aluminum profiles, right?  Other materials in the drawing should be drawn only with wireframe?  In that case you couldn't use shaded views even if the rendering style matched your standard, because everything (not just the aluminum) would be shaded.

 It might be possible to automate the process of applying a fill to the profiles.  But you might still have the problems you're seeing when the geometry or view break changes.

 


Mike Deck
Software Developer
Autodesk, Inc.

Message 43 of 78
guyh
in reply to: MjDeck

Hi Mike,

 

Using the shanded view is not an option for the reason you mention but also the quality of the fill is not good in PDf form or print.

 

The best method is as you suggest using the Fill command and if possible to automate this even with this limitations of break and section it would still provide a more robust solution for our users then the totally manual method.  I know I have no right to ask this but would you be able to provide some code to enable me to test this?  It would be a really big help.

 

Thanks,

Guy

 

AutoCADM 2011 SP2
Inventor Pro 2011 SP2
Message 44 of 78
Curtis_Waguespack
in reply to: guyh


@Anonymous wrote:

Using the shanded view is not an option for the reason you mention but also the quality of the fill is not good in PDf form or print.


 



Hi guyh,

Have you ensured that your templates are set up to use the Offline Only bitmap mode for shading? You can check this by going to the Tools tab > Document Settings > Drawing tab and looking at the Use Bitmap option. You can set the Bitmap Resolution higher there also.

 

This might not help your situation due to the nature of your drawings, but it is something to look at.

 

I hope this helps.

Best of luck to you in all of your Inventor pursuits,

Curtis

http://inventortrenches.blogspot.com/

 

 

 

Message 45 of 78
guyh
in reply to: Curtis_Waguespack

Hi Curtis,

 

That is not something I've really looked at to be honest.  I will investigate further but as you say I don't think it solves my 'problem'.  It will certainly be helpful though when I discuss documentation in the future with colleagues.

 

Cheers,

Guy

AutoCADM 2011 SP2
Inventor Pro 2011 SP2
Message 46 of 78
MrAcam04
in reply to: MrAcam04

MjDeck,

 

I had an opportunity to revisit the code you wrote for us. I am still getting an error message when I insert a section view into my inventor dwg. I have attached the error message for your viewing, please give me your thoughts. Thank you

Message 47 of 78
MjDeck
in reply to: MrAcam04

If you can zip up your model (drawing, assembly and parts) usign Pack & Go and post it here, I can look at it.


Mike Deck
Software Developer
Autodesk, Inc.

Message 48 of 78
MjDeck
in reply to: MrAcam04

Here is a new version of the rule.  This will run with no error in your drawing.


Mike Deck
Software Developer
Autodesk, Inc.

Message 49 of 78
MrAcam04
in reply to: MjDeck

So far so good, I will keep you posted on the results. Thank you

Message 50 of 78
floweris
in reply to: MjDeck

Hy there, that code works great!

Could you be kind to help me with one more request. Is it posible to make same thing with the hatching too? i need line colors by materials (that code DrawingLayersByMaterials.txt do job perfectly) and hatch collor by the same part material outline color (hatching collor is changed manualy in attached picture). It would be great that each section view would have hatch by material in new layer like MaterialName-Hatch.

Message 51 of 78
MrAcam04
in reply to: guyh

I control my hatchs thru Style & Standard Editor => Material Hatch Pattern Defaults

 

From there I can link the hatch patterns to the proper layers I have setup.

 

This is based on Autodesk Inventor 2012

 

Hope this helped

Message 52 of 78
floweris
in reply to: MrAcam04

well yeah, i do the same thing, with hatching, but you canot change pattern color for each material (i mean to do different hatch color - its only posible to assign hatch type to material)...  I need simple thing that, lets say glass part in the drawing would be colored in blue lines and blue hatch (in section view), steel parts - black lines and black hatch, plastic - green lines with green hatch. Sadly now all the hatches is in one layer with one color

Message 53 of 78
MjDeck
in reply to: floweris

It looks like there is no API support for changing the color of hatch patterns in Inventor 2012.


Mike Deck
Software Developer
Autodesk, Inc.

Message 54 of 78
A.Eiffel
in reply to: MrAcam04

Looks like another feature for the wish list *sigh*
Message 55 of 78
DVDM
in reply to: MjDeck


@MjDeck wrote:

Here's a new version of the rule to change the layers.  This will look for the layers:

 

Solid lines in a plan or projected view:       MaterialName

Hidden lines in a plan or projected view:    MaterialName-Hidden

Solid lines in any other view:                      MaterialName-VIew

Hidden lines in any other view:                  MaterialName-View-Hidden

 

It will create the hidden layers automatically if they are not found.  If there are any other missing layers it will show a message.

 

 It gives you some flexibility to assign layers manually after the program runs.  I don't know if you need this.  I can take it out if you want.  How it works:  If you change the layer of some lines to a new layer that starts with the material name, the program won't change them back the next tiem it runs.  For instance, if a line was on 00-Stone-Green, you could create a new layer named 00-Stone-Green-Extra and manually change the line to go on that layer.

 


I just found this iLogic rule, and I think this can come in really handy. I wouldn't mind a little bit more automation though. It think it would be nice to have the ..-View and ..-View-Hidden lines be created automatically, just like the ..-Hidden layer. That way you only have to make sure a layer matching the material name is available in the document/style library, the rest will take care of itself.

I wouldn't mind (a separate rule with) the option to have all material layers create itself. I could go through the layer list and assign any color's/thickness to those layers that didn't already exist in the template/style library.

 

I also think it would be nice to have a rule that can reset the layers back to Inventor's default setting, should someone go a bit overboard with this.

 

Message 56 of 78
stephengibson76
in reply to: MjDeck

very handy

 

thanks

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 57 of 78

It's possible to dont change the line color in all iso view???

Message 58 of 78

dont work in assembly section, all the line becoming blue???

Message 59 of 78
dsowle
in reply to: MrAcam04

Could this code be changed to Assign Layers to Appearances? I'm using Material for Materials in BOMs

I was thinking of changing this bit...

 

materialName=ThisDoc.Document.ComponentDefinition.Material.Name

 

to...

 

materialName=ThisDoc.Document.ComponentDefinition.Color.Name

 

or...

 

materialName=ThisDoc.Document.ComponentDefinition.Partcolor.Name

 

That did not work. So is there a simple solution? I'm new to Ilogics.

Message 60 of 78
ChristinaForest
in reply to: DVDM

Hi DVDM!

 

I'm not really good in ilogic, where a put the "MaterialName-View" in the rule to change all solid lines?

 

Thanks for your help!

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

Post to forums  

Autodesk Design & Make Report