June 17, 2006

Separating Structural Shape Names in a Complex Structural Member Style

Structural Member Styles can have up to ten components. The Shape Designation - List Automatic Property Source returns a "list" of the starting shapes used by the components of a Structural Member Style. The name of each shape appears in order, separated by a semicolon from the other shapes. For example, a steel column shape with three components, a 12x12 base plate, a W8x28 column and a 12x12 top plate, would be listed as "12x12;W8x28;12x12", assuming that "12x12" and "W12x28" were the shape names for the plate and column components.

If you wanted to create a tag that listed a particular shape name, or had some other need to have access to the individual shape names, you can use a series of Formula properties, one for each component/shape name. A sample file with one approach to doing this has been posted in response to a question raised in my AUGI Training Program course on Formula Properties [ATP121]. To assure access to the file after the course concludes, I have also posted the file to this thread in the Autodesk Architectural Desktop Content Discussion Group.

In the formulas, the first thing I did was to append a semicolon onto the end of the string returned by the Shape Designation - List Automatic Property Source. This creates a string in which every shape name is followed by a semicolon and allows every shape name to be processed in the same way.

While similar formulas could be used for all ten shape names, I chose to simplify the first formula as no initial processing of the string is required; all that is needed is to extract the first shape name in the string. The VBScript Left function is used to do the extraction; the InStr function is used to determine the character position of the first semicolon, and one is subtracted from that to return just the first shape name. Here is the formula for the first structural shape name:
shapeList = "[ShapeDesignation-List]" & ";"
RESULT = Left( shapeList, InStr( 1, shapeList, ";", 0 ) - 1 )

The formulas for shape names two through ten are identical, except for the value set assigned to the shapeNumber variable, which determines which shape name gets returned [2 = second shape name, 3 = third shape name, etc]. A Do While Loop statement is used to execute the code that removes the leading shape name and its trailing semicolon until the desired shape name is at the head of the string. Then the resultant string is processed using the same code as used in the formula for the first shape name. There is one extra wrinkle here, to accommodate Stuctural Member Styles that use less than ten components - after each truncation, the resultant string is tested to see if it is an empty string. If so, the Do While Loop is immediately exited. An empty string is returned if there is no component assigned to that number, otherwise the shape name is returned. Here is the formula for the second through tenth structural shape names, shown for the tenth name:
shapeList = "[ShapeDesignation-List]" & ";"
shapeNumber = 10
loopCount = 1
Do While shapeNumber > loopCount
shapeList = Mid( shapeList, InStr( 1, shapeList, ";", 0 ) + 1 )
If shapeList = "" Then
Exit Do
End If
loopCount = loopCount + 1

If shapeList = "" Then
RESULT = shapeList
RESULT = Left( shapeList, InStr( 1, shapeList, ";", 0 ) - 1 )
End If

The sample file contains a ten-component Structural Member Style called TestColumn, and a two-component Structural Member Style called TestColumn2, samples columns using these styles are shown below.

The style name property values for the ten-component style looks like this:

The style name property values for the two-component style looks like this:

No comments: