Private Sub test_dwg_6()
Dim oDoc_dwg As DrawingDocument
Set oDoc_dwg = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDoc_dwg.ActiveSheet
Dim oView As DrawingView
Set oView = oSheet.DrawingViews(1)
Dim oDoc As AssemblyDocument
Set oDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oCD As AssemblyComponentDefinition
Set oCD = oDoc.ComponentDefinition
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Dim oWP_1 As WorkPoint: Dim oWP_2 As WorkPoint: Dim oWP_3 As WorkPoint: Dim oWP_4 As WorkPoint
Dim oWorkPointProx3 As Inventor.WorkPointProxy: Dim oWorkPointProx4 As Inventor.WorkPointProxy
Set oWP_3 = oCD.Occurrences.ItemByName("Part1").Definition.WorkPoints("WPoint_3")
Set oWP_4 = oCD.Occurrences.ItemByName("Part1").Definition.WorkPoints("WPoint_4")
Set oWP_1 = oCD.WorkPoints("WPoint_1")
Set oWP_2 = oCD.WorkPoints("WPoint_2")
Set oWP_3 = oCD.Occurrences.ItemByName("Part1").Definition.WorkPoints("WPoint_3")
Set oWP_4 = oCD.Occurrences.ItemByName("Part1").Definition.WorkPoints("WPoint_4")
oCD.Occurrences(1).CreateGeometryProxy oWP_3, oWorkPointProx3
oCD.Occurrences(1).CreateGeometryProxy oWP_4, oWorkPointProx4
Call oView.SetIncludeStatus(oWP_1, True)
Call oView.SetIncludeStatus(oWP_2, True)
Call oView.SetIncludeStatus(oWorkPointProx3, True)
Call oView.SetIncludeStatus(oWorkPointProx4, True)
Call oView.SetVisibility(oWP_1, False)
Call oView.SetVisibility(oWP_2, False)
Call oView.SetVisibility(oWorkPointProx3, False)
Call oView.SetVisibility(oWorkPointProx4, False)
Dim oCMark_1 As Centermark: Dim oCMark_2 As Centermark: Dim oCMark_3 As Centermark: Dim oCMark_4 As Centermark
Dim i As Integer
For i = 1 To oSheet.Centermarks.Count
If oSheet.Centermarks(i).AttachedEntity Is oWP_1 Then
Set oCMark_1 = oSheet.Centermarks(i)
Debug.Print "Точка 1 нашлась"
End If
If oSheet.Centermarks(i).AttachedEntity Is oWP_2 Then
Set oCMark_2 = oSheet.Centermarks(i)
Debug.Print "Точка 2 нашлась"
End If
If oSheet.Centermarks(i).AttachedEntity Is oWorkPointProx3 Then
Set oCMark_3 = oSheet.Centermarks(i)
Debug.Print "Точка 3 нашлась"
End If
If oSheet.Centermarks(i).AttachedEntity Is oWorkPointProx4 Then
Set oCMark_4 = oSheet.Centermarks(i)
Debug.Print "Точка 4 нашлась"
End If
Next
Dim oGI_1 As GeometryIntent: Dim oGI_2 As GeometryIntent: Dim oGI_3 As GeometryIntent: Dim oGI_4 As GeometryIntent:
Set oGI_1 = oSheet.CreateGeometryIntent(oCMark_1, kPoint2dIntent)
Set oGI_2 = oSheet.CreateGeometryIntent(oCMark_2, kPoint2dIntent)
Set oGI_3 = oSheet.CreateGeometryIntent(oCMark_3, kPoint2dIntent)
Set oGI_4 = oSheet.CreateGeometryIntent(oCMark_4, kPoint2dIntent)
Dim oPoint_1 As Point2d: Dim oPoint_2 As Point2d
Set oPoint_1 = oTG.CreatePoint2d(oView.Center.X, oView.Center.Y + oView.Height / 2 + 1)
Set oPoint_2 = oTG.CreatePoint2d(oView.Center.X + oView.Height / 2 + 1, oView.Center.Y)
Call oSheet.DrawingDimensions.GeneralDimensions.AddLinear(oPoint_1, oGI_1, oGI_2, kHorizontalDimensionType)
Call oSheet.DrawingDimensions.GeneralDimensions.AddLinear(oPoint_2, oGI_3, oGI_4, kVerticalDimensionType)
End Sub