Jump to content

Associative hatch in lisp, possible?


MarcoW

Recommended Posts

In a routine I have there is a line like this:

 

 
(command "_.hatch" "ANSI32" 50.0 0.0 "_l" "")

 

These hatches stay not associative even though I have set the variable "HPASSOC" to 1. I need them to be associative.

 

So I tried manually on the command bar, how to hatch the last created entity (if hatchable like a rectangle):

 

 
(command "_.hatch" "A" "A" "Yes" "" "P" "ANSI32" 50.0 0.0 "S" "_L" "")

 

But that doesn't seem to work...

Any idea how to make the hatch associative?

 

Thanks in advance for helping me out once again.

 

(ps.: I have been here and that doe not help, it still disfunctions)

Link to comment
Share on other sites

Give this a try:

 

(defun c:hatchit (/ doc e h o)
 (if (and (setq e (car (entsel "\nSelect something to hatch: ")))
   (setq o (vlax-ename->vla-object e))
   (setq doc (vla-get-activedocument (vlax-get-acad-object)))
   (setq h (vlax-invoke
	     (if (= (getvar 'cvport) 1)
	       (vla-get-paperspace doc)
	       (vla-get-modelspace doc)
	     )
	     'addhatch
	     achatchobject
	     (getvar 'hpname)
	     :vlax-true
	   )
   )
   (not	(vl-catch-all-error-p
	  (vl-catch-all-apply 'vlax-invoke (list h 'appendouterloop (list o)))
	)
   )
     )
   (progn (vlax-put h 'patternangle (getvar 'hpang))
   (vlax-put h 'patternscale (getvar 'hpscale))
   (setq e (vlax-vla-object->ename h))
   (entmod (subst (cons 8 (strcat (vla-get-layer o) "-hatch"))
		  (assoc 8 (entget e))
		  (entget e)
	   )
   )
   (vla-evaluate h)
   )
 )
 (princ)
)

Link to comment
Share on other sites

Try this out (tested on A2010)

(command "-bhatch" "_AN" "_Y" "_S" (entsel "\nSelect contour >> ") "" "_P" "ANSI32" "" "" "")

 

~'J'~

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