Custom importer - setting options
-
You made an importer from scratch? In which case I don't see why the SU settings should affect your code. I'd be hard to say what is going on without seeing your code though.
-
Oh... hang on. Is your importer calling The Ruby API Model.import method?
-
@tt_su said:
Oh... hang on. Is your importer calling The Ruby API Model.import method?
Yes it its. I'm making an ugly workaround for the missing <orientation> info. Basically using the built-in importer but also unzipping the KMZ and reading the KML file myself and making the necessary adjustments (tilt, rotation, heading) to the geometry in the model (according to angles from KML) before using the built-in exporter. Some other changes are also made but they are unrelated.
Before this i've tried for days to fetch those angles somewhere in Sketchup but i finally came to the conclusion that the importer is broken - correct me if i'm wrong.
Thanks for the quick reply!
-
I don't know much about the importers themselves. I have to ask someone else on the team - they are not online yet as they are all in the US.
-
Ok thanks. Please post here when/if you get more information. It would be great if both problems could be solved somehow.
-
The
Sketchup::Importer#do_options()
example is totally wrong. (It is the terse, almost worthless, example forid()
.)The API should explain how options are used and stored.
-
@tt_su said:
I don't know much about the importers themselves. I have to ask someone else on the team - they are not online yet as they are all in the US.
Any news on this?
-
Sorry about the delay in response. The API is currently missing the ability to set import options. I ensured we had a feature request for it filed.
But it appear that what you do is a workaround for an issue with the existing importer. Would you mind describing the issue in detail and provide samples that illustrate?
-
@tt_su said:
But it appear that what you do is a workaround for an issue with the existing importer. Would you mind describing the issue in detail and provide samples that illustrate?
This shows a couple of problems i have ran into:
Start Sketchup
Make a cube
Geolocate model
Save as SKP
Export as "test_model.kmz"- in KML now <Orientation><heading>-0</heading><tilt>0</tilt><roll>0</roll></Orientation>
Try kmz in Google Earth - OK
Close Sketchup
Start Sketchup
Import test_model.kmz
Modelinfo -> Geo-location "This model is not GeoLocated" it says
Check dictionaries (my own script - screenshot on this) - Model has two(!) georeference dictionaries
Export to KMZ again "test_model_imp_kmz+exp_kmz.kmz"
Test in Google Earth even tho SU says "not geolocated" - OK (ends up in exact same spot as the first one)
Delete all but last GeoReference dictionaries in SU with own script
Check dictionaries - Only one GeoReference entry exist now (see screenshot)
Modelinfo -> Geo-location "This model is accurately geolocated"
=== END OF A PROBLEM WITH DUPLICATE GEOREFERENCE DICTIONARIES MAKING SU SAY "MODEL NOT GEOLOCATED" EVEN IF IT IS ===
Close Sketchup
Unzip "test_model.kmz"
Change under <Model> .... <Orientation> to random values - <Orientation><heading>33</heading><tilt>-70</tilt><roll>-20</roll></Orientation>
Zip (with changes) and rename to "test_model_MOD.kmz"
Test in Google Earth "test_model_MOD.kmz" (should be "flying" now - OK)
Start Sketchup
Import "test_model_MOD.kmz"
Export to "test_model_MOD_imp_kmz_exp_kmz.kmz"
Test in Google Earth "test_model_MOD_imp_kmz_exp_kmz.kmz" (should be flying but it is NOT)
Look in the KML in "test_model_MOD_imp_kmz_exp_kmz.kmz" - <Orientation><heading>-0</heading><tilt>0</tilt><roll>0</roll>
!! THE CHANGES ARE LOST !!
So this is basically why i need to parse the KML. I get models where roll/tilt/heading is set and when changes are made inside Sketchup and then exported to KMZ again, model ends up in wrong place in Google Earth. Well, its not in wrong place, its just rolled/tilted/rotated wrong actually but it looks like it is in the wrong place.
I will attach the files too.
Created and geolocated inside Sketchup then exported
test_model.kmz modified heading roll tilt under the <Model> tag in KML
Modified imported then exported
- in KML now <Orientation><heading>-0</heading><tilt>0</tilt><roll>0</roll></Orientation>
-
@tt_su said:
Sorry about the delay in response. The API is currently missing the ability to set import options. I ensured we had a feature request for it filed.
I forgot to say thankyou for this. Hope it gets sorted out.
Advertisement