Thomas W Posted December 2, 2022 Share Posted December 2, 2022 (edited) Hi all, I'm trying to put colored text or part of text in a data label but I'm not sure how to do it. I first tried the GetPenFore and SetPenFore functions to see the result in Vectorscript but if I understood correctly these functions are not accessible in the DataTag. Apparently only array functions are accessible? (#WS_#) If someone has an idea to put some text in color in a data label it will be appreciated! Or a place to find information about #WS_# functions and how to use them, such as Vectorworks 2023 Script Function Reference. Below is a screenshot and an attached file with an example data label, Salut à tous, J'essaye de mettre du texte ou une partie de texte en couleur dans une étiquette de données mais je ne sais pas trop comment procéder. J'ai d'abord essayé les fonctions GetPenFore et SetPenFore pour voir le résultat en Vectorscript mais si j'ai bien compris ces fonctions ne sont pas accessibles dans les DataTag. Apparemment seuls les fonctions des tableaux sont accessibles? (#WS_#) Si quelqu'un à une idée pour mettre une partie de texte en couleur dans une étiquette de données il sera bienvenue! Ou un endroit ou trouver des informations sur les fonctions #WS_# et comment les utiliser, comme Vectorworks 2023 Script Function Reference. Ci-dessous une capture et un fichier joint avec un exemple d'étiquette de données, Merci et bonne journée, Thomas Etiquette de données sans ligne vide - une partie de ligne en Couleur.vwx Edited December 2, 2022 by Thomas W Quote Link to comment
Pat Stanford Posted December 2, 2022 Share Posted December 2, 2022 I don't think there is an easy way to change the attributes of an object inside of a Data Tag dynamically. If you always want the color of a block of text to be Red (for example) you would just set the attributes of the placeholder block to what you need. If all of your data tag will always need to be the same color you could also assign the placeholder text in the Data Tag Style to have a Text Style and then change the color in the Text Style. For multiple colors in a Data Tag, I think the only possible current solution is multiple stacked text placeholder objects, one for each required color, each with Dynamic Text using an IF statement to show the data if true and to display and empty string if false. The formula for the door configuration is something like: #Door#.#Configuration#@#Door#.#Configuration#='Folding':'' #Door#.#Configuration#@#Door#.#Configuration#='Folding':'' The part between the @ and the : is the IF condition. The part before the @ is what will display if the IF Condition is TRUE The part after the : is what will display if the IF Condition is False. In this case it is an empty string of two single quotes next to each other. Best I can come up with at this time. Ask again if you need more help. 2 Quote Link to comment
Thomas W Posted December 5, 2022 Author Share Posted December 5, 2022 (edited) Thanks for your feedback Pat! It is indeed multiple colors in a data tag, so I will try with multiple stacked text objects and the IF statement, but I think it will be complicated because the data tag contains 8 or 9 lines depending cases, with the possibility of having a line that only displays in certain cases with an IF function. Can we put several conditions between the @ and the :? Like: #Door#.#Configuration#@(#Door#.#Configuration#='Folding' & #Door#.#Options"='Polystyrene'):'' Anyway thanks for the explanation of using the IF function in the data tag! I'll try and let you know if I get an acceptable result. Have a good day ! Merci pour ton retour Pat ! Il s'agit bien de plusieurs couleurs dans une balise de données, je vais donc essayer avec plusieurs objets de textes empilés et l'instruction IF, mais je pense que ça va être compliqué parce que la balise de données contient 8 ou 9 lignes selon les cas, avec la possibilité d'avoir une ligne qui ne s'affiche que dans certains cas avec une fonction IF. Peut on mettre plusieurs conditions entre le @ et le : ? Comme : #Porte#.#Configuration#@(#Porte#.#Configuration#='Pliante' & #Porte#.#Options"='Polystyrène'):'' En tous cas merci pour l'explication de l'utilisation de la fonction IF dans la balise de données ! Je vais essayer et je vous tiens au courant si j'arrive à un résultat acceptable. Bonne journée ! Edited December 5, 2022 by Thomas W Quote Link to comment
Pat Stanford Posted December 5, 2022 Share Posted December 5, 2022 The @ : Trinary statement does note seem to support the And and Or functions in the center statement. There is a different way to do IF statements. I did not mention it originally because it means you need to know both Data Tag and Worksheet Syntax. Data Tags can use all of the Worksheet Functions. You just prepend the WS function with #WS_ and end the entire WS function with a # #WS_IF(((Door.Width>5) & (Door.Configuration='Folding')), Door.Configuration, '')# So the above line will (in my document with imperial units) display the configuration IF the door is more than 5 feet wide AND has a configuration of Folding. Note that inside the WS statement you don't use the # around the variables. You just use the regular WS syntax. Please note that if your Record or Field names have a space in them you need to surround them with single quote marks. This can be easier to read or harder to read, but it does give you more options. HTH Ask again if you need more help. Quote Link to comment
Thomas W Posted December 6, 2022 Author Share Posted December 6, 2022 Thank you very much for those explanations! It helped me to make the data label below which contains a line which can be empty and one which will be in color according to the choice made: Merci beaucoup pour ces explications! Ca m'a aidé à faire l'étiquette de données ci-dessous qui contient une ligne qui peut être vide et une qui sera en couleur suivant le choix réalisé : The data label is divided into 3 label fields: the 1st part up to Line 4, the 2nd for Line 5 in red, the 3rd overlapping the 2nd for the text in black: L'étiquette de données est divisée en 3 champs d'étiquettes: la 1ère partie jusqu'à la Ligne 4, la 2ème pour Ligne 5 en rouge, la 3ème superposée à la 2ème pour le texte en noir : Attached is the .vwx file Thanks again Pat and have a nice day! Ci-joint le fichier .vwx Merci encore Pat et bonne journée! Etiquette de données sans ligne vide et ligne en Couleur_ok forum.vwx 1 Quote Link to comment
Michal Zarzecki Posted April 27, 2023 Share Posted April 27, 2023 Hi guys, Unfortunately I don't have anything to contribute to the discussion above, but I am coming with my own question regarding text colour in Data Tags and Callouts. I may be doing something wrong but I cannot get the text colour to change by class - only the leader does. My text style is set to black, but when used in Dimensions it assumes the class colours, no problem. Is this possible for Data Tags and Callouts too? Quote Link to comment
Tom W. Posted April 27, 2023 Share Posted April 27, 2023 21 minutes ago, Michal Zarzecki said: Hi guys, Unfortunately I don't have anything to contribute to the discussion above, but I am coming with my own question regarding text colour in Data Tags and Callouts. I may be doing something wrong but I cannot get the text colour to change by class - only the leader does. My text style is set to black, but when used in Dimensions it assumes the class colours, no problem. Is this possible for Data Tags and Callouts too? You need to put the Text object itself in the class. Edit the Tag Layout + select the text ('Text in Tag Layout' object) + assign it to your chosen class Quote Link to comment
Thomas W Posted April 27, 2023 Author Share Posted April 27, 2023 Hi, I'm not sure I fully understand the problem but I think it's possible for data labels with some precautions: On the screenshot below the 7 data labels are in the General class which has a blue tint, but only 4 are blue because if you edit the formatting of the label you can have other classes which they are black for example, hope this is a good lead? 1 Quote Link to comment
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.