Jump to content
JMR

Data tags and mathematical operations?

Recommended Posts

Is it possible to do math with data tags?

 

Example:

A Data tag reads the door rough opening width 1100. 

The number 1100 is divided by 100, leaving 11. Letter M is added, thus final text on the tag would be "11M“.

 

This is just one example, I can think of many others uses as well.

 

 

 

 

Share this post


Link to post

Yes, it is possible. The formula for the example you've given would be "#Door#.#ROWidth# / 100 M". However, you can also change the units in which the result is shown, as I suspect that is what you want. The pop-ups are below the "Parameter Name" pop-up and the formula would be "#Door#.#ROWidth##m_0_1#".

  • Like 1

Share this post


Link to post

Excellent, thank you! This is very good news indeed.

 

In this case it's about the local door size denotation standards, the so called "modules" =M =100mm.

 

 

Share this post


Link to post

I'm not having success. I tried to calculate cost of sheet goods, where is would show #Area# *.5  (for 50 cents a square foot), the data tag shows '150 sq ft * .5' without doing the math

Share this post


Link to post

If you just use #Area# do you get the unit marks? If so, then it is probably returning a string instead of a number and math only works on numbers. For many of the PIOs, there are fields that are the numeric version and fields that are the string version including the units. I don't know if there is a numeric version of the Area function.

Share this post


Link to post

Adding the zero to 0.5 makes it work, but it still keeps the units as square feet. Using VALUE(#AREA#) returns VALUE(150 sq ft). It works in the report, but not in the tag

Share this post


Link to post

Data Tags use a different system for formulas from worksheets. Try using "#AREA#  / 1sq ft * 0.5". You should use the unit in which you'd display the area (the document unit as it is written here or the unit you've selected from the unit popup) and keep the 1 and the unit mark without a space between them.

  • Like 1

Share this post


Link to post

Now I have a nice data tag displaying the door size automatically, thank you all!

 

The only thing missing is: How to read the handedness of the door automatically? Anyone know if this is possible?  With worksheets I've looked into a combination of  IsFlipped and rotation and IF formulas, but so far no solution for all situations.

 

If we could solve this last bit, then there would be no need for manual size and handedness input any longer, eliminating the possibility of errors.

Share this post


Link to post

Since VW26 the Data Tag also has a conditional expression. If that is all you use in the worksheet it should be possible to do it in the Data Tag. What exactly is your worksheet formula?

Share this post


Link to post

Currenty I'm using =IF((C2=1); '-L'; '-R')

 

This refers to IsFlipped column. For simple door, IsFlipped returns 0 if the door is not flipped (right-handed) and 1 if it's flipped (left-handed).

 

BTW I just realized why "IsFlipped" works on a swing simple but not always on a swing bi-part door.  When drawing a double leaf door,  if the door is flipped in plan and the larger, active leaf is "leaf 2", then the "IsFlipped" value will be misleading. If the active, larger leaf is "leaf1", then it works properly.

 

Below is an example: The door is not flipped, even though it is "left" handed. Leaf 1 is the smaller leaf, thus creating confusion.

 

kuva.thumb.png.62c00f73ae22b043e42a573e9637d4e4.png

 

 

The correct way to draw this would be to flip the door (IsFlipped=1=left) and give the active leaf the larger width.

 

kuva.thumb.png.ba661c26d5459d94a0d8ed89917618fa.png

 

Am I missing something...or can one use the "IsFlipped" to indicate handedness automatically, if one is careful with double doors...?

 

 

Share this post


Link to post

Sorry, I thought IsFlipped is a parameter of the door. I don't think you recreate the formula 1 to 1 in the Data Tag. However, the syntax for conditions is "<ExprIfTrue>@"<Condition> : <ExprIfFalse>". Hope this can help somehow. As for the doors: I'm not really familiar with them and can't help there.

Share this post


Link to post

Not quite sure how to use <ExprIfTrue>@"<Condition> : <ExprIfFalse>". in a data tag.

I'm trying to make a tag that will look at the area of a rectangle, and if the area is over 100, will say "too large". I tried =IF((#AREA#>100), 'Too Large', 'Too small'), which will work in a worksheet, but not in a tag. What am I missing?

Share this post


Link to post

@MSLD the formula you should use for this is:

"Too Large"@#AREA#>100sq m:"Too small"

 

As @TDimov said, the data tag condition expression is: <Value_If_True>@<The_Condition>:<Value_If_False>

Note, you have to be careful with the spaces around the condition, it does not expect any spaces.

 

It is known problem that the Data Tag uses its own syntax for the formulas. It's at the top of our list to make it use Worksheet formulas in the future.

 

  • Like 1

Share this post


Link to post

Brilliant. Thank you. Is there any documentation for that? Or should I not bother making data tags if the syntax is going to change.

Share this post


Link to post

@MSLD Well, we always see to convert over when we change things.

 

So please, don't hesitate to use it at its full capabilities. You can get really nice results.

 

As for help, click F1 on the Define Tag Field dialog, it leads here:

https://app-help.vectorworks.net/2021/eng/index.htm#t=VW2021_Guide%2FAnnotation%2FCreating_data_tag_styles.htm%23CSH_41

 

The collapsed parameters on #8 is talking about the field definition syntax.

  • Like 1

Share this post


Link to post
15 hours ago, Vlado said:

It is known problem that the Data Tag uses its own syntax for the formulas. It's at the top of our list to make it use Worksheet formulas in the future

 

This was going to be my next question. If I interpret this correctly, in the future it will be possible, in principle, to use any worksheet function with data tag?  Including the "IsFlipped" function.

Share this post


Link to post
1 minute ago, JMR said:

 

This was going to be my next question. If I interpret this correctly, in the future it will be possible, in principle, to use any worksheet function with data tag?  Including the "IsFlipped" function.

That's the goal.

  • Like 1

Share this post


Link to post

I'm currently trying to do something like this:

 

"#ΔX# / 3000"    -this way the division calculation works fine

"3000 / #ΔX#"    -doesn't work, the characters "3000 /" are just printed and not included in the calculation.

 

How do I divide some number with eg. delta X? Is there a specific syntax that I should use?

 

BTW vesion 2020 SP6 so far.

 

Share this post


Link to post

Strange. if I write

3000*#ΔX#   - works

3000/#ΔX#    -doesn't work

 

 

Share this post


Link to post

@JMR In 2021 the calculation logic was completely changed and is more lenient. In 2020 there were strict restrictions on the operands. "#ΔX# / 3000" divides a length by a scalar which is in itself a length. "3000*#ΔX#" is similar in that it multiples instead of dividing. "3000 / #ΔX#" would divide a scalar by a length which would result in a unit of 1/m. It's not a standard VW unit so I chose to prohibit such calculations. Should be doable in 2021 but if you provide more details of what you want to achieve I may offer a workaround for 2020.

Share this post


Link to post

Ok thanks. I do have VSS so I guess it's time to update very soon.

 

I'm designing a facade with fibre-concrete sheets that come in size 1200x3000mm. Ideally, the most economic divisions are therefore eg. 300,400,600 and 300,500, 600,1000 etc.

 

I'm trying to use the data tag as a tool to quickly check and demonstrate to the client if the desired sheet can be economically cut out from a 1200x300 full-size sheet. This has to do with finding the optimal solution when it comes to looks and waste/cutting.

 

"#ΔX# / 3000" kind of works but it returns 0.33 for a 1000mm etc, not so easily demonstrated to a client.

 

 

 

 

 

Share this post


Link to post

I think the following should be of use to you:

Create a new record format and add a dimension field.

Attach the record to the Data Tag or the tagged object.

Change the formula to be "#Record#.#Field# / #ΔX#".

The result would be a scalar (I think what you need - the number of divisions from the sheet).

Share this post


Link to post

Thank you.

I got it working for a second, then it disappeared and can't get it to work...enclosed is a sample file, in case you'd want to take a look?

 

The definition reads:

#ΔX#x#ΔY#
circumference #PERIM#
area #AREA##sq m_0_1#
#datataghelper#.#FullLength# / #ΔX#
#datataghelper#.#FullWidth# / #ΔY#

 

What I see

 

kuva.thumb.png.bb1cd392450211d7dc229e76ba63829f.png

data-tag test.vwx

Share this post


Link to post

Helper record is set to "integer"...is this correct?

 

kuva.thumb.png.b2a39a3e395ea766d00d2de8bbfc3bad.png

 

 

Share this post


Link to post

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.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...