Jump to content

finding circle multiple diameters


peterklos

Recommended Posts

Hi , I have a half tone picture vector file of 1000's of circles, I need to sort the circles in to groups so I can drill on the CNC machine.

 

Does any one know how I can filter groups in autocad 2005 of the same diameter circles so I can attach only that diameter to a layer, i would then ceate layers of the same size circles and use to drill with the same size drill.

regards peter

Link to comment
Share on other sites

Try this, not extensively tested

(defun c:test (/ old-layer old-cmd diam layname rad rad-dp ss1)
 (setq old-layer (getvar "clayer")
   old-cmd (getvar "cmdecho")
   );setq
 (setvar "cmdecho" 0)
 (setq diam (getreal "Enter diameter :")
   layname (strcat (rtos diam 2 2) "-DIAMETER")
   rad (/ diam 2)
   rad-dp (cons 40 rad)
   ss1 (ssget "x" (list  (cons -4 "<and")(cons 0 "circle") rad-dp (cons -4 "and>")))
     );setq
 (if
   (= ss1 nil)
   (alert "There are no circles with that diameter")
   (progn
    (command "-layer" "m" layname "")
   (command "change" ss1 "" "p" "la" layname "")
     (alert (strcat(rtos (sslength ss1)2 0) " circles have been moved to layer " layname))
     );progn
   );if
    (setvar "clayer" old-layer)
 (setvar "cmdecho" old-cmd)
 (princ)
   );defun

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