Results 1 to 8 of 8

Thread: MLEADER INSERTION POINT (?)

  1. #1
    Member
    Join Date
    2012-06
    Posts
    27
    Login to Give a bone
    0

    Default MLEADER INSERTION POINT (?)

    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.

  2. #2
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: MLEADER INSERTION POINT (?)

    Try this code, not tested thoroughly

    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
    ~'J'~

  3. #3
    Member
    Join Date
    2012-06
    Posts
    27
    Login to Give a bone
    0

    Default Re: MLEADER INSERTION POINT (?)

    Thanks FIXO !!!

  4. #4
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: MLEADER INSERTION POINT (?)

    You're welcome
    Cheers

  5. #5
    Member
    Join Date
    2012-06
    Posts
    27
    Login to Give a bone
    0

    Default Re: MLEADER INSERTION POINT (?)

    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.

  6. #6
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: MLEADER INSERTION POINT (?)

    I tested the code in A2009 all is working in there,
    I know nothing about A2010 and over, sorry

    ~'J'~

  7. #7
    Member
    Join Date
    2012-06
    Posts
    27
    Login to Give a bone
    0

    Default Re: MLEADER INSERTION POINT (?)

    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 !!!

  8. #8
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: MLEADER INSERTION POINT (?)

    Try this quick and dirty code, almost not tested
    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
    ~'J'~

Similar Threads

  1. Replies: 21
    Last Post: 2012-10-10, 02:38 PM
  2. RL insertion point
    By kristreagus in forum Dynamic Blocks - Technical
    Replies: 18
    Last Post: 2007-11-08, 03:33 AM
  3. Placing insertion point at mid-point of flange on a steel section
    By Spenner in forum Dynamic Blocks - Technical
    Replies: 4
    Last Post: 2007-06-18, 01:53 PM
  4. Insertion Point
    By kwong in forum Revit Architecture - Families
    Replies: 1
    Last Post: 2005-03-19, 07:27 AM
  5. Insertion Point
    By kwong in forum Revit Architecture - General
    Replies: 1
    Last Post: 2005-03-19, 07:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •