Sambuddy Posted December 18, 2019 Posted December 18, 2019 I am not even sure how to pose this question - so here she goes: I am not quite sure if you can select content with different colours within a text (see attachment). The code below only finds text colour selected by the layer. Is there a way? My whole intention is to sort them so that say if I pick BELL (colour 150) or RORGERS (colour 22) then the white text strings and colour 150 remains and the rest be removed - sorting by colour and merging the text condition the selection and colour!!! Possible? (setq ss (ssget "X" '((0 . "*TEXT")(62 . 1)))) if yes...how??? text sample.dwg Quote
dlanorh Posted December 18, 2019 Posted December 18, 2019 34 minutes ago, Sambuddy said: I am not even sure how to pose this question - so here she goes: I am not quite sure if you can select content with different colours within a text (see attachment). The code below only finds text colour selected by the layer. Is there a way? My whole intention is to sort them so that say if I pick BELL (colour 150) or RORGERS (colour 22) then the white text strings and colour 150 remains and the rest be removed - sorting by colour and merging the text condition the selection and colour!!! Possible? (setq ss (ssget "X" '((0 . "*TEXT")(62 . 1)))) if yes...how??? text sample.dwg 23.99 kB · 0 downloads Difficult to say as I cannot open the drawing as it is in a later version than the one I use. Quote
Sambuddy Posted December 18, 2019 Author Posted December 18, 2019 text sample.dwg there you go! I saved it as 2000 Quote
Lee Mac Posted December 18, 2019 Posted December 18, 2019 MText formatting is embedded within the text content (here is a reference for the majority of available formatting codes); as such, you will need to test the text content of the presence of the colour formatting code "\C<colour>;" where <colour> is the ACI colour number. Quote
Sambuddy Posted December 18, 2019 Author Posted December 18, 2019 Quote Posted 1 minute ago MText formatting is embedded within the text content (here is a reference for the majority of available formatting codes); as such, you will need to test the text content of the presence of the colour formatting code "\C<colour>;" where <colour> is the ACI colour number. how do I implement that onto a code? a little more detail please Quote
Lee Mac Posted December 18, 2019 Posted December 18, 2019 40 minutes ago, Sambuddy said: how do I implement that onto a code? a little more detail please Obtain a selection set of all MTEXT entities within the target space. Iterate over the set (using one of the methods described here). Obtain the full text content held by each MTEXT entity (concatenate all DXF group 3 & 1 values). Use wcmatch to test for the existence of \C<colour>; within the content, where <colour> is the ACI colour number you require. Quote
Sambuddy Posted December 18, 2019 Author Posted December 18, 2019 Thank you Lee Mac, I believe I can follow these guidelines for a hope of filtering colours within a text. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.