I have a command in visual lisp that make some complex drawings, and also some hatches. The problem is the hatch is being draw many times in the same object for some reason.
This are the lines i'm using to draw the hatch and to change the global variables i want to change to make different hatches. (i also will put the lisp file but it's big)
Solved! Go to Solution.
Solved by jdtabaress. Go to Solution.
Solved by komondormrex. Go to Solution.
Not sure about this (command "._hatch" "s" "p" p7 p9 p11 "" "") do -hatch and watch prompts when you do "s" it asks for select entities, so "P" may be previous which would explain why your getting multiples. Remove it and try.
NOT TESTED.
if you are going to hatch every rectangle drawn by points calculated, you can define a function to hatch the last drawn entity and use it instead. see attachment.
That's a really good solution, but i wonder if i can make sure that all the hatches are solid, for some reason that is not happening when i execute the function, and also the hatches are being created on the same layer than the polylines 😞
replace
previous function definition
(defun last_rect_hatch nil
(command "_-hatch" "_p" "_s" "_s" "_l" "" "")
(entmod (append (entget (entlast)) '((8 . "40_HS_SECCIONES_SOLIDO"))))
)
with this new
(defun last_rect_hatch nil
(command "_-hatch" "_p" "_s" "_s" "_l" "" "")
(entmod (append (entget (entlast)) '((8 . "40_HS_SECCIONES_SOLIDO"))))
)
That worked, but for some reason the layer keep being the layer from the last entity
Probably is because i'm currently using Gstarcad instead of Autocad, usually it's all the same.
The way i solved it is by using the function like this. I am grateful for your help.
U
(command "._layer" "M" current-layer "")
(setq current-layer (getvar "CLAYER")) ; GET at start of code
(setvar 'clayer current-layer) ; PUT at end of code
se setvar opposite of getvar
Can't find what you're looking for? Ask the community or share your knowledge.