GE13579 Posted July 9, 2009 Posted July 9, 2009 Although I don't really use it I've seen mention of a command EXTRIM, perhaps that will help on your way to a complete solution? Quote
ReMark Posted July 9, 2009 Posted July 9, 2009 Take a look at this LISP routine I found at the Cadalyst magazine CAD Tips web page. It deletes all objects outside and passing through the boarder of a window. It could probably be reworked to use this "boundary" you speak of. http://cadtips.cadalyst.com/2d-editing/delete-outside-a-window Quote
ReMark Posted July 9, 2009 Posted July 9, 2009 This boundary you speak of. Is it a series of straight lines or is it more freeform (curvy)? I ask because there is another workaround. It's not elegant but it does work under certain conditions. You can use the ERASE command with the WP option. When you are prompted to erase objects type WP and then press ENTER instead. AutoCAD will prompt you with First polygon point. At this juncture select the first point (most likely it will be an endpoint/intersection) and work your way around the boundary to the point at which you started. Each time you make a pick AutoCAD will prompt you to Specify endpoint of line or [undo]. After the last pick press ENTER. AutoCAD will now inform you how many objects it found. It will then prompt you once again to Select objects. Pressing ENTER after this prompt will erase everything inside the boundary. Entities that cross the boundary can be trimmed away using the TRIM command. If there are a number of these then use the Express Tools EXTRIM command to speed things up. It ain't fast but it does work. Quote
Ryder76 Posted July 9, 2009 Posted July 9, 2009 ReMark is truly an Luminous Being, but I do have a little additional info to his post.... WP is window polygon and when you select that option everything that is completely inside the window is selected. There is also CP which is crossing polygon and that selects anything that touches the polygon. Good Luck and let us know how it turns out. Quote
ReMark Posted July 9, 2009 Posted July 9, 2009 Dang...forgot the CP option. Thank you for catching my error of omission Ryder. I shall go flog myself (10 lashes?) right now. Ow! Ow! Ow! LOL Quote
CarlTonDor Posted July 10, 2009 Posted July 10, 2009 Hello ReMark, The LSP routine you provided just work opposite to what i wanted. Haha. I think i will request a LSP routine in the LSP section. Hello Ryder, Thank you for your reply! Appreciate all your efforts. Carl. Quote
CarlTonDor Posted July 10, 2009 Posted July 10, 2009 Hello Everyone, I have a question on deleting part of my drawing using "drawn boundary" (From another layer). If any part of my drawing touches/stay on the outline of my defined "boundary", they are to be deleted. (My boundary can be any shapes) I would like to see if a LSP routine can get my task in a faster way.:wink: I have attached a dwg file, showing an example on how it is done. Currently, i am doing this task manually. It becomes a pain when the drawing is huge. PS: I have posted this question in the "AutoCAD General" and found that a LSP routine can help me better. Your help is greatly appreciated. Thanks! Carl Example.zip Quote
flowerrobot Posted July 10, 2009 Posted July 10, 2009 Yes it can be done, but from how i would do it, the code would be quite tediouse to wright. Quote
ollie Posted July 10, 2009 Posted July 10, 2009 (defun C:brv(/ sset2 sset plist cntr ) (setq cntr 0) (setq sset (ssget "X" (list(cons 8 "Boundary")))) (while(< (setq cntr(+ cntr 1)) (sslength sset)) (setq ent (entget (ssname sset cntr))) (setq plist nil) (foreach c ent (if(= 10 (car c)) (setq plist (append plist (list (cdr c)))) ) ) (setq plist(append plist( list (car plist)))) (setq sset2 (ssget "F" plist '((-4 . "<AND")(-4 . "<NOT")(8 . "Boundary")(-4 . "NOT>")(-4 . "AND>")))) (command"erase" sset2"") (setq sset2 (ssget "WP" plist)) (command"erase" sset2"") ) ) Quote
CarlTonDor Posted July 10, 2009 Posted July 10, 2009 Thank you for reply. I do understand it is not easy. But i still hoping i can have a LSP that can assist me on this. It will greatly save my time. Quote
flowerrobot Posted July 10, 2009 Posted July 10, 2009 hey ollie You code barly didnt work I fixed it below. only selection set & count not done (1st 2 lines) GW! CarlTonDor Would the boundary's on the the boundary layer? Or do you want to select them? Any one How do you delete an enity with out the command "delete" Weird thing is, i can delete a file or a regstry file, but not a enity (defun C:brv (/ sset ent plist sset2 ) (setq sset (ssget "X" '((8 . "Boundary"))) cntr 0) (while(< (setq cntr(+ cntr 1)) (sslength sset)) (setq ent (entget (ssname sset cntr))) (setq plist nil) (foreach c ent (if(= 10 (car c)) (setq plist (append plist (list (cdr c)))) ) ) (setq plist(append plist( list (car plist)))) (setq sset2 (ssget "F" plist '((-4 . "<AND")(-4 . "<NOT")(8 . "Boundary")(-4 . "NOT>")(-4 . "AND>")))) (command"erase" sset2"") (setq sset2 (ssget "WP" plist)) (command"erase" sset2"") ) ) Quote
ollie Posted July 10, 2009 Posted July 10, 2009 hey ollie You code barly didnt work I fixed it below. only selection set & count not done (1st 2 lines) GW! CarlTonDor Would the boundary's on the the boundary layer? Or do you want to select them? (defun C:brv (/ sset ent plist sset2 ) (setq sset (ssget "X" '((8 . "Boundary"))) cntr 0) (while(< (setq cntr(+ cntr 1)) (sslength sset)) (setq ent (entget (ssname sset cntr))) (setq plist nil) (foreach c ent (if(= 10 (car c)) (setq plist (append plist (list (cdr c)))) ) ) (setq plist(append plist( list (car plist)))) (setq sset2 (ssget "F" plist '((-4 . "<AND")(-4 . "<NOT")(8 . "Boundary")(-4 . "NOT>")(-4 . "AND>")))) (command"erase" sset2"") (setq sset2 (ssget "WP" plist)) (command"erase" sset2"") ) ) Yeah sorry about that I hadn't localised my variables until testing was finished, hence the counter problem. I chose to use the list cons method for creating the selection set incase the OP wanted to replace the "Boundary" with a variable or wild card selection Any one How do you delete an enity with out the command "delete" Weird thing is, i can delete a file or a regstry file, but not a enity (entdel ent) Entdel will delete an entity EDIT: In retrospect I didn't need the Ollie Quote
ReMark Posted July 10, 2009 Posted July 10, 2009 Yes, you're right but I did mention in my post, along with the link, that it would have to be modified. It was supposed to be a starting point and not a fix. What about using Erase with the CP option; did you try it? Quote
CarlTonDor Posted July 11, 2009 Posted July 11, 2009 Sorry for the mentioning. I do tried using the "WP" and "CP" function. It works and i had my lesson learnt. Thanks! However, most of the time, the "boundary" is already drawn (By other team) and i have to manually to delete my drawings that collapsed with the boundaries. Yes. It will be faster but i still will be doing this time 100 over times. Some may reach 500. Quote
CarlTonDor Posted July 11, 2009 Posted July 11, 2009 Oh My, It works! Thank you ALL! I am wondering if i can edit my request. Can i have the deleted items shifted to another layer? (layer name "DELELE") In this case, i can check and know what is deleted. I am getting so excited now Carl Quote
flowerrobot Posted July 11, 2009 Posted July 11, 2009 Some times i think i am a complete idot, Here is the code using ollies methods You can change the name "deleted" to what ever you want. All the items will be on a blue, no plot layer (defun layerchanger (ss / ed TheLayer) (setq TheLayer "deleted") (if ss (progn (if (not (tblsearch "layer" TheLayer)) (entmake (list (cons 0 "LAYER") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbLayerTableRecord") (cons 2 TheLayer) (cons 70 0) (cons 62 2) (cons 6 "CONTINUOUS") (cons 290 0) (cons 370 0) ) ) ) (setq ed (entget (ssname ss 0)) ed (subst (cons 8 TheLayer) (assoc 8 ed) ed) ) (entmod ed) ) ) ) (defun C:brv (/ sset ent plist sset2 ) (setvar "cmdecho" 0) (setq sset (ssget "X" '((8 . "Boundary"))) cntr -1) (while(< (setq cntr(+ cntr 1)) (sslength sset)) (setq ent (entget (ssname sset cntr))) (setq plist nil) (foreach c ent (if(= 10 (car c)) (setq plist (append plist (list (cdr c)))) ) ) (setq plist(append plist( list (car plist)))) (setq sset2 (ssget "F" plist '((-4 . "<AND")(-4 . "<NOT")(8 . "Boundary")(-4 . "NOT>")(-4 . "AND>")))) (layerchanger sset2) (setq sset2 (ssget "WP" plist)) (layerchanger sset2) ) (setvar "cmdecho" 1) (princ) ) Quote
Recommended Posts
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.