Results 1 to 7 of 7

Thread: leader breaks in ADT

  1. #1
    Member
    Join Date
    2009-01
    Posts
    47
    Login to Give a bone
    0

    Default leader breaks in ADT

    Hello,

    Can't figure it out ...

    This lisp works fine in ACAD2008 but it breaks in ADT2008.
    Why? Is the leader command different? Don't get it...

    Please help..
    Code:
    (defun c:ldr (/ skala p1 p2 p3 oldlay) 
    (setq oldlay (getvar "clayer"))
    
      
      (setq	p1 (getpoint "\nStart Point: ")
    	p2 (getpoint p1 "\nSecond point: ")
      )
      (grdraw p1 p2 1 1)
      (setq p3 (getpoint p2 "\nText Placement: "))
    
     (command "_leader" p1 p2 p3 "" "" "" "")
    (setvar "clayer" oldlay)
      (redraw)
    )

  2. #2
    I could stop if I wanted to kpblc2000's Avatar
    Join Date
    2006-09
    Posts
    212
    Login to Give a bone
    0

    Default Re: leader breaks in ADT

    Look at leader settings. I think you're calling mtext-editor by last "" in "_.leader" command.
    I think you'd better create leaders by vla-add-leader function and don't use command methods.

  3. #3
    Member
    Join Date
    2009-01
    Posts
    47
    Login to Give a bone
    0

    Default Re: leader breaks in ADT

    I cant vlisp that much so it would be difficult.
    I even tried to entmake MTEXt with no results either.

  4. #4
    I could stop if I wanted to kpblc2000's Avatar
    Join Date
    2006-09
    Posts
    212
    Login to Give a bone
    0

    Default Re: leader breaks in ADT

    I mean something like this:
    Code:
    (defun test (/ adoc *error* pt1 pt2 pt3 text)
    
      (defun *error* (msg)
        (vla-endundomark adoc)
        (princ msg)
        (princ)
        ) ;_ end of defun
    
      (vl-load-com)
      (vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
      (if (and (= (type (setq pt1 (vl-catch-all-apply
                                    (function
                                      (lambda ()
                                        (getpoint "\nStart point <Cancel> : ")
                                        ) ;_ end of lambda
                                      ) ;_ end of function
                                    ) ;_ end of vl-catch-all-apply
                              ) ;_ end of setq
                        ) ;_ end of type
                  'list
                  ) ;_ end of =
               (= (type
                    (setq pt2 (vl-catch-all-apply (function (lambda () (getpoint pt1 "\nSecond point <Cancel> : ")))))
                    ) ;_ end of type
                  'list
                  ) ;_ end of =
               (= (type (setq pt3 (vl-catch-all-apply
                                    (function (lambda (/ gr)
                                                (grdraw pt1 pt2 -1)
                                                (getpoint pt2 "\nFinish point <Cancel> : ")
                                                ) ;_ end of lambda
                                              ) ;_ end of function
                                    ) ;_ end of vl-catch-all-apply
                              ) ;_ end of setq
                        ) ;_ end of type
                  'list
                  ) ;_ end of =
               (= (type (setq text (vl-catch-all-apply
                                     (function
                                       (lambda (/ res str is_next)
                                         (while (and (setq str (getstring t
                                                                          (strcat "\n"
                                                                                  (if is_next
                                                                                    "Next"
                                                                                    "First"
                                                                                    ) ;_ end of if
                                                                                  " string <"
                                                                                  (if is_next
                                                                                    "Cancel"
                                                                                    "Enough"
                                                                                    ) ;_ end of if
                                                                                  "> : "
                                                                                  ) ;_ end of strcat
                                                                          ) ;_ end of getstring
                                                           ) ;_ end of setq
                                                     (/= str "")
                                                     ) ;_ end of and
                                           (setq res     (cons str res)
                                                 is_next t
                                                 ) ;_ end of setq
                                           ) ;_ end of while
                                         (reverse res)
                                         ) ;_ end of lambda
                                       ) ;_ end of function
                                     ) ;_ end of vl-catch-all-apply
                              ) ;_ end of setq
                        ) ;_ end of type
                  'list
                  ) ;_ end of =
               text
               ) ;_ end of and
        (progn
          (setq pt_lst (apply (function append) (list pt1 pt2 pt3)))
          (vla-addleader
            (vla-get-modelspace adoc)
            (vlax-make-variant
              (vlax-safearray-fill
                (vlax-make-safearray
                  vlax-vbdouble
                  (cons 0 8)
                  ) ;_ end of vlax-make-safearray
                pt_lst
                ) ;_ end of vlax-safearray-fill
              ) ;_ end of vlax-make-variant
            (vla-addmtext
              (vla-get-modelspace adoc)
              (vlax-3d-point pt3)
              0.
              (strcat (car text)
                      (apply 'strcat
                             (mapcar (function (lambda (x) (strcat "\\P" x))) (cdr text))
                             ) ;_ end of apply
                      ) ;_ end of strcat
              ) ;_ end of vla-addmtext
            aclinewitharrow
            ) ;_ end of vla-addleader
          ) ;_ end of progn
        ) ;_ end of if
      (vla-endundomark adoc)
      (princ)
      )

  5. #5
    Member
    Join Date
    2009-01
    Posts
    47
    Login to Give a bone
    0

    Default Re: leader breaks in ADT

    Hey,

    This is wonderful.
    Is it possible to call MTEXT-box to appear instead of typing First String, Seconf String?
    Thank you very much for your help Sir.

  6. #6
    I could stop if I wanted to kpblc2000's Avatar
    Join Date
    2006-09
    Posts
    212
    Login to Give a bone
    0

    Default Re: leader breaks in ADT

    I don't remember how to call mtext-editor in lisp functions Construction like
    Code:
    (command "_.mtext")
    (while (/= (logand (getvar "cmdactive") 1) 0)
      (command pause)
      ) ;_ end of while
    won't works correct Because of this i think you could:
    1st Create MText object.
    2nd Call function to create a leader object.
    3rd Select MText object as "annotation" (perhaps replace it or create new object).
    I tired to solve this problem but it was unsuccess. Finally I decided to use a blocks with an attributes. But this way is not perfect too

  7. #7
    Member
    Join Date
    2009-01
    Posts
    47
    Login to Give a bone
    0

    Default Re: leader breaks in ADT

    I tried but it really look wierd

Similar Threads

  1. SP2 breaks railings?
    By ron.sanpedro in forum Revit - Platform
    Replies: 2
    Last Post: 2010-10-06, 04:52 PM
  2. multiple connection point for leader tails when using a multi-leader
    By jschraud228486 in forum AutoCAD Annotation
    Replies: 1
    Last Post: 2010-06-16, 01:42 AM
  3. 2-Way Section Breaks?
    By Dean Camlin in forum Revit - Platform
    Replies: 1
    Last Post: 2007-10-23, 04:29 PM
  4. Replies: 5
    Last Post: 2007-03-13, 02:21 PM
  5. Breaks in gridlines
    By Martin P in forum Revit Architecture - Wish List
    Replies: 2
    Last Post: 2005-02-11, 04:10 PM

Posting Permissions

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