Check to see if polyline is closed.

Casey

Usenet Archive
Joined
Jul 24, 2003
Messages
62
Reaction score
0
Is there a dxf code that indicates wether a polyline is closed or not? If not... how would one go about checking this?

Thanks,

Casey
 
Wouldn't this work just as good?

(defun isclosed (ent)
(= 1 (logand 1 (cdr (assoc 70 (entget ent)))))
)

I'm not saying one or the other is right or wrong, only this saves a few keystrokes.
 
Do i have to use the logand function (not exactly sure how it works)... Isn't dxf code 70 equal to 0 for an open pline and 1 for a closed?

just checkin.

Thanks,
 
I'm looking at a drawing right now that has closed polylines with (70 .
129) for group codes. Then I checked one of my little selection routines and it includes the 129 value as an OR to the 1. Am I missing something on this thread?

(setq PolyOne (ssget ":s"
'((0 . "LWPOLYLINE")
(-4 . "<OR")
(70 . 1)
(70 . 129)
(-4 . "OR>")
)
)
)

Len
 
You could simplify it to
(setq PolyOne (ssget ":S" '((-4 . "&")(70 . 1))))
___
 
Yours is fine if you are trying to return a selection set. I think the OP was looking for a function that returns T or nil.
 
No, since all you're interested in is the "1" value. The bitwise and filter ("&") will tell you if that bit is set in any bitmapped value.
___
 
thx everybody, many years i had this error on some routines (but never saw
any problem)

Bruno Toniutti

in fact no, because i used :
(setq Ferme (cdr (assoc 70 (entget Nom_Entite ))))
.....
......
(if (/= (- (/ Ferme 2.0 ) (/ Ferme 2 )) 0.0 ) ........

I did not know logand, when i wrote these old lisp.

Bruno Toniutti
(sorry for my english level)
 

Latest threads

Back
Top