Message 1 of 16
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to automate for selecting all circles of 5mm dia & delete from entire drawing
Solved! Go to Solution.
I want to automate for selecting all circles of 5mm dia & delete from entire drawing
Solved! Go to Solution.
Qselect is not working for this even try to record macros...
Please if anybody can provide me the solution for this
Hi,
if you drawing is drawn 1unit=1mm, this is a simple statement to erase all 5diam circles on non-locked Layers in the current space only.
Command: (if (setq ss (ssget "_X" (list'(0 . "CIRCLE")'(40 . 2.5)(cons 410 (getvar 'CTAB)))))(command "_.erase" "_p" ""))
Sebastian
Great ...
Thanks a lot... Its working perfectly... 🙂
Can I make a shortcut key for the same as this is too repeated work... I added ZOMM all also to this one & now if you can provide to make macros for this one, please ...
(command "_.zoom" "_a")(if (setq ss (ssget "_X" (list'(0 . "CIRCLE")'(40 . 3.5)(cons 410 (getvar 'CTAB)))))(command "_.erase" "_p" ""))
Hi
we changed from 5.0 to 7.0 ? okay
>" if you can provide to make macros for this one, please ..."
Macro? You can add the line in macros, so what is the problem?
Create a Command-Tool in your Toolpalette or any other Button for Toolbars, menus or Ribbon and add the line. ^C^C^C(command "_.zoom" "_a");(if (setq ss (ssget "_X" (list'(0 . "CIRCLE")'(40 . 3.5)(cons 410 (getvar 'CTAB)))))(command "_.erase" "_p" ""))
>"Can I make a shortcut key"
Shortcut are defined in you CUI
but I can offer edited lines, so after load a new command is available: DelAll7diaCircles
(defun c:DelAll7diaCircles nil
(command "_.zoom" "_a")
(if (setq ss (ssget "_X" (list'(0 . "CIRCLE")'(40 . 3.5)(cons 410 (getvar 'CTAB)))))(command "_.erase" "_p" ""))
(princ)
)
Sebastian
@sanjayph1111 wrote:
Qselect is not working for this ....
I'm curious about that -- it should work. Could you be doing something like giving it a radius where you should be giving it a diameter?
Also, suggestions so far work to remove Circles in only the current space, because the Erase command in an AutoLisp (command) function with object selection can "see" only those. It would not be difficult to write something to remove them from all spaces in the drawing, if you need that.
I created shortcut Key also for the same. But the issue is that for some files it works & not all. I checked the dimensions as you can find in attached screenshots...
Why this may happen & how to resolve it.
Find DXF File as well
Your white circle isn't exactly 7, it's 6.99998600 (set LUPREC variable to 8 and see)
When I edit the property to 7 and run the command it works fine.
Here's Cadffm's command updated to give some tolerance: (0.01)
(command "_.zoom" "_a") (if (setq ss (ssget "_X" (list '(0 . "CIRCLE") (cons 410 (getvar 'CTAB))))) (foreach e (vl-remove-if-not '(lambda (x) (<= (abs (- (cdr (assoc 40 (entget x))) 3.5)) 0.01)) (mapcar 'cadr (ssnamex ss))) (entdel e)))
Please find reference attached AutoCAD DXF file, so that you can find the issue in this...
Perfect...
It's now working to delete all 7mm dia circles...
Thanks a lot... 🙂
The previous code deletes all 7units dia circles,
tha last code delete all 7units dia circles and circle with dia near to 7units.
Sebastian
The code *was* working, your circles were not exactly 7mm..