Jump to content

Draw shape, and have it automatically hatched


gazzalp

Recommended Posts

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?

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

Thanks BigAl, Half way there to what I wanted :) A 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?

Link to comment
Share on other sites

If you do some searching into retrieving the layer table then you can do both what you want check it exists or 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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...