Macro for centerline
Macro for centerline
(OP)
Hi, does anyone have, or know how to create macro to convert single line to centerline of a circle with a single click?
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
|
RE: Macro for centerline
do you want to change the linetype?
Lothar
ADT 2004
RE: Macro for centerline
Thanks
RE: Macro for centerline
I know a lisp, called "k+r".
http://ww3
L.
ADT 2004
RE: Macro for centerline
Thanks
RE: Macro for centerline
How to create LSP file?
RE: Macro for centerline
Only two words:
"Linie wählen" -> "select line"
ADT 2004
RE: Macro for centerline
RE: Macro for centerline
(defun clerr (s)
(if (/= s "Function cancelled") ; If an error (such as CTRL-C) occurs
(princ (strcat "\nError: " s)) ; while this command is active...
)
(if e (redraw e 4))
(command "_.UCS" "_P") ; Restore previous UCS
(setvar "BLIPMODE" sblip) ; Restore saved modes
(setvar "GRIDMODE" sgrid)
(setvar "HIGHLIGHT" shl)
(setvar "UCSFOLLOW" sucsf)
(command "_.UNDO" "_E")
(setvar "CMDECHO" scmde)
(setq *error* olderr) ; Restore old *error* handler
(princ)
)
;;; --------------------------- Main Program ---------------------------------;
(setq olderr *error*
*error* clerr)
(setq scmde (getvar "CMDECHO"))
(command "_.UNDO" "_GROUP")
(setq clay (getvar "CLAYER"))
(setq sblip (getvar "BLIPMODE"))
(setq sgrid (getvar "GRIDMODE"))
(setq shl (getvar "HIGHLIGHT"))
(setq sucsf (getvar "UCSFOLLOW"))
(setvar "CMDECHO" 0)
(setvar "GRIDMODE" 0)
(setvar "UCSFOLLOW" 0)
(setq e nil)
(progn
(while (null e)
(setq e (entsel "\nSelect arc or circle: "))
(if e
(progn
(setq e (car e))
(if (and (/= (cdr (assoc 0 (entget e))) "ARC")
(/= (cdr (assoc 0 (entget e))) "CIRCLE")
)
(progn
(prompt "\nEntity is a ")
(princ (cdr (assoc 0 (entget e))))
(setq e nil)
)
)
(if e (redraw e 3))
)
)
(command "_.UCS" "_E" e)
(setq cen (trans (cdr (assoc 10 (entget e))) e 1))
(setq rad (cdr (assoc 40 (entget e))))
(prompt "\nRadius is ")
(princ (rtos rad))
(initget 7 "Length")
(setq d (getdist "\nLength/<Extension>: "))
(if (= d "Length")
(progn
(initget 7)
(setq d (getdist cen "\nLength: "))
)
(setq d (+ rad d))
)
(setvar "BLIPMODE" 0)
(setvar "HIGHLIGHT" 0)
; (command "_.LAYER" "_M" "CL" "")
(command "_.LINE" (list (car cen) (- (cadr cen) d) (caddr cen))
(list (car cen) (+ (cadr cen) d) (caddr cen)) ""
)
(command "_.CHANGE" "_L" "" "_P" "_LT" "CENTER" "")
(command "_.LINE" (list (- (car cen) d) (cadr cen) (caddr cen))
(list (+ (car cen) d) (cadr cen) (caddr cen)) ""
)
(command "_.CHANGE" "_L" "" "_P" "_LT" "CENTER" "")
)
)
(redraw e 4)
(command "_.UCS" "_P") ; Restore previous UCS
(setvar "BLIPMODE" sblip) ; Restore saved modes
(setvar "GRIDMODE" sgrid)
(setvar "HIGHLIGHT" shl)
(setvar "UCSFOLLOW" sucsf)
(command "_.UNDO" "_E")
(setvar "CMDECHO" scmde)
(setq *error* olderr) ; Restore old *error* handler
(princ)
RE: Macro for centerline
RE: Macro for centerline
And if I type (Load"CL") this in acad's command line I get this as an answer:
Error: LOAD failed: "cl"
No previous coordinate system saved.
; error: An error has occurred inside the *error* functionFunction cancelled
Is there any help? Function is very good I would realy like to use it.
I dont know but I think that there is a mistake in the first row of a code: defun clerr
and because of that i can't recall function again.
Looking at the other lisp files I saw that the definition of function is like this:
defun c:ba
Thanks anyway
RE: Macro for centerline
I have other macros that I'm using and I'm using them through icons on my customized toolbar. I put them all to the load application startup suite and they are allways on.
But this function (that is the most important to me) won't work.
RE: Macro for centerline
I need all to be "BY LAYER", but this code change linetype in CENTER.
RE: Macro for centerline
(command "_.CHANGE" "_L" "" "_P" "_LT" "CENTER" "")
to
(command "_.CHANGE" "_L" "" "_P" "_LT" "BYLAYER" "")
____________________
Acad2006, Terramodel
RE: Macro for centerline
Is there any help for this?
Thanks.
RE: Macro for centerline
(defun c:cl ()
and this as the very last line
);defun c:cl
save, reload the application, type cl to use the application
____________________
Acad2006, Terramodel
RE: Macro for centerline
Thanks a lot.
RE: Macro for centerline