Instance Export

Discussion created by rhexter on May 1, 2012
Latest reply on May 3, 2012 by MBuehler-esristaff
So guys I think I'm having a problem with the data coming out of a report, here I use one instance building as an example:


The image shows the placement of a single instance of a model,
below image left: (green, yellow, blue highlights) show the report data dumped
below image right: corresponding highlights snapshot of the report UI

1) I see only one model placed in the viewport, the report thinks there are two models of the same type(in this case). I can understand there could be more than one model, as we could hypothetically have many objects placed along with this one model as further detail. This is not the case with this example.

..the larger issue since we can have more than one model

2) the format of the dictionary received back from the python cmd appears incorrect, instead of a dictionary of dictionaries we have this funky dictionary with lists.
I initially concluded that each element of each list (example element [0] in each list) for each key (xpos, xrot, etc) would correspond to each model (asset[0] or asset[1]),
however this does not appear to be the case as the list elements indices are mixed up when compared to the data in the report within the inspector (the min and max values). Since the min max values are not the same, I conclude this to be the reason for the two elements in each key within the dict.


{'asset': ['/Example_Instance_City__2011_2/assets/stra_bld_41.obj',
'xpos': [-196.50341796875, -25.73431396484375],
'xrot': [0.0, 0.0],
'xscale': [1.2198159669490822, 0.04303470562802464],
'ypos': [188.96078491210938, 188.9607925415039],
'yrot': [28.259279251098633, -24.37846565246582],
'yscale': [1.19670941334878, 0.022371693164823615],
'zpos': [30.52911376953125, 4.428466796875],
'zrot': [0.0, 0.0],
'zscale': [1.173602692726634, 0.0017086774440385223]}

3) There appears to be an inconsistency, I could not use the data in this dict to transfer to a gameEngine, i need to ensure that the values that are in the min max columns for each entry are at a consistent indices in the lists for each key in the dict that is generated (I have 27k instances in my scene I would not want to check manually):

'asset': element[0]
'xpos': element[0] = MinValue from report
'yrot': element[0] = MaxValue from report
'zscale': element[0] = MaxValue from report

Is this a bug?

A Suggestion
It may be more appropriate to generate something like this as output for the dict from the report function (report=model.getReports()):

         'asset': '/Example_Instance_City__2011_2/assets/stra_bld_41.obj',
         'xpos': -196.50341796875, 'xrot': 0.0, 'xscale': 1.2198159669490822,
         'ypos': 188.96078491210938, 'yrot': 28.259279251098633, 'yscale': 1.19670941334878,
         'zpos': 30.52911376953125, 'zrot': 0.0, 'zscale': 1.173602692726634

         'asset': '/Example_Instance_City__2011_2/assets/stra_bld_41.obj'],
         'xpos': -25.73431396484375, 'xrot': 0.0, 'xscale': 0.04303470562802464,
         'ypos': 188.9607925415039, 'yrot': -24.37846565246582, 'yscale': 0.022371693164823615,
         'zpos': 4.428466796875, 'zrot':0.0, 'zscale':0.0017086774440385223,
               'asset': '/Example_Instance_City__2011_2/assets/stra_window_3.obj'],
               'xpos': [-25.73431396484375, ....], 'xrot': [0.0, ....], 'xscale': [0.04303470562802464, ...]
               'ypos': [188.9607925415039, ....], 'yrot': [-24.37846565246582,...], 'yscale': [0.022371693164823615, ....],
               'zpos': [4.428466796875, ...], 'zrot':[0.0, ....], 'zscale':[0.0017086774440385223, .....]
Nest the dicts, keep the lists for multiple instances of the same asset:

A function on the user side, externally, can then recursively search with in each dict to look for an AssetUUID key to access those nested instances if required.