
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have adapted code I found for changing the layer of sketch geometry, within a sketch created in a drawing view. But I can't manage to adapt it to loop through all sheets. Below is the code that works for the active sheet only.
How do I get this code to loop through all sheets winthin the .idw?
Thanks for your help
M
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
' Set a reference to the active sheet.
Dim oActiveSheet As Sheet
oActiveSheet = oDrawDoc.ActiveSheet
' Create a Drawing View Object
Dim oDrawingView As DrawingView
Dim oDrawingSketch As DrawingSketch
Dim oSketchEntity As SketchEntity
Dim oLayer As Layer
oLayer = oDrawDoc.StylesManager.Layers.Item("test")
For Each oDrawingView In oActiveSheet.DrawingViews
For Each oDrawingSketch In oDrawingView.Sketches
If oDrawingSketch.Name = "Workpiece Size" Then
oDrawingSketch.Edit
For Each oSketchEntity In oDrawingSketch.SketchEntities
oSketchEntity.Layer = oLayer
Next
oDrawingSketch.ExitEdit
End If
Next
Next
iLogicVb.UpdateWhenDone = True
Solved! Go to Solution.