Jump to content

Remove Geometry Within Selected Circle


Recommended Posts

Posted

Hello guys. I am looking for a routine that would allow me to select a circle and basically remove all geometry within it. We use Inventor to design our manifolds, we then also export out the faces for the programmers to use. They have issues with the extra geometry that is exported. So I now have to manually select all the unwanted geometry and delete it prior to releasing it to them. Has anyone ever created or needed such a routine? I have attached both a picture and a cad file for reference. Hopefully this is clear, but if not please let me know.

 

Thank you,

 

Darek

 

Circle Select.JPG

 

TEST_FLIP.dwg

Posted (edited)

Try this draft at the moment . :)

 

  (defun c:test (/ s i sn ss lst le di j)
 (vl-load-com)
 (if (setq s (ssget "_:L" '((0 . "CIRCLE,LINE"))))
   (repeat (setq i (sslength s))
     (setq sn (ssname s (setq i (1- i))))
     (if (eq (cdr (assoc 0 (entget sn))) "CIRCLE")
       (progn
         (setq le (/ (vlax-curve-getdistatparam sn (vlax-curve-getendparam sn))
                     50
                  )
               di le
         )
         (repeat 50
           (setq lst (vl-list* (vlax-curve-getpointatdist sn le) lst))
           (setq le (+ di le))
         )
         (if (setq ss (ssget "_WP" lst '((0 . "~CIRCLE"))))
           (repeat (setq j (sslength ss))
             (entdel (ssname ss (setq j (1- j))))
           )
         )
         (setq lst nil)
       )
       (entdel sn)
     )
   )
   (princ)
 )
 (princ)
)

Edited by Tharwat
Posted

I really appreciate your quick response to this. This seems to work quite well, I noticed that this removes everything that is not a true circle. This is exactly what I wanted but I now noticed that there some geometry produced by Inventor that is not true, thought i may look like it. A few of the circles when listed show as a ton of line segments that make it up, not an issue, I'll just need to be aware as I'm going.

 

Thank you again for your help with this, I took a LISP course back in '97 and have not used it since, so I wouldn't have gotten very far very quickly without your help. This works great for now as-is.

 

----

 

On a semi side note, do you see all the text with bounding boxes on the .dwg? The bounding boxes must also be manually removed and unfortunately they do not come in as polylines so it can be quite tedious to remove them all. Would you have any ideas for a solution to this? If I could just RMB drag to the right and select the whole text string and bounding box then have a routine to remove just the bounding box, that would be awesome.

 

Anyhow, thanks again for your help.

 

Darek

Posted

 

On a semi side note, do you see all the text with bounding boxes on the .dwg? The bounding boxes must also be manually removed and unfortunately they do not come in as polylines so it can be quite tedious to remove them all. Would you have any ideas for a solution to this? If I could just RMB drag to the right and select the whole text string and bounding box then have a routine to remove just the bounding box, that would be awesome.

 

Anyhow, thanks again for your help.

 

Darek

 

Actually they are lines and it is easy to write a simple lisp or include more codes within the first lisp to delete the selected lines .

 

What do you think ?

Posted

I think that would be fantastic, though as I stated before; I'm no LISP guru. So having said that what do you think about it? Is it something you could write-up for me? :oops:

 

Thanks again for your help with this. Is there anyway I can buy you a beer or soda for your troubles?

 

Darek

Posted
I think that would be fantastic, though as I stated before; I'm no LISP guru. So having said that what do you think about it? Is it something you could write-up for me? :oops:

 

CODES UPDATED IN THE FIRST POST

 

Not a problem at all , one day you'd be if you had the intent to learn it and worked hard on it . :)

 

Thanks again for your help with this. Is there anyway I can buy you a beer or soda for your troubles?

 

Darek

 

You're welcome anytime Darek .

 

No need to buy me anything , and it is very kind of you to say that . highly appreciated :)

 

Good luck .

Posted

Wow, that works great, thanks again for all your help.

 

Just let me know if you ever get thirsty and I'll take care of you!

 

Darek

Posted
Wow, that works great, thanks again for all your help.

 

Darek

 

You're welcome Darek .

 

 

Just let me know if you ever get thirsty and I'll take care of you!

 

Okay , I may do . :lol:

 

Thanks

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