spencer.67965
2006-01-10, 11:17 PM
Since I switched to ADT 2006 I have noticed a slow down in my lisp routines that work great in AutoCAD 2005.
Here is the code and below is an example what it does in the AutoCAD Text Window.
Any help would be nice.
Thanks
;Shear-Wall Hold-Down "A" "SW1"
(Defun c:dda1 (/ msg os cl style P1 P2 P3 angs ang c1 c2 t1 t2 cc1 cc2 tt1 tt2 lay add s1 s2 s3 *error*)
;Begin Undo Mark
(command "undo" "begin" "")
;Begin Error handleing
(defun *error* (msg)
(princ "error: ")
(princ msg)
(command "osmode" os)
(command "clayer" cl)(TERPRI)
(command "textstyle" style)(TERPRI)
(PRINC "LAYERS, TEXT STYLE, AND OSNAPS RETURNED TO ORIGIONAL SETTINGS.")(TERPRI)
(princ)
(command "undo" "end" "")
(command "undo" "1")
(PRINC "ROUTINE TERMINATED.")(TERPRI)
(exit)
)
;DEGREES TO RADIANS PROGRAM
(DEFUN DTR (A)(* pi ( / A 180.0)))
;END DEGREES TO RADIANS
;RADIANS TO DEGREES PROGRAM
(DEFUN RTD (A)(/ (* A 180.0) pi))
;END RADIANS TO DEGREES PROGRAM
;SAVE CURRENT LAYER AND OSNAP VALUES
(setq cl (getvar "clayer"))
(setq os (getvar "osmode"))
(setq style (getvar "textstyle"))
;END SAVE CURRENT LAYER AND OSNAP VALUES
;LAYERS SETUP
(command "clayer" "ACUTEENG")
;ENDLAYER SETUP
;BEGIN USER INPUT
(command "osmode" "1")(terpri)
(setq p1 (getpoint "FIRST CORNER (P1): "))(terpri)
(setq p2 (getpoint "SECOND CORNER (P2): "))(terpri)
(command "osmode" "514")(terpri)
(setq p3 (getpoint "INSERTION POINT (P3): "))(terpri)
;END USER INPUT
;Begin Hold-Down Section
(command "osmode" "0")
(setq angs (angle p1 p2))
(setq ang (- angs (DTR 90)))
(setq c1 (polar p1 ang 8.0))
(setq c2 (polar p1 ang 12.0))
(setq t1 (polar c2 angs 6.0))
(setq t2 (polar c2 angs -6.0))
(setq cc1 (polar p2 ang 8.0))
(setq cc2 (polar p2 ang 12.0))
(setq tt1 (polar cc2 angs 6.0))
(setq tt2 (polar cc2 angs -6.0))
(setq lay (getvar "clayer"))
(setq add 180)
(IF (AND (<= angs (dtr 270)) (> angs (dtr 90))) (setq add 0))
(command "osmode" 0)
(command "clayer" "acuteeng")
(command "pline" p1 t1 t2 "c")
(command "pline" p2 tt1 tt2 "c")
(command "textstyle" "swacute" "")
(command "text" "j" "mc" c1 (+ add (rtd (- ang (dtr 90)))) "A" "")
(command "text" "j" "mc" cc1 (+ add (rtd (- ang (dtr 90)))) "A" "")
;End Hold-Down Section
;Begin Shear-Wall Section
(setq s1 (polar p3 ang 12.0))
(setq s2 (polar p3 ang 18.0))
(setq s3 (polar S1 angs 12.0))
(setq add 0)
(IF (AND (<= angs (dtr 270)) (> angs (dtr 90))) (setq add 180))
(command "osmode" 0)
(command "clayer" "acuteeng")
(command "ellipse" "c" s1 s3 s2)
(command "textstyle" "swacute" "")
(command "text" "j" "mc" s1 (+ add (rtd angs)) "SW1" "" "")
;End Shear-Wall Section
;RETURN OSNAPS AND LAYER TO NORMAL END PROGRAM
(command "osmode" os)
(command "clayer" cl)(TERPRI)
(command "textstyle" style)(TERPRI)
(PRINC "LAYERS, TEXT STYLE, AND OSNAPS RETURNED TO ORIGIONAL SETTINGS.")(TERPRI)
(PRINC "SHEAR WALL FINISHED.")(TERPRI)(princ)
(command "undo" "end" "")(princ)
;OSNAPS AND LAYER AND RETURNED TO NORMAL
)
;END Shear-Wall Hold-Down "A" "SW1"
AutoCAD Text Window Output
Command: DDA1 Unknown command "DDA1". Press F1 for help.
FIRST CORNER (P1): SECOND CORNER (P2): INSERTION POINT (P3): Unknown command
"DDA1". Press F1 for help.
Unknown command "DDA1". Press F1 for help.
Unknown command "DDA1". Press F1 for help.
Unknown command "DDA1". Press F1 for help.
Unknown command "DDA1". Press F1 for help.
Unknown command "DDA1". Press F1 for help.
LAYERS, TEXT STYLE, AND OSNAPS RETURNED TO ORIGIONAL SETTINGS.
SHEAR WALL FINISHED.
Unknown command "DDA1". Press F1 for help.
nil
Here is the code and below is an example what it does in the AutoCAD Text Window.
Any help would be nice.
Thanks
;Shear-Wall Hold-Down "A" "SW1"
(Defun c:dda1 (/ msg os cl style P1 P2 P3 angs ang c1 c2 t1 t2 cc1 cc2 tt1 tt2 lay add s1 s2 s3 *error*)
;Begin Undo Mark
(command "undo" "begin" "")
;Begin Error handleing
(defun *error* (msg)
(princ "error: ")
(princ msg)
(command "osmode" os)
(command "clayer" cl)(TERPRI)
(command "textstyle" style)(TERPRI)
(PRINC "LAYERS, TEXT STYLE, AND OSNAPS RETURNED TO ORIGIONAL SETTINGS.")(TERPRI)
(princ)
(command "undo" "end" "")
(command "undo" "1")
(PRINC "ROUTINE TERMINATED.")(TERPRI)
(exit)
)
;DEGREES TO RADIANS PROGRAM
(DEFUN DTR (A)(* pi ( / A 180.0)))
;END DEGREES TO RADIANS
;RADIANS TO DEGREES PROGRAM
(DEFUN RTD (A)(/ (* A 180.0) pi))
;END RADIANS TO DEGREES PROGRAM
;SAVE CURRENT LAYER AND OSNAP VALUES
(setq cl (getvar "clayer"))
(setq os (getvar "osmode"))
(setq style (getvar "textstyle"))
;END SAVE CURRENT LAYER AND OSNAP VALUES
;LAYERS SETUP
(command "clayer" "ACUTEENG")
;ENDLAYER SETUP
;BEGIN USER INPUT
(command "osmode" "1")(terpri)
(setq p1 (getpoint "FIRST CORNER (P1): "))(terpri)
(setq p2 (getpoint "SECOND CORNER (P2): "))(terpri)
(command "osmode" "514")(terpri)
(setq p3 (getpoint "INSERTION POINT (P3): "))(terpri)
;END USER INPUT
;Begin Hold-Down Section
(command "osmode" "0")
(setq angs (angle p1 p2))
(setq ang (- angs (DTR 90)))
(setq c1 (polar p1 ang 8.0))
(setq c2 (polar p1 ang 12.0))
(setq t1 (polar c2 angs 6.0))
(setq t2 (polar c2 angs -6.0))
(setq cc1 (polar p2 ang 8.0))
(setq cc2 (polar p2 ang 12.0))
(setq tt1 (polar cc2 angs 6.0))
(setq tt2 (polar cc2 angs -6.0))
(setq lay (getvar "clayer"))
(setq add 180)
(IF (AND (<= angs (dtr 270)) (> angs (dtr 90))) (setq add 0))
(command "osmode" 0)
(command "clayer" "acuteeng")
(command "pline" p1 t1 t2 "c")
(command "pline" p2 tt1 tt2 "c")
(command "textstyle" "swacute" "")
(command "text" "j" "mc" c1 (+ add (rtd (- ang (dtr 90)))) "A" "")
(command "text" "j" "mc" cc1 (+ add (rtd (- ang (dtr 90)))) "A" "")
;End Hold-Down Section
;Begin Shear-Wall Section
(setq s1 (polar p3 ang 12.0))
(setq s2 (polar p3 ang 18.0))
(setq s3 (polar S1 angs 12.0))
(setq add 0)
(IF (AND (<= angs (dtr 270)) (> angs (dtr 90))) (setq add 180))
(command "osmode" 0)
(command "clayer" "acuteeng")
(command "ellipse" "c" s1 s3 s2)
(command "textstyle" "swacute" "")
(command "text" "j" "mc" s1 (+ add (rtd angs)) "SW1" "" "")
;End Shear-Wall Section
;RETURN OSNAPS AND LAYER TO NORMAL END PROGRAM
(command "osmode" os)
(command "clayer" cl)(TERPRI)
(command "textstyle" style)(TERPRI)
(PRINC "LAYERS, TEXT STYLE, AND OSNAPS RETURNED TO ORIGIONAL SETTINGS.")(TERPRI)
(PRINC "SHEAR WALL FINISHED.")(TERPRI)(princ)
(command "undo" "end" "")(princ)
;OSNAPS AND LAYER AND RETURNED TO NORMAL
)
;END Shear-Wall Hold-Down "A" "SW1"
AutoCAD Text Window Output
Command: DDA1 Unknown command "DDA1". Press F1 for help.
FIRST CORNER (P1): SECOND CORNER (P2): INSERTION POINT (P3): Unknown command
"DDA1". Press F1 for help.
Unknown command "DDA1". Press F1 for help.
Unknown command "DDA1". Press F1 for help.
Unknown command "DDA1". Press F1 for help.
Unknown command "DDA1". Press F1 for help.
Unknown command "DDA1". Press F1 for help.
LAYERS, TEXT STYLE, AND OSNAPS RETURNED TO ORIGIONAL SETTINGS.
SHEAR WALL FINISHED.
Unknown command "DDA1". Press F1 for help.
nil