loss of model attributes in the drawing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
When I try to set the size on the hole, I can't find curves by the assigned attribute in the model. The problem occurs on a section view. Tell me the solution to the problem.
Sub count1()
Dim oDrDoc As DrawingDocument
Set oDrDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDrDoc.ActiveSheet
Dim oView As DrawingView
'Выбор вида
Set oView = oSheet.DrawingViews.Item(2)
Dim oPartDoc As PartDocument
Set oPartDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
'Debug.Print (oPartDoc.AttributeManager.FindObjects("Flange", "Face", "Hole").Count)
Debug.Print (oPartDoc.AttributeManager.FindObjects("Flange", "ExtrudeFeature", "Hole").Count)
'Debug.Print (oView.DrawingCurves(oPartDoc.AttributeManager.FindObjects("Flange", "Face", "Hole").Item(1)).Count)
Debug.Print (oView.DrawingCurves(oPartDoc.AttributeManager.FindObjects("Flange", "ExtrudeFeature", "Hole").Item(1)).Count)
Dim oDCurve1 As DrawingCurve
Dim oRed As Color
Set oRed = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
For i = 1 To oView.DrawingCurves(oPartDoc.AttributeManager.FindObjects("Flange", "ExtrudeFeature", "Hole").Item(1)).Count
Set oDCurve1 = oView.DrawingCurves(oPartDoc.AttributeManager.FindObjects("Flange", "ExtrudeFeature", "Hole").Item(1)).Item(i)
oDCurve1.Color = oRed
Next
End Sub