×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Make leaders behave EXACTLY like dimensions

Make leaders behave EXACTLY like dimensions

Make leaders behave EXACTLY like dimensions

(OP)
Hi all.

Creating leaders is the bain of my AC life. Is there any way to make them behave just like radius dimensions but with two little differences?

1. It doesn't have to attach to an arc and only has on attachment point. An arc dimension has a centre and a radial attachment point.
2. You could have 'bent' lines to make up the leader line.

Thanks in advance

Hayden

RE: Make leaders behave EXACTLY like dimensions

The command "LEADER" is the closest you can come.  It makes a multiple Pline leader and associates the text with the endpoint of the line.  If you grip-edit the text, the line will move with it.  But if you grip edit the end of the line, the text does not move.  It is still two separate entities which is a pain.

Another solution which I used for years that makes true associative dimension leaders but is limited to a single line for the leader is to create a new dimension style with extension lines and center mark off and then use a macro to get two points (the arrow end and the text location), draw a temporary circle, create a Diameter Dimension using that circle and those two points and then erase the temporary circle.

RE: Make leaders behave EXACTLY like dimensions

(OP)
Hi IFR,

I do a similar thing with a radius dimension. I create one and scale it down by a factor of about a million. Thing is you can't drag the attachment point using the handles, it just spins the note so you need to use the move command. And you cant add jogs, like you said. So even though it's a workaround, at time is can be inadequate.

This is supposed to be THE drafting package, I would have though that this leader thing was standard, It is in others (ProE and Solidworks). Putting break lines in dimensions should be standard too.

All in all I'm a bit unimpressed when it comes to annotating and dimensioning your drawings.

RE: Make leaders behave EXACTLY like dimensions

Putting break lines in dinemsion extension lines while keeping the dimension associative and intact is easily handled with the following:  (sorry about the length)  On my computer, I changed C:DBREAK to C:DB for ease of use.

(prompt "\nDBREAK - dimension line break utility.  (C)1997 W.Kramer")
(prompt "\n         Downloaded from www.cadgineering.com";)
;;
;;NOTE:
;;  This program originally appeared in CADENCE magazine however,
;;  the version displayed in the magazine and available for download
;;  has a problem.  This version corrects the problem that was
;;  discovered.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Programmer's Toolbox - February 1997
;; W.Kramer
;;
;; Dimension line break utility
;;   Break whitness and dimension lines in R13
;;   dimension objects with out exploding the
;;   object.  Demonstrates how dimension objects
;;   are stored and manipulated as well as
;;   dynamic scoping of variables.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Listing 1:  Main Entry Point
;; Function (C:DBREAK)
;;
(defun C:DBREAK ( /
       ;;Local Bound Variables
       EN  ;;operator selection
       P1  ;;break point 1
       P2  ;;break point 2
       ENL ENB ELB NMB ELT ENT ;;see listing 3
       )
   ;;Operator select input object
   ;;and break point. -see listing 2
   (if (DBREAK0) (progn
      (DBREAK1) ;;See listing 3
      (if (null
         (entmake (list
           '(0 . "BLOCK")
           (assoc 2 ELT)
           (assoc 10 ELT)
           '(70 . 1)
         ))) (progn
          (prompt "\nRedefine failed!")
          (exit) ;;force exit of routine
      )) ;;end IF PROGN
      ;;Loop through block def seeking
      ;;LINE object to change.
      (while ENT
        ;;Get the entity list data
        (setq ELT (entget ENT))
        ;;Does entity match the one
        ;;we want to change?
        (if (not (eq ENL ENT))
           ;;NOT a match,
           ;;reconstruct block def.
           (entmake ELT)
           ;;else, Found a match,
           ;; do break & reconstruction.
           (DBREAK2) ;;see listing 4
        ) ;;end IF
        ;;get next entity in block def.
        (setq ENT (entnext ENT))
      ) ;;end WHILE
      (if (entmake '((0 . "ENDBLK")))
        (prompt "\nBlock modified")
        (prompt "\nBLOCK END failure!")
      ) ;;end IF
      (entupd ENB)
     ) ;;end PROGN
     (prompt "\nInvalid input")
   ) ;;end IF dbreak0
   (princ)
)
;;-----------------------------------------------
;; Listing 2 - Function DBREAK0
;;
;; Function: DBREAK0 - user input section
;;
(defun DBREAK0 ( /
       EL ;;entity list of selected object
       )
       ;;Global Variables
       ;; EN entity name of selected object
       ;; P1,P2 points selected
   (setq EN
     (nentsel
       "\nSelect dimension line to break: "))
   ;;
   (if EN (progn
      ;;get the object details
      (setq EL (entget (car EN))
            P1 (cadr EN))
      ;;first check to see if object selected
      ;;was a LINE which was part of an insert.
      (if (and (= (cdr (assoc 0 EL)) "LINE")
               (> (length EN) 2))
          ;;now ask operator to supply the
          ;;other side of the break.
          (setq P2
            (getpoint
              (cadr EN)
                "\nOther side of break: "))
          (prompt "\nLine was not selected!")
      ) ;;end IF
   ))
   ;;Snap selected points to the nearest object
   (if (and P1 P2)
      (setq P1 (osnap (cadr EN) "NEA")
            P2 (osnap P2 "NEA")
      ))
    ;;return True if both input points are okay
   (if (and P1 P2) 'T nil))
;;-----------------------------------------------
;; Listing 3 - Function DBREAK1
;;
;; FUNCTION: DBREAK1 - Set up global variables.
;;
(defun DBREAK1 ()
   ;;Global Variables
   ;;ENL  entity list of line selected
   ;;ENB  entity name of block/dimension
   ;;ELB  entity list of block/dimension
   ;;NMB  name of the block/dimension in table
   ;;ELT  entity list of table entry
   ;;ENT  entity name of block object
   (setq
         ENL (car EN)
         ENB (car (last EN))
         ELB (entget ENB)
         NMB (cdr (assoc 2 ELB))
         ELT (tblsearch "BLOCK" NMB)
         ENT (cdr (assoc -2 ELT))
   )
)
;;-----------------------------------------------
;; Listing 4 - Function DBREAK2
;;
;; Function DBREAK2: convert line object into
;; two line objects at break points.
;;
(defun DBREAK2 ( /
       ;;Local Variables
       LYR   ;;layer name of dim/blk line
       PP1   ;;start point of dim/blk line
       PP2   ;;end point of dim/blk line
       PA    ;;break point 1
       PB    ;;break point 2
       )
       ;;Global Variables
       ;; P1,P2 - operator break points
       ;; ELT - entity list of dim/blk line
   ;;get the line details
   (setq PP1 (cdr (assoc 10 ELT))
         PP2 (cdr (assoc 11 ELT))
         LYR (cdr (assoc 8 ELT)) )
   ;; Determine end points of
   ;;new line segments.
   (if (< (distance PP1 P1)
          (distance PP1 P2))
      (setq PA P1
            PB P2)
      (setq PA P2
            PB P1) )
   ;;Build new lines to replace
   ;;the broken line.
   (LINE PP1 PA Lyr 1)
   (LINE PB PP2 Lyr 1))
;;-----------------------------------------------
;; Listing 5 - Function LINE
;;
;; Function: LINE - create line object
(defun LINE (P1 P2 Lyr BlkFlg)
  (entmake (list
    '(0 . "LINE")
    (cons 6 (if BlkFlg "BYBLOCK" "BYLAYER"))
    (if LYR
      (cons 8 LYR)
      (getvar "CLAYER"))
    (cons 10 P1) (cons 11 P2)
    (cons 62 (if BlkFlg 0 256)))))
;;----------------------------------------------- END OF FILE

RE: Make leaders behave EXACTLY like dimensions

(OP)
Thanks for that. You gave it to me about 2 months ago already. I think its absolutley brilliant! I created an Icon instead. But don't you think it should be a standard feature?
One small problem I have with it though is if you modify the dimension in any way the breaks dissapear. It's actually your Lisp command that made me want to leaders to behave as a dimension in the first place. You cant use the Lisp command on leaders.

RE: Make leaders behave EXACTLY like dimensions

I use AutoCAD 2002. I get the following message when I load the above lisp.
Command: ; error: An error has occurred inside the *error* functionAutoCAD variable setting rejected: "osmode" nil
The lisp dbreak doesn't work after this. Can u help me understand this and do chages in the lisp so that it'll be beneficial for me also?
Thanks in advance

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources