April 15, 2007

ACA 2008/ADT 2007: Setting a Different Property Data Format in a Formula Property

A new feature added to Autodesk® Architectural Desktop 2007 and also available in AutoCAD® Architecture 2008 builds on the addition of the Sample Value pane to the Formula Property Definition dialog in the 2006 release. The Sample Value pane allows you to test the formula you have written by entering sample values for the other properties referenced by the formula. The 2006 release listed the Property Data Format [PDF] that was assigned to each referenced property; starting in the 2007 release, you can change that initial assignment to any of the other PDFs defined in the current drawing.

Not only does the PDF assigned in the Sample Value pane affect the way the sample value is displayed in the Formula Property Definition dialog, it affects the way the value is input to the formula itself. Furthermore, the PDF assigned in the Sample Value pane works on the "raw" value of the referenced property, BEFORE the PDF assigned to the property is assigned. This means that you no longer need to create an unformatted version of a property for use in a formula calculation as well as a formatted version for display in a Schedule Tag or the Properties palette. This can be a big time saver if you never need your formula properties to work in versions of ADT prior to 2007. Since saving back to prior releases without exploding ADT objects is generally a difficult thing to do, most using 2007 or 2008 should be able to take advantage of this feature.

It also means that if you set up a formula that references a property, then later decide to change the PDF assigned to that property, you will also have to go back to the formula property and change the PDF there if you want the changed PDF to be used in the formula property as well. This is how I "discovered" this feature - I had set up a property in ADT 2007, used it in a formula, realized I needed to increase the precision of the PDF assigned to the property, and was surprized to find that the formula property was still acting as though the precision had not been changed. After poking around a bit in the file and making certain that I had actually changed the precision on the property, I finally opened the formula and noticed that the PDF showing in the Sample Value pane was still set to the "old" value, that I could change the PDF to any other one in the file, and that the assigned PDF was what governed the way the data was brought into the formula. I currently use ADT 2004 on a day-to-day basis at work, so it may be possible that back when 2007 came out, I was aware of being able to set a PDF in the Formula Property Definition dialog, but I am fairly certain that I did not understand exactly what that meant until yesterday.

The following screen captures illustrate the potential for this feature. A drawing file was created and the units set to inches, Engineering format, with a precision of eight decimal places, so that the effects of varying precision in the PDF would not be masked by the units or precision in the drawing file. A wall was drawn, with a length of one hundred and five one-hundred-millionths inches [8'-4.00000005"] and a height of one hundred and one two-hundred-fifty-sixth inches [8'-4.00390625"]. The image below shows part of the Design tab of the Properties palette with this wall selected, and shows the length and width in Engineering units, with eight-decimal-place precision.
Two new Property Data Formats were created: Length - Extremely Short, a copy of Length - Short, with the precision increased to 1/256 of an inch...
...and Standard-8, a copy of Standard, with the precision increased to eight decimal places and no zero suppression. [Click on any reduced image to see a full-size version.]
A new Property Set Definition called WallObjectsTest01 was created, and properties referencing the Height and Length automatic property sources were added to it. The Length - Extremely Short PDF was assigned to the Height property and the Standard-8 PDF was assigned to the Length property. Five formula properties were added to the Property Set Definition, to demonstrate the effects of various PDF assignments in the Sample Value pane. Each of the five formula properties simply passes through one of the automatic property values and is assigned the Standard-8 PDF, so that it will display at maximum precision in the Properties palette. A summary of the properties in the WallObjectsTest01 Property Set Definition can be seen in the image below.
The Height-LengthExtremelyShort formula property keeps the default Length - Extremely Short PDF assigned to the Height value.
The Height-Standard formula property changes the PDF assigned to the Height property value in the formula to Standard.
The Height-Standard-8 formula property changes the PDF assigned to the Height property value in the formula to Standard-8.
The Length-Standard formula property maintains the Standard PDF assigned to the Length property.
The Length-Standard-8 formula property changes the PDF assigned to the Length property value in the formula to Standard-8.
The image below shows the values returned by each of the properties in the WallObjectsTest01 Property Set Definition for the test wall previously described.Note the following results:
  • The Height automatic property reports the height in architectural imperial units with a precision of 1/256 of an inch, in this case, the exact value is reported, since the height was set to exactly 8'-4 1/256".
  • The Height-LengthExtremelyShort formula property returns a value of 8. This is an improvement over earlier releases, where the presence of the embedded double quotation mark used as an inch symbol would have caused an error, but the value would likely not result in a correct calculation. Beware using formatted values in formula properties.
  • The Height-Standard formula property returns a somewhat more accurate value, but it is rounded at the third decimal place, because the Standard PDF has a precision of three decimal places. That may well work for certain calculations, but if you need greater precision for a given calculation, you will want to create a PDF that provides it.
  • The Height-Standard-8 formula property returns the full decimal equivalent value, because the eight-decimal-place precision of the Standard-8 PDF is capable of delivering it.
  • The Length automatic property reports a length of 100. This is because it has the Standard PDF assigned, so the precision is limited to three decimal places and trailing zeros are suppressed.
  • The Length-Standard property also reports a length of 100. This is because Standard PDF is applied to the Length value, resulting in a value of 100. When this value is returned from the formula property, it is interpreted as an integer, and the eight-decimal-place precision for real numbers in the Standard-8 format, which is assigned to the formula property itself, does not come into play. If the formula property were amended to include a CDbl function to force the Length value to be interpreted as real number, the result would be 100.00000000, as the five hundred-millionths would have already been lost when the Standard PDF was applied to the Length value.
  • The Length-Standard-8 property reports the actual length of the wall, including the five hundred-millionths, despite the fact that the fractional amount was lost in the reported value of the Length property itself.

1 comment:

Anonymous said...

Great article. Cleared up alot of problems/issues I've had with PSD's.

Thanks David

Scott T