gazzalp 发表于 2022-7-6 23:43:31

Draw shape, and have it automa

Hi all, I was wondering if someone has a script that does the following:
 
 
I want to be able to draw a column or wall in plan (rectangle, square or circular) and have the column or wall automatically hatched, with two different hatches on two different layers (one will be a solid hatch to denote this is a support on the floor over, and one will be a cross hatch to denote it occurs on the current floor)
 
 
Can anyone help me out please?

BIGAL 发表于 2022-7-7 00:11:38

This will do two in one pick you can add it to another command that you have created but it can not be say random pline then auto hatch, the other method is to pick object then hatch twice.
 

(defun c:BHH ( / pt)(setq pt (getpoint "\nPick internal point"))(setvar "hpname" "ansi31")(setvar "hpscale" 1.0)(setvar "clayer" "layer1")(command "-bhatch" pt "")(setvar "clayer" "layer2")(setvar "hpname" "ansi32")(setvar "hpscale" 2.0)(command "-bhatch" pt ""))(c:BHH)(defun c:BHO ( / obj)(setq obj entlast) ; must be used after drawing object else will hatch wrong object use entsel for any time.(setvar "hpname" "ansi31")(setvar "hpscale" 1.0)(setvar "clayer" "layer1")(command "-hatch" "S" obj "" "")(setvar "clayer" "layer2")(setvar "hpname" "ansi32")(setvar "hpscale" 2.0)(command "-hatch" "s" obj "" ""))(c:BHO)

gazzalp 发表于 2022-7-7 00:29:39

Thanks BigAl, Half way there to what I wantedA couple of items that might help me further (if I can't get the hatch to appear after drawing a shape). For this lisp to work, I need to have the two layers that the hatch are to appear on already in the drawing. Is it possible for the lisp to create the layers if they are not already present in the drawing? Currently the code puts the hatches on "layer1" and "layer2" however if they are not already in the drawing, the lisp doesn't work.
 
 
And something even harder, can the lisp read what layer I currently have active, and then create a layer named similar to what I have active? For example, if my current layer name = Col Level 1, then one hatch will create a layer called Col Level 1 Hatch over, and the other hatch will create a layer called Col Level 1 Hatch Under?

BIGAL 发表于 2022-7-7 01:01:10

If you do some searching into retrieving the layer table then you can do both what you want check it existsor create a layer based on current layer name which is the variable CLAYER.
 
If you write your own draw a shape command then hatch can appear twice.
页: [1]
查看完整版本: Draw shape, and have it automa