loss of model attributes in the drawing

loss of model attributes in the drawing

anton.gorschnev
Enthusiast Enthusiast
576 Views
3 Replies
Message 1 of 4

loss of model attributes in the drawing

anton.gorschnev
Enthusiast
Enthusiast

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.

Безымянный.png

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

0 Likes
577 Views
3 Replies
Replies (3)
Message 2 of 4

mdavis22569
Mentor
Mentor

Can you share an example file? 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------
Mike Davis

EESignature

0 Likes
Message 3 of 4

anton.gorschnev
Enthusiast
Enthusiast

https://yadi.sk/d/ASTEx6x0Qm9Khw 

 

This problem occurs when the hole for fasteners falls on the chamfer. I solved the first problem by changing the depth of the cut. But the problem reappeared in the next step (code below).

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(1)
Dim oPartDoc As PartDocument
Set oPartDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
Debug.Print (oPartDoc.AttributeManager.FindObjects("Flange", "Uplotnitel", "EndB").Count)
Debug.Print (oView.DrawingCurves(oPartDoc.AttributeManager.FindObjects("Flange", "Uplotnitel", "EndB").Item(1)).Count)


Dim oDCurve1 As DrawingCurve
Dim oRed As Color
Set oRed = ThisApplication.TransientObjects.CreateColor(255, 0, 255)
For i = 1 To oView.DrawingCurves(oPartDoc.AttributeManager.FindObjects("Flange", "Uplotnitel", "EndB").Item(1)).Count
Set oDCurve1 = oView.DrawingCurves(oPartDoc.AttributeManager.FindObjects("Flange", "Uplotnitel", "EndB").Item(1)).Item(i)
 oDCurve1.Color = oRed
Next

End Sub

 

0 Likes
Message 4 of 4

anton.gorschnev
Enthusiast
Enthusiast

A problem of this nature occurs on all my parts when changing the geometry so that the existing groove, the hole partially begins to fall on another surface. Here is another example. If the bracket hole hits the bending surface, the curves in the drawing are not located through the attributes. Link to the document below.скоба.pnghttps://disk.yandex.ru/d/wKQVMHitCLBQDw 

0 Likes