Jump to content

Recommended Posts

Posted

I'm working on a script to help me with my drawings. What would be really great would be to be able to use the FILTER command within the script, but as FILTER brings up a pop-up window this obviously fails the script, and

-FILTER doesn't work as a command. Is there a way to get around this and run FILTER from the command line? Or any other options??

  • Replies 36
  • Created
  • Last Reply

Top Posters In This Topic

  • Rooster

    16

  • lpseifert

    8

  • ASMI

    6

  • swazi.71

    3

Posted

Filter is too complex to run in command line without dialog window. Try to use SSX command or create complex filters with SSGET lisp function. SSGET supports logical operators and wildcard patterns for creation of very complex filters.

  • 3 months later...
Posted

g'day ASMI,

 

an old thread, I know, but I had to bite..

 

Filter is too complex to run in command line without dialog window.

 

I'd say that's a daft thing to say. I could use filter several times a day as a macro button along the lines of ^C^Crunanamedfilter;name; but it sadly doesn't seem to be an option. Being an LT user, lisp isn't an option either. So instead I click away at the filter box.. :o\

 

 

cheers,

swazi

Posted

A script can execute any command at the Command prompt except a command that displays a dialog box. Command line versions are provided for many dialog box commands.

Posted

g'day Guy,

 

 

Yeah, I've worked that bit out. Unfortunately, it seems filter doesn't subscribe to that line of thought. -VIEW works nicely for working with named views, pity there's no -FILTER equivalent for working with named filters.

 

 

 

cheers,

swazi

Posted

swazi,

I have noticed in a couple of threads your use of macros in LT, and also your frustration with the filter and qselect dialog only option.

 

Maybe one solution for some of these issues would be to have a more regimented layer system, Then invoke layer states through macros before selecting..?

 

Just a thought, your original problems got me interested in this issue,

I looked at DIESEL, but that really didn't suit this issue, and it seems this problem has been discussed over at the autodesk forums with the same `no macro for filter or qselect' answer.:)

Posted

ASMI wrote me a lisp program that have lines in it that can filter.

 

In this example it filters the true color of red. (12d uses true colors not compatible with .cbt)

 

(ssget "_X" '((420 . 15728640)))

 

He also gave me a string to type in the command line to inquire an entity

 

(entget(car(entsel)))

 

lets say you want to filter out a cirlcle, I think you can use the above line to find out what a circle is in dxf format (I don't know if dxf format is required. It was with filtering true colors)

 

Hope this helps but it could be rubbish. I'm not a very good lisp writer and don't know if this will be appropriate

Posted

G'day Rookie,

 

 

Being an LT user kinda rules out any form of LISP rescue.. :o|

 

 

cheers,

swazi

Posted
G'day Rookie,

 

 

Being an LT user kinda rules out any form of LISP rescue.. :o|

 

 

cheers,

swazi

 

Sorry

 

I didn't know he was using LT

  • 2 months later...
Posted
Filter is too complex to run in command line without dialog window.

 

Still trying to get around this problem. I have now progressed to using saved named filters which helps a little, but is it also not possible to recall a saved filter from the command line?

Posted

You can yse short lisps with SSGET function. It not so hard. For example:

 

1. Select all entities on layers with prefix 'Layer':

 

(defun c:f1(/ cSet)

 (setq cSet[color="Blue"](ssget "_X"
              '((8 . "Layer*"))
            ); end ssget[/color]
); end setq
 
 (if cSet
   (progn
     (princ(strcat "\n" (itoa(sslength cSet)) " found."))
     (sssetfirst nil cSet)
     ); end progn
    (princ "\nNothing found. ")
   ); end if
 (princ)
 ); end of c:f1

 

2. Select all lines and polylines with red color:

 

(defun c:f2(/ cSet)

 (setq cSet[color="#0000ff"](ssget "_X"
              '((0 . "LINE,LWPOLYLINE")(62 . 1))
            ); end ssget[/color]
); end setq
 
 (if cSet
   (progn
     (princ(strcat "\n" (itoa(sslength cSet)) " found."))
     (sssetfirst nil cSet)
     ); end progn
    (princ "\nNothing found. ")
   ); end if
 (princ)
 ); end of c:f2

 

3. Select not red lines, circles and arcs on layer '0':

 

(defun c:f3(/ cSet)

 (setq cSet[color="#0000ff"](ssget
              '((0 . "LINE,CIRCLE,ARC")
	 (8 . "0")
	 (-4 . "<NOT")(62 . 1)(-4 . "NOT>"))
            ); end ssget[/color]
); end setq
 
 (if cSet
   (progn
     (princ(strcat "\n" (itoa(sslength cSet)) " found."))
     (sssetfirst nil cSet)
     ); end progn
    (princ "\nNothing found. ")
   ); end if
 (princ)
 ); end of c:f3

 

One more http://www.cadtutor.net/forum/showthread.php?t=27779

 

Look for SSGET function AutoLISP Reference and DXF-codes in DXF Reference.

Posted

Ok - thanks for your help ASMI. That sounds very promising. Not knowing enough about LISP to edit the above to work for me, how would I get it to pick [a] all blocks of a certain name, and all text of a certain value?

Posted
... how would I get it to pick [a] all blocks of a certain name ...

 

(defun c:f4(/ cSet)

 (setq cSet(ssget
              '((0 . "INSERT")[color="Blue"](2 . "TYPE_BLOK_NAME"))[/color]
            ); end ssget
); end setq
 
 (if cSet
   (progn
     (princ(strcat "\n" (itoa(sslength cSet)) " found."))
     (sssetfirst nil cSet)
     ); end progn
    (princ "\nNothing found. ")
   ); end if
 (princ)
 ); end of c:f4

 

... all text of a certain value?

 

(defun c:f5(/ cSet)

 (setq cSet(ssget
              '((0 . "TEXT,MTEXT")[color="#0000ff"](1 . "*TEXT_HERE*"))[/color]
            ); end ssget
); end setq
 
 (if cSet
   (progn
     (princ(strcat "\n" (itoa(sslength cSet)) " found."))
     (sssetfirst nil cSet)
     ); end progn
    (princ "\nNothing found. ")
   ); end if
 (princ)
 ); end of c:f5

 

Try also fast layer selection:

 

(defun c:selay(/ samSet unsLst filLst diSet)
 (princ "\n<<< Select sample entities >>> ")
 (if(setq samSet(ssget))
   (progn
     (setq unsLst(mapcar '(lambda(x)(assoc 8(entget x)))
	      (vl-remove-if 'listp(mapcar 'cadr
		(ssnamex samSet))))
    ); end setq
     (if unsLst
(progn
  (while unsLst
    (setq filLst(cons(car unsLst)filLst)
	  unsLst(vl-remove(car unsLst)filLst)
	  ); end if
    ); end while
  (setq filLst(append
		(list '(-4 . "<OR")) filLst
		(list '(-4 . "OR>"))))
  (princ "\n<<< Select entities on wanted layers >>> ")
  (setq diSet(ssget filLst))
  (sssetfirst nil diSet)
  ); end progn
); end if
     ); end progn
   ); end if
 (princ)
 ); end of c:selay

 

Edit: Excuse me (1 . "*TEXT_HERE*") instead of (2 . "*TEXT_HERE*")

Posted

Thanks a lot ASMI. I'll try those out now

Posted

Perfect! Thankyou. One last one - how can I change it now to filter by a certain text height?

Posted

DXF group 40 is text height f. e. (40 . 2.5)

DXF group 7 is text style f. e. (7 . "Standard")

 

Type in command line (entget(car(entsel))) pick entity you need and look DXF codes:

 

Command: (entget(car(entsel)))

Select object: ((-1 . <Entity name: 7efab218>) (0 . "TEXT") (330 . <Entity 
name: 7efa4cf8>) (5 . "133") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . 
"0") (100 . "AcDbText") (10 829.276 429.816 0.0) (40 . 2.5) (1 . 
"fsdafasdfasd") (50 . 0.0) (41 . 1.0) (51 . 0.0) (7 . "Standard") (71 . 0) (72 
. 0) (11 0.0 0.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbText") (73 . 0))

Posted

Thanks ASMI - I think I understand that, and I've managed to adapt the LISP to now filter by text height. Thanks for all your help!

Posted
DXF group 40 is text height f. e. (40 . 2.5)

DXF group 7 is text style f. e. (7 . "Standard")

 

Type in command line (entget(car(entsel))) pick entity you need and look DXF codes:

 

Command: (entget(car(entsel)))

Select object: ((-1 . <Entity name: 7efab218>) (0 . "TEXT") (330 . <Entity 
name: 7efa4cf8>) (5 . "133") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . 
"0") (100 . "AcDbText") (10 829.276 429.816 0.0) (40 . 2.5) (1 . 
"fsdafasdfasd") (50 . 0.0) (41 . 1.0) (51 . 0.0) (7 . "Standard") (71 . 0) (72 
. 0) (11 0.0 0.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbText") (73 . 0))

 

ASMI (or anyone else) - where do I find out what the different DXF groups are? eg. from the above, how do I know what what the group 210 is?

Posted

Developers Help > DXF Reference [acad_dev.chm]

Posted

I'm editing ASMI's LISP (above) to try to select all polylines in the drawing. When I run this though it only selects the first polyline drawn. Can someone help me see where I'm going wrong? Thanks

 

(defun c:fpl(/ cSet)

 

(setq cSet(ssget

'((0 . "LWPOLYLINE"))

); end ssget

); end setq

 

(if cSet

(progn

(princ(strcat "\n" (itoa(sslength cSet)) " found."))

(sssetfirst nil cSet)

); end progn

(princ "\nNothing found. ")

); end if

(princ)

); end of c:fpl

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