TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Birdy on May 26, 2006, 12:57:15 PM
-
Allright. This is buggin the heck out of me and (embarrassed) I could use another set of eyes here.
I have this simple lisp to hatch objects, and trying to modify it to go to hatch layer, do it's stuff, and then return to the previous layer.
(defun c:laych (/ CL)
(setvar "cmdecho" 0)
(command "Clayer" "HATCH")
(command "-HATCH" "s" pause "" "") ;<--- (pebkac..or here...?)
(setvar "cmdecho" 1)
(command "layerp")
(princ)
)
Problem is I can't get it to work for other than a "select object" option. It'd be nice to be able to have it work with
-pick an object (single)
-pick internal point
-selection set of objects
I also tried this with a
(setq CL (gervar "clayer"))
.
.
.
(setvar "clayer" CL)
combo, with no luck (thus the "(/CL)" still hangin around.)
TIA :)
-
Try this.
(defun c:laych (/ clay)
(setq clay (getvar "clayer"))
(setvar "clayer" "Hatch")
(initdia)
(command "_.hatch")
(while (not (equal (getvar "cmdactive") 0))
(command pause)
)
(setvar "clayer" clay)
(princ)
)
-
A super simple way, not fully tested, could be:
(defun C:TST ()
(setq lp (getvar "clayer"))
(prompt "\nSelect internal point: ")
(bhatch)
(while (eq 1 (logand 1 (getvar "cmdactive")))
(command pause))
(if (tblsearch "layer" "A-HATCH")
(command "_.chprop" "_last" "" "_layer" "A-HATCH" ""))
(if lp
(setvar "clayer" lp))
(princ))
-
Thanks both of you. I'll play around a little.
I would like to run this w/o dialog.
(defun c:laych (/ clay)
(setq clay (getvar "clayer"))
(setvar "clayer" "Hatch")
;(initdia)
(command "_.hatch" "" "" "")
(while (not (equal (getvar "cmdactive") 0))
(command pause)
)
(setvar "clayer" clay)
(princ)
)
so I kinda modded it to accept default pattern, scale, etc.
Will look at your method Robert. Thanks :)