[Smtk-developers] Help

Shukla, Indu ERDC-RDE-ITL-MS Indu.Shukla at erdc.dren.mil
Thu Jul 9 11:26:06 EDT 2015


David, Yumin

Your sample code helped me so much. I was able to retrieve each and every
value from the multiple instances of attribute definition. But still I am
stuck in one.
I want to find the path of file I found using the file browser.

This is the code I am trying to work.

mesh = asys.findAttribute('Model')
meshgr = mesh.findGroup('Existing')
meshVal = smtk.attribute.to_concrete(gr.find('ExistingMeshFile¹))


Here¹s the XML

<AttDef Type="Model" Label="Model" BaseType="" Version="0" Unique="true">
    <ItemDefinitions>
      <!--**********  Existing ***********-->
      <Group Name="Existing" Label="Existing" NumberOfRequiredGroups="1">
        <ItemDefinitions>
          <File Name="ExistingMeshFile" Label="Mesh file (*.2dm)"
NumberOfRequiredValues="1" FileFilters="CMB Edge, Surface and Volume Mesh
Files(*.1dm *.2dm *.3dm );;All files (*.*)">
            <DefaultValue>existing_mesh.2dm</DefaultValue>
          </File>
          <File Name="ExistingHOTFile" Label="HOT file (*.hot)"
NumberOfRequiredValues="1" FileFilters="CMB Edge, Surface and Volume Mesh
Files(*.hot);;All files (*.*)">
            <DefaultValue>existing_mesh.hot</DefaultValue>
          </File>
          <File Name="ExistingBCFile" Label="ADH bc file (*.bc)"
NumberOfRequiredValues="1" FileFilters="(*.bc);;All files (*.*)">
            <DefaultValue>existing_mesh.bc</DefaultValue>
          </File>
          <String Name="Description" Label="Description: "
NumberOfRequiredValues="1" MultipleLines="true"/>
        </ItemDefinitions>
      </Group>
      <!--**********  Planned ***********-->
      <Group Name="Planned" Label="Planned" NumberOfRequiredGroups="1">
        <ItemDefinitions>
          <File Name="PlannedMeshFile" Label="Mesh file (*.2dm)"
NumberOfRequiredValues="1" FileFilters="CMB Edge, Surface and Volume Mesh
Files(*.1dm *.2dm *.3dm );;All files (*.*)">
              <DefaultValue>planned_mesh.2dm</DefaultValue>
          </File>
          <File Name="PlannedHOTFile" Label="HOT file (*.hot)"
NumberOfRequiredValues="1" FileFilters="CMB Edge, Surface and Volume Mesh
Files(*.hot);;All files (*.*)">
            <DefaultValue>planned_mesh.hot</DefaultValue>
          </File>
          <File Name="PlannedBCFile" Label="ADH bc file (*.bc)"
NumberOfRequiredValues="1" FileFilters="(*.bc);;All files (*.*)">
            <DefaultValue>planned_mesh.bc</DefaultValue>
            </File>
          <String Name="Description" Label="Description: "
NumberOfRequiredValues="1" MultipleLines="true"/>
        </ItemDefinitions>
      </Group>
    </ItemDefinitions>
  </AttDef>

Thanks!

Indu



On 6/26/15, 3:37 PM, "David Thompson" <david.thompson at kitware.com> wrote:

>Hi Indu,
>
>> Tide and wind and the tabular entries in my form.  There will be no
>>fixed number of entries for tide and wind, they can vary according to
>>the situation. In this test example I sent you, I  only have  one each
>>for tide (Tide-0) and wind (Wind-0).
>> I need to know,
>> 1. How many of tide entries are there
>> 2. How many wind entries are there.
>
>tideAtts = asys.findAttributes('Tide')
>windAtts = asys.findAttributes('Wind')
>print len(tideAtts)
>print len(windAtts)
>
>You can then run "for tideAtt in tideAtts:" to process each tide or wind
>attribute in the returned list.
>
>> 3. Then access the items(Gage Station,{Station,Agency,Station ID}) and
>>its values (Gage Station,{station,0,1234})  of each tide and wind
>>entries. 
>
>Access to these items is as in the previous e-mail, except that you can
>access items by their integer position in the attribute:
>
>smtk.attribute.to_concrete(smtk.attribute.to_concrete(tideAtts[0].item(0))
>.item(0)).name()
>smtk.attribute.to_concrete(smtk.attribute.to_concrete(tideAtts[0].item(0))
>.item(0)).value(0)
>
>	David



More information about the Smtk-developers mailing list