Change the thickness of lines in a view in a dwg drawing.

Change the thickness of lines in a view in a dwg drawing.

kv5053545
Advocate Advocate
329 Views
5 Replies
Message 1 of 6

Change the thickness of lines in a view in a dwg drawing.

kv5053545
Advocate
Advocate

I am working on a DWG drawing, I have been trying to make the lines of the views thinner, I have this code, but it takes too long, I do not know if you can guide me to optimize my code or if there is a way to define it from the template so that the views have thinner lines, I would appreciate your help.

 

	Dim drawingDoc As DrawingDocument = ThisApplication.ActiveDocument

Dim lineThickness As Double = 0.01
For Each sheet As Sheet In drawingDoc.Sheets
    For Each view As DrawingView In Sheet.DrawingViews
        For Each line As DrawingCurve In View.DrawingCurves
            Line.LineWeight = lineThickness
        Next
    Next
Next

 

This is how the view looks like when placed in the drawing.

anavazquez5LRNJ_0-1709570114646.png

 

0 Likes
330 Views
5 Replies
Replies (5)
Message 2 of 6

daltonNYAW9
Advocate
Advocate

You could just change the thickness in the styles editor.
Manage>Styles Editor>Layers>Line Weight

By default the lines in the views (for me) are "Visible (ANSI)" and "Visible Narrow (ANSI)". I don't think inventor is optimized to change the lines the way you are doing it. Either use the styles (recommended) or the properties option when you right click a line.

0 Likes
Message 3 of 6

kv5053545
Advocate
Advocate

Is it possible to enter from code to that part of the style editor?

0 Likes
Message 4 of 6

daltonNYAW9
Advocate
Advocate
Dim drawingDoc As DrawingDocument = ThisApplication.ActiveDocument

drawingDoc.StylesManager.Layers.Item("Visible (ANSI)").LineWeight = 0.01

drawingDoc.StylesManager.Layers.Item("Visible Narrow (ANSI)").LineWeight = 0.01
Message 5 of 6

kv5053545
Advocate
Advocate
Thank you very much it worked perfect.
0 Likes
Message 6 of 6

kv5053545
Advocate
Advocate

hi @daltonNYAW9 ,

Do you know if also by means of code can be changed the type of line, that if it is Dashed is Continuous?

0 Likes