Attribute Definition with multiple lines damaged my lisp

Attribute Definition with multiple lines damaged my lisp

Anonymous
Not applicable
664 Views
0 Replies
Message 1 of 1

Attribute Definition with multiple lines damaged my lisp

Anonymous
Not applicable

Hi everyone,

Can anyone please help me with a lisp that I have to insert altimetric cotes in autocad. The thing is that I changed the attribut definition "COTA" to multiple lines, and now when I run the lisp it opens a window expecting for more data (I think). I just did that to put the background mask behind the atribute. The lisp inserts a block "OA4-COTA-1" where is placed that atribute definition. The lisp is placed above. Thanks for advance.

 

Global Variables             

CA_DrwScl - Drawing Scale
CA_PltScl - Plot Scale
CA_Precis - Precision
CA_UCS    - UCS
CA_Side   - Side

-Functions              

CA_VarSys (arg)       - Declaration of System Variables
CA_GetVar (arg / var txt tmp)     - Get Variables
CA_TxtMnu (arg)       - Get Menu Text
CA_InsPnt (arg / txt tmp osm)     - Insert Point
c:CA (/ cmd dmz att und red undlst redlst pntnum pntlst) - Main


|;


(defun CA_VarSys (arg) ;- Declaration of System Variables        
  (cond
    ((= arg "set")
     (setq cmd (getvar "cmdecho") dmz (getvar "dimzin") att (getvar "attdia"))
     (setvar "cmdecho" 0)
     (setvar "dimzin" 0)
     (setvar "attdia" 0))
    ((= arg "reset")
     (setvar "cmdecho" cmd)
     (setvar "dimzin" dmz)
     (setvar "attdia" att)))
  (princ))


(defun CA_GetVar (arg / var txt tmp) ;- Get Variables         
  (cond
    ((= arg "scales")
     (setvar "dimzin" 8)
     (setq tmp CA_DrwScl)
     (if (< CA_DrwScl 1)
       (setq txt (strcat "1m/" (rtos (/ 1.0  CA_DrwScl) 2 3) "Un>: 1:"))
       (setq txt (strcat (rtos CA_DrwScl 2 3) "m/Un>: 1:")))
     (initget (+ 2 4))
     (if (setq var (getint (strcat "\nSpecify CAD drawing scale <1:" (rtos (* CA_DrwScl 100) 2 2) "=" txt)))
       (setq CA_DrwScl (/ var 100.0)))
     (if (< (* CA_PltScl tmp) 1)
       (setq txt (strcat "1m/" (rtos (/ 1.0  (* CA_PltScl tmp)) 2 3) "cm>: 1:"))
       (setq txt (strcat (rtos (* CA_PltScl tmp) 2 3) "m/cm>: 1:")))
     (initget (+ 2 4))
     (if (setq var (getint (strcat "\nSpecify final plotted drawing scale <1:" (rtos (* CA_PltScl tmp 100) 2 2) "=" txt)))
       (setq CA_PltScl (* (/ var 100.0) (/ 1 CA_DrwScl)))
       (setq CA_PltScl (* (/ (* CA_PltScl tmp 100) 100.0) (/ 1 CA_DrwScl))))
     (setvar "dimzin" 0))   
    ((= arg "precision")
     (initget 4)
     (if (setq var (getint (strcat "\nSet coordinates precision to <" (itoa CA_Precis) ">: ")))
       (setq CA_Precis var)))
    ((= arg "ucs")
     (if (and (setq var (getpoint (CA_TxtMnu "ucsa"))) (/= var "cancel") (/= var "origin"))
       (if (setq tmp (getreal (CA_TxtMnu "ucsb")))
  (if (/= tmp "cancel")
    (if (/= tmp "origin")
      (setq CA_UCS (list (car var) (- (cadr var) (/ tmp CA_DrwScl))))
      (setq CA_UCS (list (car var) (cadr var)))))
  (setq CA_UCS (list (car var) (cadr var))))
       (if (= var "origin")
  (setq CA_UCS (list 0.0 0.0)))))))

(defun CA_TxtMnu (arg) ;- Get Menu Text
  (cond
    ((= arg "point")
     (initget "Scales Precision Ucs _scales precision ucs")
     (strcat "\nSpecify point or [Scales/Precision/UCS]: "))
    ((= arg "ucsa")
     (initget "Origin Cancel _origin cancel")
     (strcat "\nSpecify a knowed point [Origin/Cancel] <Cancel>: "))
    ((= arg "ucsb")
     (initget "Origin Cancel _origin cancel")
     (strcat "\nSpecify the Altimetric Coordinate [Origin/Cancel] <Origin>: "))))

(defun CA_InsPnt (arg / pnt tmp osm) ;- Insert Point
 (setq osm (getvar "osmode"))
 (setvar "osmode" 0)
 (setq pnt (rtos (* (- (cadr arg) (cadr CA_UCS)) CA_DrwScl) 2 CA_Precis))
 (vl-cmdf "insert" "OA4-COTA-1" arg CA_PltScl "" pnt)
 (setvar "osmode" osm))
 
(defun c:CA (/ pnt)
  (CA_VarSys "set")
  (cond
    ((not CA_DrwScl)
     (setq CA_DrwScl 1.0 CA_PltScl 1.0 CA_Precis 2 CA_UCS (list 0.0 0.0) CA_Side "right")
     (command "insert" "OA4-COTA" 0,0,0)
     (CA_GetVar "scales")
     (CA_GetVar "precision")))
  (princ (strcat "\nDrawing scale <1:" (rtos (* CA_DrwScl 100) 2 0)
   ">, Plotted scale <1:" (rtos (* CA_PltScl CA_DrwScl 100) 2 0)
   ">, Precision <" (itoa CA_Precis)
   ">, UCS <y=" (rtos (cadr CA_UCS) 2 CA_Precis) ">"))
  (while (setq pnt (getpoint (CA_TxtMnu "point")))
    (cond
      ((or (= pnt "precision")(= pnt "scales")(= pnt "ucs"))
       (CA_GetVar pnt))
      (T (CA_InsPnt pnt))))
  (CA_VarSys "reset")
  (princ))

0 Likes
665 Views
0 Replies
Replies (0)