Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hatch lisp

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Anonymous
3204 Views, 7 Replies

Hatch lisp

Hi all,

I am trying to write a lisp routine that will make a layer called hatch, set it as current and then run the hatch command.

BUT the hatch command is not bring up the hatch dialogue box, it just puts things on the command line.

The layer is being made & set current.

The lisp is as follows:

(defun c:hh (/ ec)

(setq ec (getvar "cmdecho"))

(setvar "cmdecho" 0)

(command "-layer" "m" "hatch" "c" "8" "" "l" "continuous" "" "s" "hatch" "")

(command "hatch")

(setvar "cmdecho" ec)

)

Any help would be appreciated.

On another matter, I have just found the bevel lisp routine by Terry Miller which works great BUT only for imperial measurements. I would like to know if anyone knows of a similar routine, or how to make Terry's metric, that will work for metric measurements.

Regards

JohnB

7 REPLIES 7
Message 2 of 8
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

....

I am trying to write a lisp routine that will make a layer called hatch, set it as current and then run the hatch command.

BUT the hatch command is not bring up the hatch dialogue box, it just puts things on the command line.

....


Try:

(initdia)

(command "_.bhatch")

Kent Cooper, AIA
Message 3 of 8
Hallex
in reply to: Anonymous

If you want to create hatch without picking

the inner point and change  the hatch properties,

see -hatchedit command, e.g.:

(defun c:hh (/ cts ec ent)

 

(setq ec (getvar "cmdecho"))

 

(setvar "cmdecho" 0)

 

(command "-layer" "m" "hatch" "c" "8" "" "l" "continuous" "" "s" "hatch" "")

 

(setq cts (ssget ":S"    (list      (cons -4 "<or") (cons -4 "<and")(cons 0 "lwpolyline")(cons 70 1)(cons -4 "and>")    

  (cons 0 "circle")  

    (cons -4 "or>")))); <-- chage filter to suit

 

(setq ent (ssname cts 0))      (command "_.-hatch" "_p" "_solid" "_s" ent "" "")

 

(command "_.-hatchedit" "_l" "" "_p" "ansi32" "0.25" "90")

 

(setvar "cmdecho" ec)

 

(princ)

 

)

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 4 of 8
Anonymous
in reply to: Kent1Cooper

Thanks Kent.

I thought I had tried all the combinations of _ - . hatch & bhatch must have missed that one.

Perfect!!!!

Message 5 of 8
scot-65
in reply to: Anonymous

OK, now for your next challenge:

 

In lieu of setting to another layer without user knowledge, and

leaving him on that layer when finished, one can use the

CHPROP "Last" option to direct the newly created object to

the desired layer and everyone will be happy.

 

This will involve the following:

(if not TBLSEARCH "Layer"

   create layer

   thaw or turn on layer

);if

ENTMOD, and SSGET "Last",

or just use CHPROP for these last two.

 

???


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 6 of 8
Anonymous
in reply to: scot-65

Good thinking scott.

I have done that & it works perfectly.

Thanks

JohnB

Message 7 of 8
Anonymous
in reply to: Anonymous

Scot,

Further to your suggestion for the hatch lisp, is there any way for this to happen with dimensions.

At the moment I have the macros set as follows:

^c^c-layer make dim colour 7;-colour bylayer^C^C_dimaligned

This works for placing the dimensions on the dim layer but it would be nice if it would

revert to the previous layer setting

Regards

JohnB

Message 8 of 8
Anonymous
in reply to: Anonymous

where is lisp for hatch  i wand new hatch how save hatch

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report