Jump to content

Color text in DataTag


Recommended Posts

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,

 

 

1461060763_Capturetiquetteouonveutdutexteencouleur.thumb.png.9c6f30feb65803a69a41bc1b34a04881.png

 

246543594_CapturefonctionWS.thumb.png.559f499b0568f9e4c9d6551306807ea2.png

 

Merci et bonne journée,

 

Thomas

 

Etiquette de données sans ligne vide - une partie de ligne en Couleur.vwx

Edited by Thomas W
Link to comment

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.

 

image.png.996c332c6c21822ac9be1203baa5ccbd.png

 

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.

  • Like 2
Link to comment

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 by Thomas W
Link to comment

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.

Link to comment

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é :

 

1211905162_Captureokavectextecouleur.thumb.png.3f54f59feda36c68468a4d137e288a0f.png

1325892232_Captureokavectextenoiretlignevide.thumb.png.bdc56bf69affcd9a1f1ca965c555f95f.png

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 :

 

1642557938_Miseenformetiquette_3champsdtiquettepourletexte.thumb.png.3711c8d7ac4999253073651b05310315.png

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

  • Like 1
Link to comment
  • 4 months later...

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?

Link to comment
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

Link to comment

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?

 

01.thumb.png.17f197668f87eb547c43657825addf21.png

  • Like 1
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...