Author Topic: Routine doesnt select Open Polylines  (Read 1670 times)

0 Members and 1 Guest are viewing this topic.

mailmaverick

  • Bull Frog
  • Posts: 493
Routine doesnt select Open Polylines
« on: May 16, 2017, 04:41:22 AM »
I have a LISP routine which selects only Open (cons 70 0) polylines and uses them for further work.

I've been using it for quite a few months without a problem but just now I came across a file having open polylines but having (cons 70 128). When I read about the same, I came to know that it means 'Linetype Generation Enabled.'

My question is : whether I should change the selection set command from :-

Code: [Select]
(setq sspipes (ssget "_:L" '((0 . "*POLYLINE") (70 . 0))))
to

Code: [Select]
(setq sspipes (ssget "_:L" '( (0 . "*POLYLINE") (-4 . "<OR") (70 . 0) (70 . 128) (-4 . "OR>"))))
or is there any other better way of doing this ?



didier

  • Newt
  • Posts: 48
  • expatrié
Re: Routine doesnt select Open Polylines
« Reply #1 on: May 16, 2017, 06:43:49 AM »
Coucou

I do not understand why you're talking about open polylines !
":L" rejects entities on locked layers.

amicalement
eternal beginner ...
my english is not fluent ...

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Routine doesnt select Open Polylines
« Reply #2 on: May 16, 2017, 06:59:27 AM »
My polylines are in a layer which is not locked and are also 'Not Closed'.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2132
  • class keyThumper<T>:ILazy<T>
Re: Routine doesnt select Open Polylines
« Reply #3 on: May 16, 2017, 07:05:59 AM »
Coucou

I do not understand why you're talking about open polylines !
":L" rejects entities on locked layers.

amicalement

He means NOT closed .. ie:



« Last Edit: May 16, 2017, 07:20:43 AM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Routine doesnt select Open Polylines
« Reply #4 on: May 16, 2017, 07:25:04 AM »
Hi,

You should have a look at the bitwise AND operator (-4 . "&")

Code - Auto/Visual Lisp: [Select]
  1. (setq sspipes (ssget "_:L" '( (0 . "*POLYLINE") (-4 . "<NOT") (-4 . "&") (70 . 113) (-4 . "NOT>"))))
should reject :
64 POLYLINE is a polyface mesh
32 POLYLINE is a polygon mesh closed in the N direction
16 POLYLINE is a 3D polygon mesh
1 (LW)POLYLINE is closed
Speaking English as a French Frog

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Routine doesnt select Open Polylines
« Reply #5 on: May 16, 2017, 08:24:43 AM »
Dear Gile

Thanks for your reply. How to decide which is better to use :-
(setq sspipes (ssget "_:L" '( (0 . "*POLYLINE") (-4 . "<NOT") (-4 . "&") (70 . 113) (-4 . "NOT>"))))
or
(setq sspipes (ssget "_:L" '( (0 . "*POLYLINE") (-4 . "<OR") (70 . 0) (70 . 128) (-4 . "OR>"))))


ronjonp

  • Needs a day job
  • Posts: 7527
Re: Routine doesnt select Open Polylines
« Reply #6 on: May 16, 2017, 09:09:41 AM »
Dear Gile

Thanks for your reply. How to decide which is better to use :-
(setq sspipes (ssget "_:L" '( (0 . "*POLYLINE") (-4 . "<NOT") (-4 . "&") (70 . 113) (-4 . "NOT>"))))
or
(setq sspipes (ssget "_:L" '( (0 . "*POLYLINE") (-4 . "<OR") (70 . 0) (70 . 128) (-4 . "OR>"))))
Try using the second on a "heavy" AcDb2dPolyline ..

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Routine doesnt select Open Polylines
« Reply #7 on: May 16, 2017, 09:28:46 AM »
Thanks everyone.


gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Routine doesnt select Open Polylines
« Reply #8 on: May 18, 2017, 02:00:33 AM »
Hi,

Using the "&" opertaor gives you more control:
Code - Auto/Visual Lisp: [Select]
  1. '((0 . "*POLYLINE")
  2.   (-4 . "<NOT")
  3.   (-4 . "&")
  4.   (70 . 113)    ; (+ 1 16 32 64)
  5.   (-4 . "NOT>")
  6. ))
is equivalent to:
Code - Auto/Visual Lisp: [Select]
  1. '((0 . "*POLYLINE")
  2.   (-4 . "<OR")
  3.   (70 . 0)     ; lwpolyline or simple 2d polyline
  4.   (70 . 2)     ; curve-fit 2d polyline
  5.   (70 . 4)     ; spline-fit 2d polyline
  6.   (70 . 8)     ; 3d polyline
  7.   (70 . 12)    ; spline-fit 3d polyline
  8.   (70 . 128)   ; linetype generation enabled lwpolyline or simple 2d polyline
  9.   (70 . 130)   ; linetype generation enabled curve-fit 2d polyline
  10.   (70 . 132)   ; linetype generation enabled spline-fit 2d polyline
  11.   (70 . 136)   ; linetype generation enabled 3d polyline
  12.   (70 . 140)   ; linetype generation enabled spline-fit 3d polyline
  13.   (-4 . "OR>")
  14. )

The equivalent of:
Code - Auto/Visual Lisp: [Select]
  1. ((0 . "*POLYLINE")
  2.   (-4 . "<OR")
  3.   (70 . 0)     ; lwpolyline or simple 2d polyline
  4.   (70 . 128)   ; linetype generation enabled lwpolyline or simple 2d polyline
  5.   (-4 . "OR>")
  6. )
should be:
Code - Auto/Visual Lisp: [Select]
  1. '((0 . "*POLYLINE")
  2.   (-4 . "<NOT")
  3.   (-4 . "&")
  4.   (70 . 127)  ; (+ 1 2 4 8 16 32 64)
  5.   (-4 . "NOT>")
  6. )
« Last Edit: May 18, 2017, 02:29:14 AM by gile »
Speaking English as a French Frog