Jump to content

Auto hatch after closing a polyline


Recommended Posts

Hi,

 

 

Is is possible to hatch a box automatically when using PL. I want to be able to trace around an object and soon as I close the PL it will hatch.

 

 

 

 

all help appreciated,

 

 

 

 

Keith

Link to comment
Share on other sites

Easy done via lisp

 

; create pline by picking points press enter when finished
(command "_pline")
(while (= (getvar "cmdactive") 1 ) (command pause)
)
(command "-hatch" "S" "L" "" "") ;do stuff here like pattern rotation scale

Link to comment
Share on other sites

Thanks BIGAL

 

 

Just a little lost how to enter the code...

 

So a more turn key solution would look something like this, using ANSI31 pattern, at scale 10.5, rotation 0.

 

(defun c:polyhat ()
 ; create pline by picking points press enter when finished
 (command "_pline")
 (while (= (getvar "cmdactive") 1 )
   (command pause)
 )
 (command "-hatch" "S" "L" "" "_P" "ANSI31" "10.5" "0.0" "")
)

 

  1. Save that code into a file using NOTEPAD.
  2. Name the file POLYHAT.LSP (make sure to enclose the file name in quotes when saving so that it won't append the "TXT" file extension)
  3. Drag+drop the file into the AutoCAD editor.
  4. (It may complain about the location of the file not being secure - see this for more info)
  5. Type in the command POLYHAT.
  6. Start creating...

Link to comment
Share on other sites

  • 9 months later...

Hi rkmcswain,

 

I'm looking for this function. But, i want integrate it in a macro in my tool palette, without call LISP or other macro.

 

pline command, worked. hatch command on the last object, worked. But, the second function after the first, in same time, with cmdactive variable doesn't work ...

 

Have u an issue ? (In LISP case, the function is perfect)

Link to comment
Share on other sites

If you just want a hatch button in the tool palette, then forget about lisp, macros, and everything else.

Just create a hatch object in a drawing, set the properties like you want, then drag and drop this hatch object into the tool palette.

From that point on, you can create that hatch using the new tool palette button - no programming needed.

Link to comment
Share on other sites

I want to do the same thing that BIGAL. Draw a pline and "autohatch" it.

 

Except that I want to find the synthax to integrate it in my macro field. That's possible ?

Link to comment
Share on other sites

A couple of ways copy the code to the file acaddoc.lsp it will then auto load it for you then just type polyhat, or you can edit the tool palette to ^c^cpolyhat or ^c^c(load "polyhat")(command "polyhat")

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...