Hi!
How can I get mleader insertion point by vba or vb6 code ?
Thanks !
leader.PNG
|
Hi!
How can I get mleader insertion point by vba or vb6 code ?
Thanks !
leader.PNG
Last edited by clxramos583784; 2012-06-20 at 08:02 PM.
Try this code, not tested thoroughly
~'J'~Code:Public Sub ArrowPoint() Dim oMText As AcadMText Dim oLeader As AcadLeader Dim oMLeader As AcadMLeader Dim oCircle As AcadCircle Dim fpick As Variant Dim oEnt As AcadEntity Dim lCoords As Variant Dim pt1(0 To 2) As Double Dim pt2(0 To 2) As Double Dim mp(0 To 2) As Double Dim align As Integer Dim pStr As String ThisDrawing.Utility.GetEntity oEnt, fpick, vbCr & "Select leader: " If TypeOf oEnt Is AcadLeader Then Set oLeader = oEnt lCoords = oLeader.Coordinates pt1(0) = CDbl(lCoords(0)): pt1(1) = CDbl(lCoords(1)): pt1(2) = CDbl(lCoords(2)) Set oCircle = ThisDrawing.ModelSpace.AddCircle(pt1, 20) ElseIf TypeOf oEnt Is AcadMLeader Then Set oMLeader = oEnt lCoords = oMLeader.GetLeaderLineVertices(0) pt1(0) = CDbl(lCoords(0)): pt1(1) = CDbl(lCoords(1)): pt1(2) = CDbl(lCoords(2)) Set oCircle = ThisDrawing.ModelSpace.AddCircle(pt1, 20) Else MsgBox "Invalid object type selected" Exit Sub End If End Sub
Fixo, take off a doubt, please.
does this sintaxe code "oMLeader.GetLeaderLineVertices(0)", function only versions 2010 and over or not ?
Thanks again!
ps. That code you sent me worked wonderfull.
I tested the code in A2009 all is working in there,
I know nothing about A2010 and over, sorry
~'J'~
I tested it Autocad 2010 and worked very well.
I would like to know about versions 2000 to the 2008.
Help me more one time in this case: text insertion.
How do I do to get it ?
mleader.PNG
Thanks !!!
Try this quick and dirty code, almost not tested
~'J'~Code:Public Sub GetTextBounds() Dim oLeader As AcadLeader Dim fpick As Variant Dim oEnt As AcadEntity Dim oPoly As AcadLWPolyline ThisDrawing.Utility.GetEntity oEnt, fpick, vbCr & "Select leader: " If TypeOf oEnt Is AcadLeader Then Set oLeader = oEnt Dim minp As Variant Dim maxp As Variant oLeader.Annotation.GetBoundingBox minp, maxp Dim pts(7) As Double pts(0) = minp(0): pts(1) = minp(1) pts(2) = minp(0) + (maxp(0) - minp(0)): pts(3) = minp(1) pts(4) = maxp(0): pts(5) = maxp(1) pts(6) = minp(0): pts(7) = maxp(1) Set oPoly = ThisDrawing.ModelSpace.AddLightWeightPolyline(pts) oPoly.Closed = True oPoly.color = acRed End If End Sub