Jump to content

Please help! Lisp for Ansi 31 boundary select hatch w/ specified angle & scale


jake77777

Recommended Posts

I do look for answers to these questions a minimum of an hour before I'll post anything. I know I'm up to 3 or 4 today. But or all you code geniuses..your help again..will be greatly be appreciated! (can you blame me..i just discovered lisps and this site today!)

 

But what I was hoping you guys can help me out with was a lisp to select a boundary, then create an ansi 31 hatch, angle 180, and scale of 18 and remove boundary after. Everything would be on by layer or if there needs to be a layer selected it would be STR-TXT. What I've found closest is followed below..It changes the color of the layer to cyan for some reason, it does give the option to remove the boundary but haven't figured how to get it to work..:)..also the scale was much smaller. Thanks for any suggestions!

 

 

(defun c:QH( / cla)

(command "_.-layer" "_N" "STR-TXT" "_M" "STR-TXT" "_C" "_T" "0,179,179" "STR-TXT" "" )

(command "_-color" "bylayer")

 

;(setvar "cmdecho" 0)

;(command "hpgaptol" 05)

;(command "HPNAME" "solid")

;(graphscr)

(command "-hatch" "s" "pause" "")

(setvar "cmdecho" 1)

(princ)

)

Link to comment
Share on other sites

jake77777,

 

I don't understand your purpose, but want to notify you about a mistake in your code. Indeed PAUSE is a variable to send a backslash (in VuisualLISP: "\\") to autocad's command prompt, so the code when invoking "HATCH" command, must be changed to:

(command "-hatch" "s" pause "")

 

Mehrdad

http://www.irancad.com

Link to comment
Share on other sites

This should help you get started...

 

(defun c:QH  (/ eName)
 (if (and (setq eName (car (entsel "\n  >>  Select Polyline Boundary: ")))
          (wcmatch (cadr (assoc 0 (entget eName))) "*POLYLINE"))
   (progn
     [color=seagreen];; ...Add You Code Here[/color]
     (command "._erase" eName "")
   )
 (princ))

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