In the last week I've learned way too much about the behavior of planar sketchlines.
I thought I would explain my reasoning for anyone coming behind me.
I have noticed that the default on a standard planar sketchline for the lineweight is 0. This is when the value for lineweight is set to default on a brand new line.
I drew a single line in a sketch in a part with the line weight set to "Default"

After I drew one line on a sketch in a part I ran this code to find the below information in VBA.
Public Sub GetSketchLine()
Dim oPartDoc As PartDocument: Set oPartDoc = ThisApplication.ActiveDocument
Dim oPartDef As PartComponentDefinition: Set oPartDef = oPartDoc.ComponentDefinition
Dim oSketch As PlanarSketch: Set oSketch = oPartDef.Sketches(1)
Dim oSketchline As SketchLine
For Each oSketchline In oSketch.SketchLines
Debug.Print "here"
Next
End Sub
VBA Locals Window

It seems as though the default linewieght should be 0.016, because when I change it to that I compare it to a line existing at default they look the same.
Line at defualt

Line at 0.016 in

So for my application what I have done is I am checking for lineweight = 0
I'm setting the lineweight to what the equivalent is in cm 0.016 in = 0.4064 cm if the lineweight is set to 0. So that it at least goes back to the normal thickness. If the lineweight is not 0 that means it either has been changed or it came in from a different source like AutoCAD and either way we would want to capture that thickness and return it back. In my situation I want to change the weight to either the same or something thicker to make it noticeable if it came from a different source. So the defaultLineWeight is what we are returning it to and the invSketchLine.LineWeight is what we are changing it to.
If invSketchLine.LineWeight = 0 Then
defaultLineWeight = 0.04064
Else
defaultLineWeight = invSketchLine.LineWeight
End If
invSketchLine.LineWeight = 0.04064 'sketchLine.LineWeight
I think some changes need to be done to the API because zero should not be the default lineweight when set to "Default". I'm going to add this to an idea posting.
Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
