Author Topic: dad blasted hatch routine!  (Read 1807 times)

0 Members and 1 Guest are viewing this topic.

Birdy

  • Guest
dad blasted hatch routine!
« 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.


Code: [Select]
(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
Code: [Select]
(setq CL (gervar "clayer"))
.
.
.
(setvar "clayer" CL)
combo, with no luck (thus the "(/CL)" still hangin around.)


TIA :)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: dad blasted hatch routine!
« Reply #1 on: May 26, 2006, 01:22:13 PM »
Try this.
Code: [Select]
(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)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: dad blasted hatch routine!
« Reply #2 on: May 26, 2006, 01:31:29 PM »
A super simple way, not fully tested, could be:

Code: [Select]
(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))

Birdy

  • Guest
Re: dad blasted hatch routine!
« Reply #3 on: May 26, 2006, 01:35:47 PM »
Thanks both of you. I'll play around a little.

I would like to run this w/o dialog.

Quote
(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 :)