Solid Edge Need to find x and y coordinates of callouts using VB

2021-10-06T23:58:36Z
DRAFT

Summary


Details

Have a VB program which contains textboxes and want to replace them with call outs. Am able to replace textboxes with Callouts but not at the exact locations.  How can you find out the origin (X and Y coordinates) for the callouts, width and also include different font sizes for different fields. 

Solution

The following sample cade can be used or modified as needed to suit your needs:

If oConnectToSolidEdge(True, True) = True Then
            Dim oDraftDoc As SolidEdgeDraft.DraftDocument = Nothing
            oDraftDoc = TryCast(objSEApp.ActiveDocument, SolidEdgeDraft.DraftDocument)
            If oDraftDoc IsNot Nothing Then
                Dim oSheet As SolidEdgeDraft.Sheet = Nothing
                oSheet = oDraftDoc.ActiveSheet
                Dim oTextBoxes As SolidEdgeFrameworkSupport.TextBoxes = Nothing
                Dim oTextBox As SolidEdgeFrameworkSupport.TextBox = Nothing
                Dim oCallouts As SolidEdgeFrameworkSupport.Balloons = Nothing
                Dim oCallout As SolidEdgeFrameworkSupport.Balloon = Nothing
                oTextBoxes = oSheet.TextBoxes
                oCallouts = oSheet.Balloons
                For Each oTextBox In oTextBoxes
                    Dim x, y, z As Double
                    Dim dblLeftMostpointOfTextbox As Double
                    oTextBox.GetKeyPoint(7, x, y, z, KPoint, lngHandType)
                    dblLeftMostpointOfTextbox = x
                    Dim dblRightMostpointOfTextbox As Double
                    oTextBox.GetKeyPoint(3, x, y, z, KPoint, lngHandType)
                    dblRightMostpointOfTextbox = x
                    Dim dblCenterPoint As Double
                    dblCenterPoint = (dblLeftMostpointOfTextbox + dblRightMostpointOfTextbox) / 2
                    oCallout = oCallouts.Add(dblCenterPoint, y, 0)
                    oCallout.Callout = True
                    oCallout.Leader = False
                    oCallout.Style.Font = oTextBox.Edit.Font
                    oCallout.CalloutTextAspectRatio = 1
                    oCallout.Style.Height = oTextBox.Edit.TextSize
                    oCallout.BalloonText = "%{CNTRL LOC/CP}"
                    oCallout.SetKeyPoint(0, dblCenterPoint, y, 0)



Hardware/Software Configuration

Platform: INTEL
OS: windows
OS Version: 10_1607
Product: SOLID_EDGE
Application: AUTOMATION
Version: V221.0
Function: DRAFT

Ref: 002-8545553

KB Article ID# PL8545553

Contents

SummaryDetails

Associated Components

DRAFT: DRAWING_VIEWS