ENS_OBJATTR Schema

Parent Previous Next

ENS_OBJATTR Schema

This schema provides a mechanism for a reader to declare a "Default" set of attribute values that it would like to have set when the matching part name comes into existence.  The schema is named "ENS_OBJATTR".  The value of the tag is a string which is interpreted as a Python dictionary.  The dictionary is reconstructed on the client and passed to the object's setattrs() member when the part is loaded.  As an example, the XML line:

 

<part name="example" ENS_OBJATTR="{enums.COLORBYRGB: [1.,0.,0.]}"</part>

 

Results in the following operations on the client:


from ensight.objs import *

group = core.find_objs(core.PARTS, filter={enums.DESCRIPTION: "example"}, group=1)

dict = eval("{enums.COLORBYRGB: [1.,0.,0.]}")

group.setchildattrs(dict)


That is, find the objects by the given name and set the attributes (via dictionary).

An example of the schema that set the default color of "mypart" to red would be:

 

<CEImetadata version="1.0"> 
  <parts>
    <metatags>
      <tag name="ENS_OBJATTR" type="str"></tag>
    </metatags>
    <partlist>
      <part name="mypart" ENS_OBJATTR="{enums.COLORBYRGB: [1.,0.,0.]}"></part>
    </partlist>
  </parts>
  <case>
    <metatags>
      <tag name="ENS_OBJATTR" type="flt">1.0</tag>
    </metatags>
  </case>
</CEImetadata>