Author Topic: Filter by Z-Value  (Read 6849 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Filter by Z-Value
« Reply #15 on: January 14, 2009, 11:35:22 AM »
Sounds like you need to use Joe Burke's superflatten routine.

http://www.theswamp.org/index.php?topic=18153.0

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Rooster

  • Guest
Re: Filter by Z-Value
« Reply #16 on: January 14, 2009, 11:40:56 AM »
seems like there are two threads in one here, lol  :lol:

So anyway, I think I have my LISP doing what I want with this:

Code: [Select]
(defun c:fz0(/ cSet)

(setq cSet (ssget
'((-4 . "*,*,=")
  (10 0.0 0.0 0.000)
  (-4 . "<NOT")
  (0 . "LWPOLYLINE,POLYLINE");;not polylines
  (-4 . "NOT>")
)
)
      )
 
  (if cSet
    (progn
      (princ(strcat "\n" (itoa(sslength cSet)) " found."))
      (sssetfirst nil cSet)
      ); end progn
     (princ "\nNothing found. ")
    ); end if
  (princ)
  ); end of c:fz0

So my last question is how do I now edit this so that it selects objects with z of either 0.0 or -999.0
I did try experimenting with (-4 . "<XOR") but it didn't seem to work....

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Filter by Z-Value
« Reply #17 on: January 14, 2009, 11:55:52 AM »
This seems to work:

Code: [Select]
(setq cset (ssget "x"
  '((-4 . "<OR")
    (-4 . "*,*,=")
    (10 0.0 0.0 0.000)
    (-4 . "*,*,=")
    (10 0.0 0.0 -999.0)
    (-4 . "OR>")
    (-4 . "<NOT")
    (0 . "LWPOLYLINE,POLYLINE")
    ;;not polylines
    (-4 . "NOT>")
   )
   )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Filter by Z-Value
« Reply #18 on: January 14, 2009, 12:30:20 PM »
d-unit
could you post a sample DWG for testing?

There are 4 Mtext and 3 leader objects that are at Z=2700 that will not go to Z=0 using the attached code.
Thanks in advance CAB.

(Also, it looks like there is a block that has an attribute on a different Z value as well.  I haven't looked into that one yet.)

See link in Ron's post or the old Flatten worked too.
Maybe because it has a dictionary attached, not sure but don't have time to investigate at the moment.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

dustinthiesse

  • Guest
Re: Filter by Z-Value
« Reply #19 on: January 14, 2009, 01:08:42 PM »
d-unit
could you post a sample DWG for testing?

There are 4 Mtext and 3 leader objects that are at Z=2700 that will not go to Z=0 using the attached code.
Thanks in advance CAB.

(Also, it looks like there is a block that has an attribute on a different Z value as well.  I haven't looked into that one yet.)

See link in Ron's post or the old Flatten worked too.
Maybe because it has a dictionary attached, not sure but don't have time to investigate at the moment.

Thanks for the link Ron!  Worked like a charm.  I tried the express tools flatten, but it converted leaders into Plines and Mtext into Text (and got rid of my fields!).  Superflatten keeps the objects the same...one of these days I'll have to dissect that program so I can learn from it.  8-)

Rooster

  • Guest
Re: Filter by Z-Value
« Reply #20 on: January 15, 2009, 04:08:48 AM »

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Filter by Z-Value
« Reply #21 on: January 15, 2009, 05:13:00 PM »
You're welcome :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC