I am trying to export a DAE centered at the point around a selection with a Python script. When I do this manually with the export Wizard, I select "Center" to calculate the global offset. The exported file then contains information with small numbers for the float_arrays, as it appears to have been centered correctly:
<float_array id="GeometrySource2-array" count="150">-1.274902462959289 0 5.1300048828125 -0.6110070943832397 0 4.382179498672486 -0.6110070943832397 2 4.382179498672486...[etc]</float_array>
When I imitate this with the following export options through python, it does not appear that the selection is being centered. Can anyone advise me about the correct way to center a selection programmatically?
def exportDae(toExport, directory, name):
settings = DAEExportModelSettings()
# set the export path and name of associated files
# beware, collada 1.5.x doesn't seem to work when exporting these
# create a node with shape's name
# "Reuse asset instances, merge generated meshes by material"
# group by material type instead of with 5 billion little pieces
# THESE ARE THE LINES WHERE I ATTEMPT TO CENTER THE SELECTION
# "zero" the object(s) to remove geographic coordinates
position = ce.getPosition(toExport)
# export associated terrain
# export to a single file (instead of one per material)
# export the models but default to start shape if problem
# overwrite any existing files at that location!!!
# delineater for shape name clashes
# output log
This will contain float arrays with MUCH larger values, corresponding to the location of the shapefile, which indicates to me that "zeroing" my selection for the export was unsuccessful:
<float_array id="GeometrySource0-array" count="72">543176.7597654069 0 -3.281641101196114e6 543177.5401077866 0 -3.281641726548671e6 ...[etc]</float_array>
How can I implement the functionality of the "Center" button on the collada export dialogue in python?