I just want to open the dialog in my own plugin. Or if there is anyway to call the function of a exist menu?
Thanks!
I just want to open the dialog in my own plugin. Or if there is anyway to call the function of a exist menu?
Thanks!
PC ONLY
Set up local integer constants within your module:
GEOLOCATION_ADD_DIALOG = 24216
So call the dialog (from within your module) via:
Sketchup::send_action(GEOLOCATION_ADD_DIALOG)
I do not know the Automation ID for the “Set Manual Location” button. Jim Foltz has a quick & dirty inputbox script that mimics the native manual location dialog.
Thanks for your help!
Hello Dan,
Another question, is there a action number means “Clear Geo Location”?
Thanks again.
GEOLOCATION_CLEAR = 24197
You can test a model instance if it is geo-located:
Sketchup::active_model.georeferenced?
But it looks like “Clear Geo-Location” command does NOT reset the model’s shadow info hash, nor remove the model’s “GeoReference” attribute dictionary that the “Add Location” dialog created.
It’s enough to meet my needs.
Thanks a lot.
BTW,seems like many functions useful(GEOLOCATION_ADD_DIALOG, GEOLOCATION_CLEAR, etc.) aren’t wrote in the API document. Do you know why?
Keep in mind those are just constant names that * I myself * made up.
No not really something I can answer definitively. Seems a simple question, but the reality is complex. SketchUp has been owned by 3 separate companies so far, each having different goals for SketchUp and it’s APIs. Priorities change from time to time, etc.
Basically I can only guess that these kinds of things are low priority, and never rise to the top of the “to do” list.
Hi, Dan,
I would like to know for the actions add/clear Geolocation, if there is any way to do that by ruby script for Mac?
Thanks
You can open the regular geo-location dialog on the Mac via:
Sketchup.send_action "showGeoLocation:"
If a location has been set, you can clear it via:
Sketchup.send_action "clearLocation:"
Since a Geo Location involves multiple values. If you want to set them entirely via Ruby you need to manipulate the appropriate entries in the model’s ShadowInfo object, accessed via Model#shadow_info
Thanks dude, I’ve check these actions and they work, but i means open the dialog of adding Google maps directly instead of regular dialog, if it is possible?
Thanks again
That one I don’t know. Will take some research to see. I should point out that neither of the actions I gave before are officially documented.
Yeah i noticed that, really admire that you can find these deep hided strings
Thanks
Try this one:
Sketchup.send_action "importFromGoogleEarth:"
Again, with the warning that these actions are undocumented so you use them at your own risk. Since Trimble chose not to explain them, I can’t give you any assurance about whether they have side effects or bugs. Nor about which versions of SketchUp do or do not support them.