Solid Edge How to get dimension related object?

2021-10-06T23:52:57Z
PART/SHEETMETAL

Summary


Details

How to get dimension related object?



Solution

We can get the dimension related object by GetRelated() method. Consider user have dimension placed on drawing sheet then run the below sample code.


 


Imports System.IO


Imports System.Runtime.InteropServices


Imports SolidEdgeConstants


 


ModuleModule1


    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


 


            Dim objCircle AsObject = Nothing, my_kp AsBoolean


            Dim my_x AsDouble, my_y AsDouble, my_z AsDouble, i AsLong


            For i = 0 To objDimensions.Count - 1


                ' lines2d = objSheet.Lines2d


                dimension = objDimensions(i)


                MsgBox(dimension.Name.ToString())


 


                dimension.GetRelated(Index:=i, GraphicObject:=objCircle, x:=my_x, y:=my_y, z:=my_z, keyPoint:=my_kp)


                MsgBox("Object #" & objCircle.Type.ToString())


            Next i


 


        Catch ex AsException


            Console.WriteLine(ex.Message)


        Finally


            Console.WriteLine("Hello")


        EndTry


        Console.WriteLine("GTAC")


    EndSub


EndModule



Hardware/Software Configuration

Platform: AMD64
OS: window
OS Version: 764
Product: SOLID_EDGE
Application: AUTOMATION
Version: V110.0
Function: API_DOCUMENT

Ref: 002-8002478

KB Article ID# PL8002478

Contents

SummaryDetails

Associated Components

PART/SHEETMETAL: FEATURES