Jump to content

adding chamfering leader


nalsur8

Recommended Posts

this coding only can select line not polyline

how to change the code, so user can select line and polyline to add dimension/leader

 

TQ

 

 

(defun C:DCH(/ CL CHAM DL PT1 PT2 ANG ANG1 DIST PT3 PT4 DIST1 T1 H1 V1)
 (defun *error* (msg) (setq *error* nil) (princ))
 (setq old10 (getvar "ucsorg"))
 (command "_ucs" "w")
 (command "_ucsicon" "or")
  (setvar "CMDECHO" 0)
  (setq CL(getvar "CLAYER")
        CHAM(entget(car(entsel "\nSelect Chamfer to Dimension: ")))
        PT1(cdr(assoc 10 CHAM))
        PT2(cdr(assoc 11 CHAM))
        ANG(angle PT1 PT2)
        ANG1(angtos ANG 0 0)
        DIST(distance PT1 PT2))
  (cond 
    ((or(= ANG1 "45")(= ANG1 "135")(= ANG1 "225")(= ANG1 "315"))
        (setq PT3(polar PT1 ANG (/ DIST 2.0))
              PT4(getpoint "\nNote Location: ")
              DIST1(rtos(* DIST(abs(cos ANG))) 2 2)
              T1(strcat "C"DIST1))
     (command "leader" pt3 pt4 "" "" "" T1 "")
    )
    ((or(and(> ANG1 "0")(< ANG1 "45"))
        (and(> ANG1 "45")(< ANG1 "135"))
        (and(> ANG1 "135")(< ANG1 "225"))
        (and(> ANG1 "225")(< ANG1 "315"))
        (and(> ANG1 "315")(< ANG1 "360")))    
        (setq H1(getpoint "\nHorizontal Dimension Line Location: ")
              V1(getpoint "\nVertical Dimension Line Location: "))
        (command "layer" "s" DL "" "dim" "horizontal" PT1 PT2 H1 "" "vertical" PT1 PT2 V1 "" nil)
    )         
  )
  (command "layer" "s" CL "")
)

Edited by nalsur8
Link to comment
Share on other sites

Hi i new to lisp so i don't understand completly what you are trying to do but can't you use the chamfer command that is build into icon20.pngutocad that allows you to chamfer Polylines

Heres a small lisp for using that feature

 

 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun PLC()

 (setq ply (entsel "\nSelect Polyline you wish to Chamfer: "))
 (setq disa (getreal "\nEnter distance from corner to chamfer: "))
 (setq anga 45)
 (command "chamfer" "angle" disa 315)
 (command "chamfer" "polyline" ply)

);end defun PLC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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