You are here: Surpac Concepts > Macros > SCL > Block Model Commands > SclBlockModelGetAttributes
GEOVIA Surpac

Block Model Get Attributes

Overview

You use this command to get a full list of attributes, their data types, number of decimals, background values, and descriptions, from a specified block model. To use this function, the block model must be open in Surpac.

Synopsis

SclBlockModelGetAttributes $bmHandle attributeNames attributeTypes attributeDecimals attributeBackgroundValues attributeDescriptions

Description

Lists the names, types, number of decimals, background values, and descriptions of each attribute in the block model that is open. The possible attribute types are integer, character, float, real, and calculated.

The list contains the geometry attributes, of real data type, that exist. That is:

  • _xorg
  • _yorg
  • _zorg
  • _xcen
  • _ycen
  • _zcen
  • _xext
  • _yext
  • _zext

For the geometry attributes, number of decimals, background values, and descriptions are returned as empty strings.

Arguments

Argument Description
bmHandle Passed by value. The handle to the block model. You can obtain the handle by calling the SclBlockModelGetCurrentModel command.
attributeNames Passed by reference. The name of the variable that is assigned to the list of attributes.
attributeTypes Passed by reference. The name of the variable that is assigned to the list of attribute types.
attributeDecimals Passed by reference. Optional. The number of decimals in the attribute.
attributeBackgroundValues Passed by reference. Optional. The background value of the attribute.
attributeDescriptions Passed by reference. Optional. The description, if there is one, of the attribute.

Returns

Returns $SCL_TRUE if the list of attribute name and types is correctly set. Returns $SCL_FALSE if the block model handle is invalid or the number of parameters is incorrect.

Examples

#Retrieve the list of attribute names, types, decimals, background values and descriptions 
#for the currently open block model.
#Output them to the Surpac Message window.
set bm [SclBlockModelGetCurrentModel]
set result [SclBlockModelGetAttributes $bm attributeNames attributeTypes attributeDecimals\
 attributeBackgroundValues attributeDescriptions]
puts "Attribute Names: $attributeNames"
puts "Attribute Types: $attributeTypes"
puts "Attribute Decimals: $attributeDecimals"
puts "Attribute Background Values: $attributeBackgroundValues"
puts "Attribute Descriptions: $attributeDescriptions"

for {set i 0} {$i < [llength $attributeNames]} {incr i} {
	puts ""
	puts "Attribute ${i}"
	puts "Name=[lindex $attributeNames $i]"
	puts "Type=[lindex $attributeTypes $i]"
	puts "Decimals=[lindex $attributeDecimals $i]"
	puts "Background value=[lindex $attributeBackgroundValues $i]"
	puts "Description=[lindex $attributeDescriptions $i]"
	}