Returns a 1D read-only Array object containing the data defined by this attribute. If ICEAttribute.IsConstant is true, the array has only one item which contains the constant value. Returns an empty array if the attribute's structure type is not a singleton.
# # This example shows how to access all attribute data on a geometry. # from win32com.client import constants xsi = Application xsi.CreatePrim("Cone", "MeshSurface", "", "") attrs = xsi.Selection(0).ActivePrimitive.Geometry.ICEAttributes; for attr in attrs: xsi.LogMessage( "*******************************************************************" ) xsi.LogMessage( "Name: " + attr.Name ) xsi.LogMessage( "DataType: " + str(attr.DataType) ) xsi.LogMessage( "StructType: " + str(attr.StructureType) ) xsi.LogMessage( "ContextType: " + str(attr.ContextType) ) xsi.LogMessage( "IsDefined: " + str(attr.IsDefined) ) xsi.LogMessage( "IsConstant: " + str(attr.IsConstant) ) xsi.LogMessage( "Readonly: " + str(attr.IsReadonly) ) xsi.LogMessage( "AttributeCategory: " + str(attr.AttributeCategory) ) xsi.LogMessage( "Element count: " + str(attr.ElementCount) ) if attr.IsDefined == 0 : continue dataType = attr.DataType; data = attr.DataArray; for elem in data: if dataType == constants.siICENodeDataFloat: xsi.LogMessage( "float: " + str(elem) ) elif dataType == constants.siICENodeDataLong: xsi.LogMessage( "long: " + str(elem) ) elif dataType == constants.siICENodeDataBool: xsi.LogMessage( "bool: " + str(elem) ) elif dataType == constants.siICENodeDataVector3: xsi.LogMessage( "Vector3: " + str(elem.X) + ":" + str(elem.Y) + ":" + str(elem.Z) ) elif dataType == constants.siICENodeDataQuaternion: xsi.LogMessage( "Quaternion: " + str(elem.W) + ":" + str(elem.X) + ":" + str(elem.Y) + ":" + str(elem.Z) ) elif dataType == constants.siICENodeDataRotation: xsi.LogMessage( "Rotation: " + str(elem.RotX) + ":" + str(elem.RotY) + ":" + str(elem.RotZ) ) elif dataType == constants.siICENodeDataMatrix33: xsi.LogMessage( "Matrix33:" ); xsi.LogMessage( str(elem.Value(0,0)) + ":" + str(elem.Value(0,1)) + ":" + str(elem.Value(0,2)) ) xsi.LogMessage( str(elem.Value(1,0)) + ":" + str(elem.Value(1,1)) + ":" + str(elem.Value(1,2)) ) xsi.LogMessage( str(elem.Value(2,0)) + ":" + str(elem.Value(2,1)) + ":" + str(elem.Value(2,2)) ) elif dataType == constants.siICENodeDataMatrix44: xsi.LogMessage( "Matrix44:" ); xsi.LogMessage( str(elem.Value(0,0)) + ":" + str(elem.Value(0,1)) + ":" + str(elem.Value(0,2)) + ":" + str(elem.Value(0,3))) xsi.LogMessage( str(elem.Value(1,0)) + ":" + str(elem.Value(1,1)) + ":" + str(elem.Value(1,2)) + ":" + str(elem.Value(1,3))) xsi.LogMessage( str(elem.Value(2,0)) + ":" + str(elem.Value(2,1)) + ":" + str(elem.Value(2,2)) + ":" + str(elem.Value(2,3))) xsi.LogMessage( str(elem.Value(3,0)) + ":" + str(elem.Value(3,1)) + ":" + str(elem.Value(3,2)) + ":" + str(elem.Value(3,3))) elif dataType == constants.siICENodeDataColor4: xsi.LogMessage( "Color:" ); xsi.LogMessage( str(elem.Red) + ":" + str(elem.Green) + ":" + str(elem.Blue) + ":" + str(elem.Alpha) ) elif dataType == constants.siICENodeDataString: xsi.LogMessage( "String: " + elem ); # Expected results: # INFO : ******************************************************************* # INFO : Name: SurfaceGeometricNormal # INFO : DataType: 16 # INFO : StructType: 1 # INFO : ContextType: 1048576 # INFO : IsDefined: False # INFO : IsConstant: False # INFO : Readonly: True # INFO : AttributeCategory: 1 # INFO : Element count: 0 # INFO : ******************************************************************* # INFO : Name: Volume # INFO : DataType: 4 # INFO : StructType: 1 # INFO : ContextType: 1 # INFO : IsDefined: True # INFO : IsConstant: True # INFO : Readonly: True # INFO : AttributeCategory: 1 # INFO : Element count: 1 # INFO : float: 3.77123618126 # etc. |