AutoCAD Architecture General Discussion

AutoCAD Architecture General Discussion

Reply
Active Contributor
haynesc87
Posts: 43
Registered: ‎02-05-2011
Message 1 of 4 (212 Views)
Accepted Solution

Formula

212 Views, 3 Replies
03-26-2012 06:36 AM

Hi

 

I have an object anchored to another all with the following properties:

 

Space_Prop - PSD

 

Building_Floors

Podium_Floors

 

Total_Floors = Building_Floors + Podium_Floors

 

What formula would i need for [Total_Floors] to say something similar to this :

 

IF Podium_Floors = *Anchor cannot be found*, Then RESULT = 0

ElseIF, RESULT = [Building_Floors] + [Podium_Floors]

EndIF

Almost, but not quite.  You corrected the syntax on the If statement, but now your problem is that when you have an Anchor property on an object that is either not anchored, or is anchored to an object that does not have the PropertySet:smileytongue:roperty specified in the Anchor property attached, while the result is displayed as *Anchor not found* and might appear to be a string value, the actual value is an error condition, so any formula property that directly evaluates the Anchor property will fail.

 

The work around is to bring in the Anchor property enclosed in quotation marks, so that it becomse a string, and then to process it accordingly.  You did not provide a sample file, so I have no idea what types of objects you are using or how they are anchored, but assuming [Podium_Floors] is a reference to an Anchor property in the current Property Set and that it references a numeric property in the object to which the object that has this Property Set attached is anchored, and [Building_Floors] is a reference to a numeric property in the current Property Set, then this should work for you:

 

If "[Podium_Floors]" = "*Anchor not found*" Then

RESULT = [DoorProp01]

Else

RESULT = [DoorProp01] + CDbl ( "[Podium_Floors]" )

End If

 

The CDbl in the Else RESULT line takes the value of [Podium_Floors], which has been made a string, back into a real number.  If [Podium_Floors] is an integer value, you could use CInt instead of CDbl.

 

All items in square brackets ("[propertyreference]") have to be properly created property references in the formula property, and if the source properties have a Property Data Format applied that adds a non-numeric prefix or suffix, you will need to change the Format in the Enter Sample Values area to one that leaves a raw numeric value.  If the values are real numbers, you may want to create a Property Data Format that maximizes the precision to minimize rounding issues.

 

The attached file uses Walls and Doors as a test bed for dealing with Anchor properties.  The DP01_plus_WP01 formula property shows that the formula noted above can work.  In the file, the GWB and metal stud Wall on the left has the WallObjects01 Property Set attached.  The concrete Wall on the right does not.  Each Wall has a Door and there is also a free-standing (unanchored) Door.  All three Doors have the DoorObjects01 Property Set attached, and the formula property returns a value for all three doors, even though only the Door in the GWB Wall gets a value through the Anchor property.

 

If you want to read more about handling "*XXX not found*" in formula properties, the following blog article addresses this issue (with a Location property as the source of the "not found" property, but it also applied to Anchor properties):

http://architects-desktop.blogspot.com/2007/02/dealing-xxx-not-found-location-property.html

Active Contributor
haynesc87
Posts: 43
Registered: ‎02-05-2011
Message 2 of 4 (192 Views)

Re: Formula

03-28-2012 03:31 AM in reply to: haynesc87

Still struggiling to find the right formula for this has anyone managed to have a look ?

Active Contributor
haynesc87
Posts: 43
Registered: ‎02-05-2011
Message 3 of 4 (186 Views)

Re: Formula

03-28-2012 04:06 AM in reply to: haynesc87

This doesnt work, but it should be something like this ?

 

PF = [Podium-Object:smileytongue:odium_Floors]
If PF = *Anchor not found* Then
RESULT = [Block-Object:Building_Floors]
Else
RESULT = [Block-Object:Building_Floors]+[Podium-Object:smileytongue:odium_Floors]
End If

*Expert Elite*
David_W._Koch
Posts: 2,525
Registered: ‎12-09-2003
Message 4 of 4 (180 Views)

Re: Formula

03-28-2012 05:29 AM in reply to: haynesc87

Almost, but not quite.  You corrected the syntax on the If statement, but now your problem is that when you have an Anchor property on an object that is either not anchored, or is anchored to an object that does not have the PropertySet:smileytongue:roperty specified in the Anchor property attached, while the result is displayed as *Anchor not found* and might appear to be a string value, the actual value is an error condition, so any formula property that directly evaluates the Anchor property will fail.

 

The work around is to bring in the Anchor property enclosed in quotation marks, so that it becomse a string, and then to process it accordingly.  You did not provide a sample file, so I have no idea what types of objects you are using or how they are anchored, but assuming [Podium_Floors] is a reference to an Anchor property in the current Property Set and that it references a numeric property in the object to which the object that has this Property Set attached is anchored, and [Building_Floors] is a reference to a numeric property in the current Property Set, then this should work for you:

 

If "[Podium_Floors]" = "*Anchor not found*" Then

RESULT = [DoorProp01]

Else

RESULT = [DoorProp01] + CDbl ( "[Podium_Floors]" )

End If

 

The CDbl in the Else RESULT line takes the value of [Podium_Floors], which has been made a string, back into a real number.  If [Podium_Floors] is an integer value, you could use CInt instead of CDbl.

 

All items in square brackets ("[propertyreference]") have to be properly created property references in the formula property, and if the source properties have a Property Data Format applied that adds a non-numeric prefix or suffix, you will need to change the Format in the Enter Sample Values area to one that leaves a raw numeric value.  If the values are real numbers, you may want to create a Property Data Format that maximizes the precision to minimize rounding issues.

 

The attached file uses Walls and Doors as a test bed for dealing with Anchor properties.  The DP01_plus_WP01 formula property shows that the formula noted above can work.  In the file, the GWB and metal stud Wall on the left has the WallObjects01 Property Set attached.  The concrete Wall on the right does not.  Each Wall has a Door and there is also a free-standing (unanchored) Door.  All three Doors have the DoorObjects01 Property Set attached, and the formula property returns a value for all three doors, even though only the Door in the GWB Wall gets a value through the Anchor property.

 

If you want to read more about handling "*XXX not found*" in formula properties, the following blog article addresses this issue (with a Location property as the source of the "not found" property, but it also applied to Anchor properties):

http://architects-desktop.blogspot.com/2007/02/dealing-xxx-not-found-location-property.html

David Koch
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.