Solved! Go to solution

How to retrieve Balloons position in draft sheet

I'd like to iterate over the existing balloons of a draft sheet and retrieve the X and Y positions of the balloons center (relative to the draft sheet). Which method should I use?



Accepted by topic author dosti
‎08-26-2015 04:32 AM

Re: How to retrieve Balloons position in draft sheet

You should try something like this :



                            For Each ObjBalloon In ObjdraftSheet.Balloons
                                If ObjBalloon.Callout = 0 Then
                                    Dim vX, vY, vZ As Double
                                    BalloonElem.Name = ObjBalloon.Name
                                    BalloonElem.UpperText = ObjBalloon.BalloonText
                                    BalloonElem.LowerText = ObjBalloon.BalloonTextLower
                                    BalloonElem.PrefixText = ObjBalloon.BalloonTextPrefix
                                    BalloonElem.SuffixText = ObjBalloon.BalloonTextSuffix
                                    BalloonElem.Type = ObjBalloon.BalloonType
                                    BalloonElem.Sides = ObjBalloon.BalloonSides
                                    BalloonElem.Size = ObjBalloon.TextScale
                                    BalloonElem.BOMLink = ObjBalloon.LinkToPartsList
                                        ObjBalloon.GetVertex(1, vX, vY, vZ)
                                        BalloonElem.X_AbsCoord = vX
                                        BalloonElem.Y_AbsCoord = vY

                                        ObjBalloon.GetTerminator(objTerminator, x, y, z, keypoint)
                                        BalloonElem.X_OrigCoord = x
                                        BalloonElem.Y_OrigCoord = y
                                        BalloonElem.X_RelCoord = vX - x
                                        BalloonElem.Y_RelCoord = vY - y
                                        ObjModelMember = objTerminator.object.Modelmember.immediateparent
                                        BalloonElem.FileName = ObjModelMember.ModelNode.FileName

                                        PathOcc = ObjModelMember.ComponentName
                                        Do While Not (ObjModelMember.ImmediateParent Is Nothing)
                                            ObjModelMember = ObjModelMember.ImmediateParent
                                            PathOcc = ObjModelMember.ComponentName & SepOcc & PathOcc
                                        BalloonElem.Occurrence = PathOcc
                                        BalloonElem.CutLength = objTerminator.object.Modelmember.ImmediateParent.ModelNode.CutLength
                                        BalloonElem.ViewName = objTerminator.ImmediateParent.CaptionDefinitionTextPrimary

                                    Catch ex As Exception
                                        BalloonElem.FileName = ""
                                        BalloonElem.Occurrence = ""
                                        BalloonElem.CutLength = Nothing
                                        BalloonElem.ViewName = ""
                                    End Try
                                    BalloonElem.SheetName = ObjdraftSheet.Name
                                    BalloonElem.Layer = ObjBalloon.Layer
                                End If


Romuald BERTIN

Re: How to retrieve Balloons position in draft sheet

Thanks a lot rbertin!

Re: How to retrieve Balloons position in draft sheet

Hi all,


Which method should I use to get position of baloon like on a picture ? thanks