Jump to content

Recommended Posts

Posted

We work on alot of drawings converted from Solidworks and we typically delete Solidworks specific blocks. What I'm wondering is

if it possible to create a selection set that uses a wildcard.

(or the correct way to accomplish the same thing).

 

Here is a sample of how I know how to select one of the blocks

 

(setq aa (ssget "x" '((0 . "INSERT") (2 . "SW_CENTERMARKSYMBOL_17"))))

 

All the blocks have an "SW_" prefix.

Is it possible to select something along these lines?

(2 . "SW_*)

 

If someone could provide some direction it would be greatly appreciated!

 

TIA!

Posted

Have you tried?

 

All SelectionSet filter lists can use Wildcards, so as long as you are conversent with them, then the possibilities are endless.

Posted

Thanks!

 

Personally I hate when someone asks a question about code but doesn't post

what they did to make it work. I like to see others solutions.

 

With that said, here is my simple little app..

 

(defun c:SW ()

(setq aa (ssget "_X" (list (cons 0 "INSERT") (cons 2 "SW_Cen*"))))

(command "Erase" aa "")

(princ))

 

 

I'm sure I can't be the only person who didn't know how to do this..

 

Thanks again!

Posted

If I might make a slight modification...

 

(defun c:SW (/ aa)
 (if (setq aa (ssget "_X" (list (cons 0 "INSERT") (cons 2 "SW_Cen*"))))
   (command "_.Erase" aa "")
 )
 (princ)
)

Since you are defining the filter parameters instead of receiving them from a variable, you can also use:

'((0 . "INSERT")(2 . "SW_Cen*"))

Posted

See!

 

If you don't post YOUR code you can't learn better ways of doing things!!

 

Thanks guys!!

Posted
See!

 

If you don't post YOUR code you can't learn better ways of doing things!!

 

Thanks guys!!

 

:)

.........

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