Create a sketch in the view, how to set the lines in the sketch to a custom layer

Create a sketch in the view, how to set the lines in the sketch to a custom layer

ss13953642009
Advocate Advocate
202 Views
1 Reply
Message 1 of 2

Create a sketch in the view, how to set the lines in the sketch to a custom layer

ss13953642009
Advocate
Advocate

am8_20241230094551195.png

For SketchLine type sketch lines, after setting the layer name of the line (SketchLine.Layer.Name == 'Center Line'), it is displayed in the sketch as: By Standard (Center Line). How can I use my custom 'Center Line' layer instead of 'By Standard (Center Line)' when setting the layer?

0 Likes
Accepted solutions (1)
203 Views
1 Reply
Reply (1)
Message 2 of 2

daltonNYAW9
Advocate
Advocate
Accepted solution

You can change the default layer in a drawing's styles editor:

daltonNYAW9_0-1735592828575.png

 

Heres how you could change the layers in a sketch programmatically

Dim oDDoc As DrawingDocument = ThisDoc.Document

Dim oLayer As Layer = oDDoc.StylesManager.Layers.Item("Centerline copy")

Dim oSketch As DrawingSketch = oDDoc.ActiveSheet.Sketches(1)

oSketch.Edit

For Each oSketchEntity As SketchEntity In oSketch.SketchEntities
	oSketchEntity.Layer = oLayer
Next

oSketch.ExitEdit