Jump to content

Recommended Posts

Posted

i have a lisp for the leaders I use. Somehow my size got changed. In 1=1ps the arrow on the leader should be 1/8" long and 1/16" wide, where in my code do I change this? it also needs to scale accordingly to various scales. for quarter scale it should be 6" long and 2" wide. If its not too much it would also be great if it turned osnaps off at the beginning of the command and back on at the end, if thats too much the size is what really matters. any help would be great!

;Curved Leader
(defun c:CL ()
  (defun *error* (msg)
     (reset)
     (prompt (strcat "\n\n" msg "  "))
  );defun
  (setq osm (getvar "osmode"))
  (setq layerl (getvar "clayer"))
  (setq ortho (getvar "orthomode"))
  (setvar "orthomode"0)
  (setvar "blipmode"0)
  (setvar "cmdecho"0)
  (if (tblsearch "layer" "txt")
          (command "layer" "s" "txt" "")
          (progn
              (setq rgn (getvar "regenmode")) (setvar "regenmode"0)
              (command "layer" "m" "txt")
              (command "c" "c" "")
              (command "")
              (setvar "regenmode" rgn)
          );progn
      );if
   (princ)
  (setq p1 (getpoint "\nstart: "))
  (setq p2 (getpoint p1 "\nfirst point of curve: "))
     (setq ang (angle p1 p2))
     (setq dimsc (getvar "dimscale"))
     (setq lth (* 0.10125 dimsc))
     (setq pp2 (polar p1 ang lth))
     (setq p02 (polar pp2 (+ ang 1.570796) (/ lth 5.5)))
     (setq p03 (polar pp2 (- ang 1.570796) (/ lth 5.5)))
     (command "pline" p1 "w" "0" "0" p2)
     (while (setq p2 (getpoint "\nto point: " p2))
       (command p2)
     );while
     (command "")
  (princ)
  (command "pedit" "@" "s"  "")
  (command "solid" p1 p02 p03 "" "")
  (if (tblsearch "layer" "txt")
          (command "layer" "s" "txt" "")
          (progn
              (setq rgn (getvar "regenmode")) (setvar "regenmode"0)
              (command "layer" "m" "text")
              (command "c" "4" "")
              (command "")
              (setvar "regenmode" rgn)
          );progn
      );if
   (princ)
   (setvar "osmode"1)
   (setvar "blipmode"0) 
   (setq t1 (getpoint "\nPick end point of leader: "))
   (setvar "osmode" osm)
   (setq t2 (getpoint t1 "\nPick direction for text justification: "))
   (setq ds (/ dimsc 24))
   (if (< (car t2) (car t1))
       (setq t3 (polar t1 (/ 225 57.295) (* ds (sqrt 2.0))))
       (setq t3 (polar t1 (/ 315 57.295) (* ds (sqrt 2.0))))

   );if 
  (prompt "\nEnter Text: ")
   (if (< (car t3) (car t1)) 
       (command "Dtext" "r" t3 "0")
       (command "Dtext" t3 "0")
   );if
  (setvar "orthomode" ortho)
  (command "layer" "s" layerl "")   
  )

Posted

Did I not create one for you a while back in which these variables could be changed:

 

;|

   Curved Leader

   By Lee McDonnell

   31.12.2008

|;

 ; Version 2  ~  Added Variable Menu.

(defun c:cl () (c:CurvedLeader)) ; Program Shortcut

(defun c:CurvedLeader (/ *error* varlist oldvars pl vlist stpt enpt ang pt ltxt)

   ;;     --- Error Trap ---

   (defun *error* (msg)
   (mapcar 'setvar varlist oldvars)
   (if (= msg "")
       (princ "\nLeader Constructed.")
       (princ (strcat "\n" (strcase msg)))
   ) ;_  end if
   (princ)
   ) ; end of *error*

   (setq varlist (list "CMDECHO" "CLAYER" "PLINEWID")
     oldvars (mapcar 'getvar varlist)
   ) ; end setq 

   ;;     --- Error Trap ---

   (or (getenv "CL:ARROWW") (setenv "CL:ARROWW" "2.0"))
   (or (getenv "CL:ARROWL") (setenv "CL:ARROWL" "4.0"))
   (or (getenv "CL:TEXTH") (setenv "CL:TEXTH" "2.5"))
   (or (getenv "CL:TEXTO") (setenv "CL:TEXTO" "2.5"))
   (alert
   (strcat    "Type \"CLSET\" to Alter Base Variables.
           \nCurrent Settings: \n\nArrow Width: "
       (getenv "CL:ARROWW")
       "\nArrow Length: "
       (getenv "CL:ARROWL")
       "\nText Height: "
       (getenv "CL:TEXTH")
       "\nText Offset: "
       (getenv "CL:TEXTO")
   ) ;_  end strcat
   ) ;_  end alert

   (defun makelay (x y)
   (if (not (tblsearch "Layer" x))
       (command "-layer" "m" x "c" y x "")
   ) ;_  end if
   ) ;_  end defun

   (defun polyvert (z)
   (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget z)))
   ) ;_  end defun

   (setvar "cmdecho" 0)
   (vl-load-com)
   (mapcar 'makelay '("LEADER" "LEADER-TEXT") '("2" "2"))
   (setvar "clayer" "LEADER")
   (prompt "\nConstruct Leader... ")
   (setvar "PLINEWID" 0.0)
   (command "_pline")
   (while (> (getvar "cmdactive") 0) (command pause))
   (setq pl (entlast))
   (setq vlist (polyvert pl))
   (command "_pedit" pl "S" "")
   (setq stpt (car vlist)
     enpt (last vlist)
     ang  (angle stpt (cadr vlist))
   ) ;_  end setq
   (command "_pline"
        stpt
        "W"
        "0.0"
        "2.0"
        (polar stpt ang 4.0)
        ""
   ) ;_  end command
   (setq pt (polar enpt 0 2.5))
   (if    (/= (setq ltxt (getstring t "\nSpecify Text for Leader: ")) "")
   (entmake
       (list '(0 . "TEXT")
         '(8 . "LEADER-TEXT")
         (cons 10 pt)
         (cons 40 2.5)
         (cons 1 ltxt)
         '(50 . 0.0)
         '(7 . "STANDARD")
         '(71 . 0)
         '(72 . 0)
         '(73 . 2)
         (cons 11 pt)
       ) ; end list
   ) ; end entmake
   (alert "Blank Leader Created.")
   ) ;_  end if
   (*error* "")
   (princ)
) ;_  end defun

(princ "\nCurved Leader by Lee McDonnell Loaded. Type \"CL\" to Invoke.")

(defun c:clset (/ arw arl txth txto)
   (or (getenv "CL:ARROWW") (setenv "CL:ARROWW" "2.0"))
   (or (getenv "CL:ARROWL") (setenv "CL:ARROWL" "4.0"))
   (or (getenv "CL:TEXTH") (setenv "CL:TEXTH" "2.5"))
   (or (getenv "CL:TEXTO") (setenv "CL:TEXTO" "2.5"))
   (alert (strcat "Current Settings: \n\nArrow Width: "
          (getenv "CL:ARROWW")
          "\nArrow Length: "
          (getenv "CL:ARROWL")
          "\nText Height: "
          (getenv "CL:TEXTH")
          "\nText Offset: "
          (getenv "CL:TEXTO")
      ) ;_  end strcat
   ) ;_  end alert
   (if    (setq arw (getreal (strcat "Specify Arrow Width <"
                  (getenv "CL:ARROWW")
                  "> : "
              ) ;_  end strcat
         ) ;_  end getreal
   ) ;_  end setq
   (setenv "CL:ARROWW" (rtos arw))
   ) ;_  end if
   (if    (setq arl (getreal (strcat "Specify Arrow Length <"
                  (getenv "CL:ARROWL")
                  "> : "
              ) ;_  end strcat
         ) ;_  end getreal
   ) ;_  end setq
   (setenv "CL:ARROWL" (rtos arl))
   ) ;_  end if
   (if    (setq txth (getreal (strcat "Specify Text Height <"
                   (getenv "CL:TEXTH")
                   "> : "
               ) ;_  end strcat
          ) ;_  end getreal
   ) ;_  end setq
   (setenv "CL:TEXTH" (rtos txth))
   ) ;_  end if
   (if    (setq txto (getreal (strcat "Specify Text Offset <"
                   (getenv "CL:TEXTO")
                   "> : "
               ) ;_  end strcat
          ) ;_  end getreal
   ) ;_  end setq
   (setenv "CL:TEXTO" (rtos txto))
   ) ;_  end if
   (princ "\nBase Variables Set.")
   (princ)
) ;_  end defun



Posted

Im pretty sure you did, Ive been going through and getting rid of old lisps and we had 4 curved leader lisps and I got rid of the right one and kept the wrong one. thanks for fixing it again.

Posted

it says type clset to change variable and when i do that it says invalid input.

Posted

Type CLSet when outside of the LISP function - I know its not too good, but it was a quick fix.

Posted

is there a way to make it change with the scale its being drawn in.

 

for quarter scale i use

(defun c:1=48MS ()
(setvar "tilemode" 1)
(command "-style" "" "" 4.5 ".9" "" "" "" "")
(setvar "ltscale" 18)
(setvar "DIMscale" 48)
(setvar "BLIPMODE" 0)
)
CODE] and the arrows should be 2" wide and 6" long
for eighth scale
[code(defun c:1=96MS ()
(setvar "tilemode" 1)
(command "-style" "" "" 9 ".9" "" "" "" "")
(setvar "ltscale" 36)
(setvar "DIMscale" 96)
(setvar "BLIPMODE" 0)
)

and the arrows should be 4" by 10"

with that is there a way to make the arrow change size based on those values?

Posted

I could multiply the arrow size by the dimscale set (or a modfication of the dimscale).

 

You say, when its 1/4, you set the dimscale to 48?

Posted

yep, i think the multiplying the size by the dimscale is what i need

Posted

I suppose Text Height would need to have the multiplying factor also?

Posted

Ok, sorry about the original code - I hadn't properly finished the menu thingy - when you set the values, they probably had no effect on the actual leader.

 

This is fixed now:

 

;|

   Curved Leader

   By Lee McDonnell

   31.12.2008

|;

 ; Version 2  ~  Added Variable Menu.

(defun c:cl () (c:CurvedLeader)) ; Program Shortcut

(defun c:CurvedLeader (/ *error* varlist oldvars dmscal pl vlist stpt enpt ang pt ltxt)

   ;;     --- Error Trap ---

   (defun *error* (msg)
   (mapcar 'setvar varlist oldvars)
   (if (= msg "")
       (princ "\nLeader Constructed.")
       (princ (strcat "\n" (strcase msg)))
   ) ;_  end if
   (princ)
   ) ; end of *error*

   (setq varlist (list "CMDECHO" "CLAYER" "PLINEWID")
     oldvars (mapcar 'getvar varlist)
   ) ; end setq 

   ;;     --- Error Trap ---

   (or (getenv "CL:ARROWW") (setenv "CL:ARROWW" "2.0"))
   (or (getenv "CL:ARROWL") (setenv "CL:ARROWL" "4.0"))
   (or (getenv "CL:TEXTH") (setenv "CL:TEXTH" "2.5"))
   (or (getenv "CL:TEXTO") (setenv "CL:TEXTO" "2.5"))
   (alert
   (strcat    "Type \"CLSET\" to Alter Base Variables.
           \nCurrent Settings: \n\nArrow Width: "
       (getenv "CL:ARROWW")
       "\nArrow Length: "
       (getenv "CL:ARROWL")
       "\nText Height: "
       (getenv "CL:TEXTH")
       "\nText Offset: "
       (getenv "CL:TEXTO")
   ) ;_  end strcat
   ) ;_  end alert

   (defun makelay (x y)
   (if (not (tblsearch "Layer" x))
       (command "-layer" "m" x "c" y x "")
   ) ;_  end if
   ) ;_  end defun

   (defun polyvert (z)
   (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget z)))
   ) ;_  end defun

   (setvar "cmdecho" 0)
   (vl-load-com)
   (setq dmscal (max 1 (getvar "DIMSCALE")))
   (mapcar 'makelay '("LEADER" "LEADER-TEXT") '("2" "2"))
   (setvar "clayer" "LEADER")
   (prompt "\nConstruct Leader... ")
   (setvar "PLINEWID" 0.0)
   (command "_pline")
   (while (> (getvar "cmdactive") 0) (command pause))
   (setq pl (entlast))
   (setq vlist (polyvert pl))
   (command "_pedit" pl "S" "")
   (setq stpt (car vlist)
     enpt (last vlist)
     ang  (angle stpt (cadr vlist))
   ) ;_  end setq
   (command "_pline"
        stpt
        "W"
        "0.0"
        (rtos (* (atof (getenv "CL:ARROWW")) dmscal))
        (polar stpt ang (* (atof (getenv "CL:ARROWL")) dmscal))
        ""
   ) ;_  end command
   (setq pt (polar enpt 0 (atof (getenv "CL:TEXTO"))))
   (if    (/= (setq ltxt (getstring t "\nSpecify Text for Leader: ")) "")
   (entmake
       (list '(0 . "TEXT")
         '(8 . "LEADER-TEXT")
         (cons 10 pt)
         (cons 40 (* (atof (getenv "CL:TEXTH")) dmscal))
         (cons 1 ltxt)
         '(50 . 0.0)
         '(7 . "STANDARD")
         '(71 . 0)
         '(72 . 0)
         '(73 . 2)
         (cons 11 pt)
       ) ; end list
   ) ; end entmake
   (alert "Blank Leader Created.")
   ) ;_  end if
   (*error* "")
   (princ)
) ;_  end defun

(princ "\nCurved Leader by Lee McDonnell Loaded. Type \"CL\" to Invoke.")

(defun c:clset (/ arw arl txth txto)
   (or (getenv "CL:ARROWW") (setenv "CL:ARROWW" "2.0"))
   (or (getenv "CL:ARROWL") (setenv "CL:ARROWL" "4.0"))
   (or (getenv "CL:TEXTH") (setenv "CL:TEXTH" "2.5"))
   (or (getenv "CL:TEXTO") (setenv "CL:TEXTO" "2.5"))
   (alert (strcat "Current Settings: \n\nArrow Width: "
          (getenv "CL:ARROWW")
          "\nArrow Length: "
          (getenv "CL:ARROWL")
          "\nText Height: "
          (getenv "CL:TEXTH")
          "\nText Offset: "
          (getenv "CL:TEXTO")
      ) ;_  end strcat
   ) ;_  end alert
   (if    (setq arw (getreal (strcat "Specify Arrow Width <"
                  (getenv "CL:ARROWW")
                  "> : "
              ) ;_  end strcat
         ) ;_  end getreal
   ) ;_  end setq
   (setenv "CL:ARROWW" (rtos arw))
   ) ;_  end if
   (if    (setq arl (getreal (strcat "Specify Arrow Length <"
                  (getenv "CL:ARROWL")
                  "> : "
              ) ;_  end strcat
         ) ;_  end getreal
   ) ;_  end setq
   (setenv "CL:ARROWL" (rtos arl))
   ) ;_  end if
   (if    (setq txth (getreal (strcat "Specify Text Height <"
                   (getenv "CL:TEXTH")
                   "> : "
               ) ;_  end strcat
          ) ;_  end getreal
   ) ;_  end setq
   (setenv "CL:TEXTH" (rtos txth))
   ) ;_  end if
   (if    (setq txto (getreal (strcat "Specify Text Offset <"
                   (getenv "CL:TEXTO")
                   "> : "
               ) ;_  end strcat
          ) ;_  end getreal
   ) ;_  end setq
   (setenv "CL:TEXTO" (rtos txto))
   ) ;_  end if
   (princ "\nBase Variables Set.")
   (princ)
) ;_  end defun

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