Jump to content

Mleader trouble


flowerrobot

Recommended Posts

Good morning

 

Im having some trubble with my mleaders, Yesterday it worked fine, But today it dosnt, I even rolled back my code to yesterdays and the same problem.

 

Im passing two points & string to make the leader, Making it all works fine.

 

The the problem is, The Last point is now at the end of the text, Not where the End of the leader point is before it has the tail. The top image is what it is doing, Bottom is what it is ment to.

 

Attached is what i use to create the mleader aswell as a the style.

 

Edit : Fairly sure its not the leader style as leaders done manually do not give the problem

Edit2 :I found what is causing the probblem, but not sure how to fix it..

\/ will cause the item to go to the other side,

 

(vla-SetDogLegDirection Mleader 0
           (vlax-3D-point
               (list
                   (if (<= (car Pt_StartPt) (car Pt_EndPoint)) 1 -1)
                   0 0
               )
           )
       )

(defun Sub_Mleader
       (Pt_StartPt
       Pt_EndPoint
       Str_Text / MS var Mleader)
       (setvar "clayer" "dim")
       (if (> 3 (length Pt_StartPt))
           (setq Pt_StartPt (list (car Pt_StartPt) (cadr Pt_StartPt) 0)))
       (if (> 3 (length Pt_EndPoint))
           (setq Pt_EndPoint (list (car Pt_EndPoint) (cadr Pt_EndPoint) 0)))
       (setq 
           ms 
               (vla-get-modelspace
                   (vla-get-activedocument
                       (vlax-get-acad-object)))
           var 
               (vlax-make-variant
                   (vlax-safearray-fill
                       (safearray vlax-vbdouble '(0 . 5))
                       (apply 'append (list Pt_StartPt Pt_EndPoint))
                   )
               )
           Mleader (vla-addMleader ms var 0))
       (vla-put-TextString Mleader Str_Text)
       (vla-SetDogLegDirection Mleader 0
           (vlax-3D-point
               (list
                   (if (<= (car Pt_StartPt) (car Pt_EndPoint)) 1 -1)
                   0 0
               )
           )
       )
   )

(defun Sub_MlCreate                                                                            ;Will create Mleader Style - Standard
       (/ *doc* mldrdict newldrstyle)
       (setq 
           *doc* (vla-get-activedocument (vlax-get-acad-object))
           MllDict (vla-item (vla-get-dictionaries *doc*) "ACAD_MLEADERSTYLE")
           MLStyle (vlax-invoke MllDict 'addobject "Standard" "AcDbMLeaderStyle")
           txtcol 2
           ldrcol 4 
           colorObj (vla-getinterfaceobject (vlax-get-acad-object) (strcat "AutoCAD.AcCmColor." (substr (getvar "acadver") 1 2)))
       )
       (vla-put-ColorIndex colorObj ldrcol)
       ;; Leader format
       (vlax-put-property MLStyle 'AlignSpace 5.0)
       ;(vlax-put-property MLStyle 'ArrowSymbol "Arrowhead")
       (vlax-put-property MLStyle 'ArrowSize 4.0)
       (vlax-put-property MLStyle 'BreakSize 0.125)
       (vlax-put-property MLStyle 'LeaderLineType 1)
       (vla-put-LeaderLineColor MLStyle colorObj)
       (vlax-put-property MLStyle 'LeaderLineTypeId "Bylayer")
       (vlax-put-property MLStyle 'LeaderLineWeight -2)
       ;; Leader Structure    
       (vlax-put-property MLStyle 'MaxLeaderSegmentsPoints 2)
       (vlax-put-property MLStyle 'FirstSegmentAngleConstraint 0)
       (vlax-put-property MLStyle 'SecondSegmentAngleConstraint 0)
       (vlax-put-property MLStyle 'EnableLanding 4)
       (vlax-put-property MLStyle 'EnableDogleg 1)
       (vlax-put-property MLStyle 'DoglegLength 1.0)
       (vlax-put-property MLStyle 'Annotative 0)
       (vlax-put-property MLStyle 'ScaleFactor Int_Ds)
       ;; Content
       (vla-put-ColorIndex colorObj txtcol)
       (vlax-put-property MLStyle 'ContentType 2)
       (vlax-put-property MLStyle 'Description "Standard")
       (vlax-put-property MLStyle 'TextString "")
       (vlax-put-property MLStyle 'TextStyle "STANDARD")
       (vlax-put-property MLStyle 'TextAngleType 1)
       (vla-put-TextColor MLStyle colorObj)
       (vlax-put-property MLStyle 'TextHeight 3.5)
       (vlax-put-property MLStyle 'TextAlignmentType 0)
       (vlax-put-property MLStyle 'EnableFrameText 0)
       (vlax-put-property MLStyle 'TextLeftAttachmentType 5)
       (vlax-put-property MLStyle 'TextRightAttachmentType 5)
       (vlax-put-property MLStyle 'LandingGap 2.0)
       (vlax-put-property MLStyle 'DrawLeaderOrderType 0)
       (vlax-put-property MLStyle 'DrawMLeaderOrderType 1)
       (vlax-put-property MLStyle 'Description "Standard Mleader")
       (vlax-put-property MLStyle 'name "Standard")
   )

eg.JPG

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...