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: 

solıd line properties on drawing

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Kgokhankaya
625 Views, 5 Replies

solıd line properties on drawing

Hi

İ use inventor 2011

i designed my assembly and assign color  each one Part and Subassembly

i want to that   parts' lines  and subassembly's lines  of  my assembly  is color as model properties   when   i generate   creat view and poject view in Drawing

also while create view, are there  selection "as model" for lines of part

 

exam :

in assembly

1-Assembly

  1-1 part (color is red)

 

in dravwing

1-Assembly

  1-1 parts' line color is red

5 REPLIES 5
Message 2 of 6
bobvdd
in reply to: Kgokhankaya

I don't know a way of doing this automatically In Inventor.

 

You might want to think of manually using layers to assign certain colors to certain parts.

A good idea might be to post your question on  the Inventor API newsgroup.They might be able to help you much better, better than I can.

 

I am not a good coder but I was able to throw a macro togerther in a couple of minutes that sets the part color in the drawing  to either green,blue or red  when either of these 3 colors is used in the part document.
The only condition is that you need to define in your drawing template 3 layers with name "Layer red", "Layer green" and "Layer blue".

 

'==========================================

Sub change_color()
Dim odoc As DrawingDocument
Set odoc = ThisApplication.ActiveDocument
Dim opartdoc As ComponentDefinition
Dim opdoc As PartDocument
Dim osheet As Sheet
Dim oview As DrawingView
Dim oedge As DrawingCurve
Dim olayer As Layer
Dim redlayer, bluelayer, greenlayer As Layer

For Each olayer In odoc.StylesManager.Layers
If olayer.Name = "Layer red" Then Set redlayer = olayer
If olayer.Name = "Layer blue" Then Set bluelayer = olayer
If olayer.Name = "Layer green" Then Set greenlayer = olayer
Next olayer

For Each osheet In odoc.Sheets
For Each oview In osheet.DrawingViews
For Each oedge In oview.DrawingCurves
Set opartdoc = oedge.ModelGeometry.Parent.Parent.Definition
Set opdoc = opartdoc.Document
Select Case opdoc.ActiveRenderStyle.Name
     Case "Red"
        oedge.Color = redlayer.Color
     Case "Blue"
        oedge.Color = bluelayer.Color
     Case "Green"
        oedge.Color = greenlayer.Color
End Select
Next oedge
Next oview
Next osheet
End Sub

'==================================

 

Bob




Bob Van der Donck


Principal UX designer DMG group
Message 3 of 6

Dim redlayer, bluelayer, greenlayer As Layer

 

This dimensions "greenlayer" as type Layer, but "redlayer" and "bluelayer" are Variants.  Obviously, this still works due to VB's late-binding ability, but it's poor programming practice and is a common mistake.  Instead, use

 

Dim redlayer As Layer, bluelayer As Layer, greenlayer As Layer



брайян ивашкевич
inventor specialist
ʞɔɐq dʇuu ʎɯ ʇuɐʍ ı
Message 4 of 6

Thanks for your correction.

Bob




Bob Van der Donck


Principal UX designer DMG group
Message 5 of 6
Kgokhankaya
in reply to: Kgokhankaya

thank you very mush

Message 6 of 6
jakub_d
in reply to: Kgokhankaya

Do You think it's possible to write macro that sets line colors of part from material style ?

 

One of my clients need something like this - to set line color in part files and after this create drawing and every part will then have other line colors (according to material style)

 

Jakub

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

Post to forums  

Autodesk Design & Make Report