@doaiena wrote:
....
....
(equal (cdr (assoc 70 (entget entity))) 8)
....
That will fail if the 3DPolyline is closed [which will add 1 to the (assoc 70) value] or Spline- or Fit-curved, and so on -- the 70-code entry contains information about far more than just whether a Polyline is 3D, and testing whether its value is specifically 8 will recognize only those that are open and not curve-edited. It needs to test whether 8 is one of the binary bits that make up the 70-code value.
Try this [only the identification part -- alter as necessary to proceed to do something with the selected object depending on whether or not it's a 3DPolyline]:
(defun C:Is3DP (/ esel edata)
(if (setq esel (entsel "\nSelect object to find whether it's a 3DPolyline: "))
(progn ; then
(setq edata (entget (car esel)))
(prompt
(strcat
"\nThat object is "
(if
(and
(member '(0 . "POLYLINE") edata)
(= (logand (cdr (assoc 70 edata)) 8) 8)
); and
"" ; then
"not "
); if
"a 3DPolyline."
); strcat
); prompt
); progn
); if
(princ)
); defun
OR, if you don't need to do anything with the object other than to find out whether it's a 3DPolyline [i.e. don't need to put the selection into a variable for any purpose], and if you don't mind being stuck with the "Select objects:" prompt [always in the plural], it can be simplified down to this:
(defun C:Is3DP (/ ss)
(if (ssget "_:S+." '((0 . "POLYLINE") (-4 . "&") (70 . 8)))
(prompt "\nThat object is a 3DPolyline."); then
(prompt "\nThat object is not a 3DPolyline."); else
); if
(princ)
); defun
Kent Cooper, AIA