Changing open polylines to color WHITE

Changing open polylines to color WHITE

johnw
Collaborator Collaborator
814 Views
11 Replies
Message 1 of 12

Changing open polylines to color WHITE

johnw
Collaborator
Collaborator

I have a simple lisp routine that finds all open polylines on SF layer and gives me a count of how many polylines were found and how many of them were "open". I need to change any open polylines on the SF layer to color WHITE. This would be a good enhancement to this little routine. Any help would be appreciated. Please see attached CDC.lsp routine.

0 Likes
Accepted solutions (2)
815 Views
11 Replies
Replies (11)
Message 2 of 12

Kent1Cooper
Consultant
Consultant

First guess -- the part that should be doing that:

    (setq pline (subst (cons 62 7) (assoc 62 pline) pline))

doesn't work for things of ByLayer color because there is no (assoc 62) entry to (subst)itute a new value for.  Does it work if the Polyline has an override index color?  If so, try (append)ing '(62 . 7) onto the end of the 'pline' variable [the entity data list], instead of using (subst).  In very quickie trial, that doesn't work if the override color is TrueColor, but I can't look into that right now.

Kent Cooper, AIA
Message 3 of 12

ronjonp
Mentor
Mentor
Accepted solution

@johnw 

 

		      ;;Change this line
		      (setq pline (subst (cons 62 7) (assoc 62 pline) pline))
		      ;; To this
		      (entmod (append pline '((62 . 7))))

Doh .. too slow 🙂

 

This will work with Truecolor, but if you're printing this they will not be visible.

(entmod (append pline '((62 . 7) (420 . 16777215))))

 

Message 4 of 12

johnw
Collaborator
Collaborator
Thanks that worked! I appreciate the help!
0 Likes
Message 5 of 12

ronjonp
Mentor
Mentor
Accepted solution

@johnw Glad to help!

If you don't care about the total amount of polylines selected the filter can select the open plines directly like so:

 

(defun c:cpc (/ s)
  (if (setq s (ssget "_X" '((0 . "lwpolyline") (8 . "SF") (-4 . "<NOT") (-4 . "&=") (70 . 1) (-4 . "NOT>"))))
    (progn (princ (strcat "\nOpen polylines found: " (itoa (sslength s))))
	   (foreach e (mapcar 'cadr (ssnamex s))
	     (entmod (append (entget e) '((62 . 7) (420 . 16777215))))
	   )
	   (setvar 'cmdecho 0)
	   (command "_.draworder" s "" "_Front")
	   (setvar 'cmdecho 1)
    )
    (princ "\nNo open polylines found on layer SF.")
  )
  (princ)
)

 

 

*Need bitwise selection for PLINEGEN

Message 6 of 12

johnw
Collaborator
Collaborator

Thanks! I think this works better since it really doesn't matter how many there are, only to know when they aren't closed! 

0 Likes
Message 7 of 12

ronjonp
Mentor
Mentor

@johnw wrote:

Thanks! I think this works better since it really doesn't matter how many there are, only to know when they aren't closed! 


Sounds good! 👍

0 Likes
Message 8 of 12

WeTanks
Mentor
Mentor

It's Good.

ありがとうございます。

We.Tanks

EESignature

A couple of Fusion improvement ideas that could your vote/support:
図面一括印刷

0 Likes
Message 9 of 12

johnw
Collaborator
Collaborator

Hopefully a quick favor to ask. Can you modify the routine so that any SF polylines that turn white get moved to "FRONT" via the "Draworder" command? That way they will stand out at not be 'behind' any other adjacent polyline. Thanks in advance.

0 Likes
Message 10 of 12

ronjonp
Mentor
Mentor

@johnw Sure. Post above modified.

Message 11 of 12

johnw
Collaborator
Collaborator
Thank you so much!
0 Likes
Message 12 of 12

ronjonp
Mentor
Mentor

@johnw wrote:
Thank you so much!

Cheers!

0 Likes