change layer of section line sketch in idw with ilogic

change layer of section line sketch in idw with ilogic

Rich-T
Advocate Advocate
260 Views
6 Replies
Message 1 of 7

change layer of section line sketch in idw with ilogic

Rich-T
Advocate
Advocate

Hi,

I have some old drawings I want to update and I need to change the layer that the section cut lines are on.

eg. from "Section View Lines(Default)" to "Section View Lines(New)".

 

The drawings may have multiple sections views on many sheets.

 

I'd be grateful if you have some code to share that can assist in automating this tedious task.

I also need to do a similar layer change for centrelines, centre marks and flat pattern bend lines - but 1st things first.

0 Likes
Accepted solutions (1)
261 Views
6 Replies
Replies (6)
Message 2 of 7

mateusz_baczewski
Advocate
Advocate
Accepted solution

Hi,

This should be enough to replace the currently used style with the new one you created. The best approach would be to set your style as global.

Sub main
	
	Dim oDoc As DrawingDocument = ThisDoc.Document
	Dim oStylesManager As DrawingStylesManager = oDoc.StylesManager
	Dim oStyles As Styles = oStylesManager.Styles
	Dim oTO As TransientObjects = ThisApplication.TransientObjects
	
	Dim oObjColl As ObjectCollection = oTO.CreateObjectCollection
	
	Dim styleToReplace As Style = oStyles.Item("Section View Lines(Default)")
	oObjColl.Add(styleToReplace)
	
	Dim replacingStyle As Style = oStyles.Item("Section View Lines(New)")
	oStylesManager.ReplaceStyles(oObjColl,replacingStyle)

End Sub
If you found it helpful, a "Like" would be much appreciated!
If this post solved your problem, please mark it as "Solution.".

Message 3 of 7

Rich-T
Advocate
Advocate

Thanks, it works nicely.

Now I need to find all the existing 'section view lines' on the drawing and put them on the correct layer for the new style.

0 Likes
Message 4 of 7

mateusz_baczewski
Advocate
Advocate

In my opinion, if you previously had a style that defined how the section view lines should look, and now you've changed it to a new style, then all lines that used the old style should now use the new style you replaced it with. Unless you mean something else, and I misunderstood you.

If you found it helpful, a "Like" would be much appreciated!
If this post solved your problem, please mark it as "Solution.".

0 Likes
Message 5 of 7

Rich-T
Advocate
Advocate

Yeah.

I've updated the active standard and style, but it doesn't push any existing section view cut lines to the layer defined in the style.

I currently do this manually using the layer selection pull down in the "annotate" ribbon.

RichT_0-1739403335904.png

I'd like a rule to find all section view cut lines in the drawing and change their layer to a different one. 

 

Thanks

0 Likes
Message 6 of 7

mateusz_baczewski
Advocate
Advocate

If you select your cut line, the layer and style still empty?

If you found it helpful, a "Like" would be much appreciated!
If this post solved your problem, please mark it as "Solution.".

0 Likes
Message 7 of 7

Rich-T
Advocate
Advocate

lol no, I just didn't have anything selected when I grabbed the screenshot.

0 Likes