Jump to content

Data tags and units


Recommended Posts

Hi all,

I have a problem with Data Tags.

 

My custom data tag should return window's width. But despite the document units, data tag always shows number in millimetres. Option "document units" is unavailable in edit data tag mode. In my file there is a second tag that works correctly.

 

Second question is, if it is possible to do simple math operations inside data tag definition.

E.g. I want to show in my tag "windows width" - 10.

I tried to use following formula "#CWDObj#.#OpeningWidth# - 10" but it is recognised as text and displays as 1000 - 10 on my tag.

Any hints?

DataTags.vwx

Link to comment

First check what the field type of the PIO are. In the thread below, I posted a script that will create a worksheet listing all (even the hidden ones) and also shows the type of data stored.  In a new file, place an instance of a window directly on the layer (not in a wall), leave it selected and run the script. 

 

From the resulting worksheet you should be able to see what the data type of each field is. If there is a numeric version of the data you are interested in, then we can chase the issue of doing the math in the tag.

 

 

  • Like 3
Link to comment

@Pat Stanford, I used your script and got results (attached file).

'CWDObj'.'OpeningWidth' and 'CWDObj'.'OpeningHeight' are "REAL", so they should be numbers, but they do not change according to current document units.

'CWDObj'.'OIPOpeningWidth' and 'CWDObj'.'OIPOpeningHeight' are "Real - Coordinate Displacement". I have no idea what this kind of data type is, but it is working. Information is correct in terms of document units.

Do you know the difference between these two data types? I can not use math operations on both results, so it looks like they are not numbers.

DataTagFieldsVals.png

Link to comment
  • Vectorworks, Inc Employee

Real parameters are unitless numbers so there's no way to choose a unit for them. If the type is a number representing a distance, area, volume or angle you will be able to change the units. In VW2020 you can't do operations with incompatible number types i.e. distance minus a unitless number. In VW2021 the formula calculation was extended to support such incompatible operations. In the meantime, create a record with a dimension field and attach it to the tagged object or the Data Tag. In the formula subtract that field from #CWDObj#.#OIPOpeningWidth#.

  • 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...