I have a drawing with many "holes"(circles) in hatch and now I need to move all circles in a different places. After moving i have a boundaries remains in a hatch..
to remove it i use this little lisp:
(defun C:HR(/ gp) (setq gp (ssget))(command "-hatchedit" gp "r" ));remove boundary from hatch
but I have a problem when I need to select boundaries one by one..
Is it possible to select ALL boundaries in a one click in order to remove it?
Any help will be very appretiated
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Solved by hmsilva. Go to Solution.
@apelbaum2014 wrote:
I have a drawing with many "holes"(circles) in hatch and now I need to move all circles in a different places. After moving i have a boundaries remains in a hatch..
to remove it i use this little lisp:
(defun C:HR(/ gp) (setq gp (ssget))(command "-hatchedit" gp "r" ));remove boundary from hatch
but I have a problem when I need to select boundaries one by one..
Is it possible to select ALL boundaries in a one click in order to remove it?
Any help will be very appretiated
Hi apelbaum2014!
This is quick and dirty, and minimally tested, but it may get you started, and it will fail if outer boundary is also a CIRCLE.
I have a deadline to meet, so at the moment, I don't have much free time...
(vl-load-com) (defun c:MHR (/ cen circle circles ent hnd i rad ss) (cond ((setq ss (ssget "_X" (list '(0 . "HATCH") (cons 410 (getvar 'ctab))))) (command "_.undo" "_G" "_.zoom" "_O" ss "") (repeat (setq i (sslength ss)) (setq hnd (ssname ss (setq i (1- i))) ent (entget hnd) circles (vl-remove-if-not '(lambda (a) (and (= (car a) 330) (= (cdr (assoc 0 (entget (cdr a)))) "CIRCLE") ) ) ent ) ) (cond (circles (command "-hatchedit" hnd "r") (foreach x circles (setq circle (entget (cdr x)) cen (cdr (assoc 10 circle)) rad (cdr (assoc 40 circle)) ) (command (list (+ rad (car cen)) (cadr cen))) ) (command "") ) ) ) (command "_.zoom" "_P" "_.undo" "_E") ) (T (prompt "\Could not find any hatches... ") ) ) (princ) ) ;remove circle boundaries from hatch
Hope this helps,
Henrique
Hi Henrique!
Thank you for the quick answer.
Unfortunaly, I don't now why, but I don't see any changes in my drawing after invoking MHR function. I mean hatch boundaries in circle form remanins in the drawing..
@apelbaum2014 wrote:
Hi Henrique!
Thank you for the quick answer.
Unfortunaly, I don't now why, but I don't see any changes in my drawing after invoking MHR function. I mean hatch boundaries in circle form remanins in the drawing..
Hi apelbaum2014
Could you please post a sample dwg, with a before & after?
Henrique
Remarks removed after reinspecting...
@apelbaum2014 wrote:
this is sample dwg. i work on acad 2013 sp3
Sorry apelbaum2014,
but as I had already said, I have a deadline to meet, so at the moment, I don't have much free time....
Attached is a dwg where I tested the code with no problem...
When I have some spare time, I'll see what I can do.
Henrique
@apelbaum2014 wrote:
Thank you anyway Henrique.
It's intresting, but on your file MHR function works perfect and in a same time on my dwg not working at all...
You're welcome, apelbaum2014
Another approach...Quick and dirty...
(defun c:MHR (/ cen cir i rad ss ss1) (cond ((and (princ "\nSelect hatch: ") (setq ss (ssget "_+.:E:S:L" '((0 . "HATCH") (-4 . ">") (91 . 1)))) (princ "\nSelect CIRCLE boundaries to remove: ") (setq ss1 (ssget '((0 . "CIRCLE")))) ) (command "_.undo" "_G" "_.zoom" "_O" ss "" "_.ucs" "_W") (command "-hatchedit" (ssname ss 0) "r") (repeat (setq i (sslength ss1)) (setq cir (entget (ssname ss1 (setq i (1- i)))) cen (cdr (assoc 10 cir)) rad (cdr (assoc 40 cir)) ) (command (list (+ rad (car cen)) (cadr cen))) ) (command "") (command "_.zoom" "_P" "_.ucs" "_P" "_.undo" "_E") ) ) (princ) ) ;remove boundary from hatch
Henrique
@apelbaum2014 wrote:
Now it's works like a charm!
Thank you Henrique!
You're welcome, apelbaum2014
Glad I could help
Henrique
...a little improvment
(setq ss1 (ssget '((0 . "CIRCLE,LWPOLYLINE,SPLINE"))))
and Henrique's program now can works with almost all entities as hatch boundaries