Details
How to get dimension related objects?
Solution
User can get dimension related object by GetRelated() method. For example,
Imports System.IO
Imports System.Runtime.InteropServices
Imports SolidEdgeConstants
Module Module1
Sub Main()
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objDraftDocument As SolidEdgeDraft.DraftDocument = Nothing
Dim objSheet As SolidEdgeDraft.Sheet = Nothing
Dim objDimensions As SolidEdgeFrameworkSupport.Dimensions = Nothing
Dim dimension As SolidEdgeFrameworkSupport.Dimension = Nothing
Dim line2d As SolidEdgeFrameworkSupport.Line2d = Nothing
Dim lines2d As SolidEdgeFrameworkSupport.Lines2d = Nothing
Try
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
objDraftDocument = objApplication.ActiveDocument
objSheet = objDraftDocument.ActiveSheet
objDimensions = objSheet.Dimensions
MsgBox("Total dimensions in drawing file are = " + objDimensions.Count.ToString())
Dim objCircle As Object = Nothing, my_kp As Boolean
Dim my_x As Double, my_y As Double, my_z As Double, i As Long
For i = 0 To objDimensions.Count - 1
dimension = objDimensions(i)
dimension.GetRelated(Index:=i, GraphicObject:=objCircle, x:=my_x, y:=my_y, z:=my_z, keyPoint:=my_kp)
MsgBox("X coordinate = " & my_x.ToString() & vbNewLine + "Y coordinate = " & my_y.ToString() & vbNewLine + "Z coordinate = " & my_z.ToString() & vbNewLine)
Next i
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
Console.WriteLine("GTAC")
End Try
End Sub
End Module
Hardware/Software Configuration
Platform: AMD64
OS: window
OS Version: 764
Product: SOLID_EDGE
Application: AUTOMATION
Version: V110.0
Function: API_DOCUMENT
Ref: 002-8007274