Jump to content

How to delete slots in dxf?


Recommended Posts

Posted
(defun c:deleteCirclesByDiameter (/ ss diaexception f x )
  (setq f 0.5000)
  (setq x globalCleanedValue)
  (setq ss (ssget "_X" '((0 . "CIRCLE"))))
  (setq diaexception '(0.6875 0.6880))
  (if ss
      (progn
        (prompt (strcat "\nFormatted Value of x: " (rtos x 2 4)))
        (setq index 0)
        (repeat (sslength ss)
          (setq ent (ssname ss index))
          (setq dia (* 2 (cdr (assoc 40 (entget ent)))))
          (if (and (> x f)
                   (> x dia)
                   (not (and (member dia diaexception) (= x 0.75))))
              (progn
                (entdel ent)
                (prompt (strcat "\nDeleted Circle: " (itoa (1+ index))
                                ", Diameter: " (rtos dia 2 4) ", Thickness: " (rtos x 2 4))))
              (prompt (strcat "\nSkipped Circle: " (itoa (1+ index))
                              ", Diameter: " (rtos dia 2 4) ", Thickness: " (rtos x 2 4))))
          (setq index (1+ index))
        )
        (prompt "\nCircles with diameter less than x have been deleted.")
      )
      (prompt "\nNo circles found in the drawing.")
  )
  (princ) 
)

This is the code for deleting circles based on some condtion, i have attached sample dxf, in that dxf  file if my  condition is true circles will be deleted, now what i want is for the same condition slots also should be delete if conditions true....thanks in advance..

Sample dxf.jpg

Posted

Can you upload a dwg file of that?

Posted

So you want the cyan slot to also disappear, right?

 

Just one thing, what's globalCleanedValue ?  What value does it have?  It's glogal, so declared outside the function

Posted (edited)

Yes that cyan slot.

globalCleanedValue is a decimal value..for the above dwg, globalCleanedValue is 0.5 which I got from "1/2"  of "PROFILE:PL1/2". This value will varies depends on the dwg.

Edited by ajithkumar.t

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