Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I'm trying to hide dimensions on my drawing. I found a rule that worked the first go around but now it's throwing an error. I'm suppressing a feature and then turning the feature back on for certain conditions.
Is there a better alternative to turning dimensions off or is the code getting confused as i am?
If Parameter("STRAIGHT CONVEYOR.iam.Legs") = "No" Then oHideOption = True oDoc = ThisDoc.Document Try 'try to create the layer oOrphanLayer = oDoc.StylesManager.Layers.Item(1).Copy("Orphan Dims") Catch 'assume error means layer already exists and 'assign layer to variable oOrphanLayer = oDoc.StylesManager.Layers.Item("Orphan Dims") oLayer = oDoc.StylesManager.Layers.Item("Dimension(ISO)") End Try If oHideOption = True Then 'Loop through all dimensions Dim oDrawingDim As DrawingDimension For Each oDrawingDim In oDoc.ActiveSheet.DrawingDimensions 'look at only unattached dims If oDrawingDim.Attached = False Then ' set the layer to the dummy layer oDrawingDim.Layer = oOrphanLayer Else oDrawingDim.Layer = oLayer End If Next 'hide the layer oOrphanLayer.Visible = False Else 'show the layer oOrphanLayer.Visible = True End If oDoc.Update End If
Solved! Go to Solution.