Author Topic: dxf code change?  (Read 11568 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7529
dxf code change?
« on: February 25, 2005, 06:03:23 PM »
I can use this filter get all closed polylines in Acad 2004 but it does not work in 2005?

Code: [Select]
(setq s1 (ssget "x"'((0 . "LWPOLYLINE")(70 . 1))))

What is going on?

Thanks,

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
dxf code change?
« Reply #1 on: February 25, 2005, 06:10:27 PM »
Plinegen is encoded to group 70 (bit 7, value = 128) so you might try --

Code: [Select]
(ssget "x"
   '(   (0 . "LWPOLYLINE")
        (-4 . "&")
        (70 . 1)
    )
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
dxf code change?
« Reply #2 on: February 25, 2005, 06:11:01 PM »
ronjonp,
These work for me in AC2005
Code: [Select]

(setq s1-closed (ssget "x"'((0 . "LWPOLYLINE")(70 . 1))))
(setq s1-notClosed (ssget "x"'((0 . "LWPOLYLINE")(70 . 0))))
(setq s1-either (ssget "x" '((0 . "LWPOLYLINE"))))
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ronjonp

  • Needs a day job
  • Posts: 7529
dxf code change?
« Reply #3 on: February 25, 2005, 06:33:19 PM »
MP,

That worked thanks :)

Kerry,

Still a no go in 2005??


Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
dxf code change?
« Reply #4 on: February 25, 2005, 06:39:41 PM »
Great Ron. To be clear though, it's not a 2004/2005 issue. It's just coincidental that you happen to be using 2005 AND the lwpolylines you're currently dealing with have plinegen set. IOW, it would hold the same for 2004.

Cheers and have a great weekend.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
dxf code change?
« Reply #5 on: February 25, 2005, 07:28:47 PM »
Code: [Select]
Plinegen is encoded to group 70 (bit 7, value = 128) so you might try --


Michael

Thanks for the info. .. Most critical ..
I've been blisfully ignorant ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ronjonp

  • Needs a day job
  • Posts: 7529
dxf code change?
« Reply #6 on: February 25, 2005, 07:34:57 PM »
Thanks for the info...

Where I'm going with this is:

User selects closed polylines in a drawing.
routine goes through each closed pline
grabs area of pline
inserts text with area in center of bounding box of object

Here is where I'm at....

Code: [Select]
(defun c:mareas (/ ss p selset)
(setq p 0)
(princ "\n Select closed polyines:")
(setq ss (ssget '((0 . "LWPOLYLINE")(-4 . "&")(70 . 1))))
(setq selset (sslength ss))

(repeat selset
  (setq ent (ssname ss p))
  (setq p (+ p 1))
  (command ".area" "object" ent)
  (setq txt (rtos (getvar "area") 2 2))
  (command ".text" "j" "mc" "0,0" ".125" "0" txt)
  (setq p (+ p 1))
)
)


I really suck at this lisp stuff  :x

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
dxf code change?
« Reply #7 on: February 25, 2005, 08:02:55 PM »
Ron, when you get tired of beating yourself up on this, I re-posted earlier today over at the AUGI.com forums a lisp originally written by Luis Esquival and modified by me that will do more than what you want. It would be real simple to reduce it down to only work with closed plines.

I must leave right now so if you can't find it over there (search for user 'miff') just let me know and I will re-post it here tomorrow or late tonight.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
dxf code change?
« Reply #8 on: February 25, 2005, 08:46:28 PM »
Ain't this place great!

theswamp.org rocks.

:cheesy:
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10646
dxf code change?
« Reply #9 on: February 25, 2005, 08:54:22 PM »
*lmao!*
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
dxf code change?
« Reply #10 on: February 25, 2005, 09:16:54 PM »
I still say let them fish once in a while...................
TheSwamp.org  (serving the CAD community since 2003)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
dxf code change?
« Reply #11 on: February 25, 2005, 10:23:38 PM »
Who needs to fish, the fish are jumpin' in the boats!

:lol:
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
dxf code change?
« Reply #12 on: February 25, 2005, 11:21:19 PM »
hehehe.............  :D
TheSwamp.org  (serving the CAD community since 2003)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
dxf code change?
« Reply #13 on: February 26, 2005, 09:12:14 AM »
Quote from: MP
Plinegen is encoded to group 70 (bit 7, value = 128) so you might try --

Code: [Select]
(ssget "x"
   '(   (0 . "LWPOLYLINE")
        (-4 . "&")
        (70 . 1)
    )
)

MP let me ask about your code.
Isn't the "&" implied? The reason I ask as I though they were the same.
Code: [Select]
'((0 . "LWPOLYLINE")(-4 . "&")(70 . 1))
 '((0 . "LWPOLYLINE")(70 . 1))

 
 You method is easer to read, but is it different?
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
dxf code change?
« Reply #14 on: February 26, 2005, 09:58:18 AM »
The (-4 . "&")(70 . 1) filter will be true if bit 0 (value 1) is set (bitwise logical and), thus (in this case) will be true for 70 group values of 1 or 129 (1 + 128), which is what we want: retrieve closed lwpolylines with no regard for the plinegen status.

The (70 . 1) filter by its lonesome is absolute: be true only if the 70 group value equals 1, so it will only retrieve closed lwpolylines that do not have plinegen set.

Does that clear it up?

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst