MarcoW 发表于 2022-7-6 11:05:03

Associative hatch in lisp, pos

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)

ronjonp 发表于 2022-7-6 11:58:53

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

fixo 发表于 2022-7-6 12:21:38

Try this out (tested on A2010)

(command "-bhatch" "_AN" "_Y" "_S" (entsel "\nSelect contour >> ") "" "_P" "ANSI32" "" "" "")
 
~'J'~
页: [1]
查看完整版本: Associative hatch in lisp, pos