SU 2017 anything new in the Ruby API?
-
Is there anything new in the Ruby API for SketchUp 2017?
I'm hoping for opening groups and components...
-
I just noticed the documentation has been changed. More easy to search for stuff. @Pixero - I don't see anything new in the Group section (yet):
http://ruby.sketchup.com/Sketchup/Group.htmlApi changes here:
http://ruby.sketchup.com/file.ReleaseNotes.html -
There have definitely been changes, I just can't find a list of what they are - my in-house plugin I've been using and coding for almost 2 years got totally busted by 2017. I'm getting all kinds of errors, including in some simple code operations that I wouldn't have expected changes in... kind of bummed. Now I'm going to have to figure it all out and fix... dang.
Does anyone have a list anywhere of the API changes?As an example, one of my many tools is a shortcut to scoot objects around. It iterates through the selection, adding each entity to an array. Then, it groups them together, moves the group, then explodes the group. The grouping/ungrouping forces a deselection, so then I use selection.add(array) to re-select the original selection. SU 2017 errors on the code that works in 2016, telling me my array is the wrong argument type. I have tried to debug, testing that the array is indeed an array and contains objects, but then when selection.add(array) runs, it tells me it's the wrong argument type. Why? Works fine in 2016 and 2015.
-
@unknownuser said:
...it groups them together, moves the group, then explodes the group...
exploding now deletes all references to the group entities, i.e. they all are 'deleted entities' after the explode...
in one of mine I 'now' store the face.bounds.center.z and then after exploding re-find faces using that as a conditional...
I believe the former ability to 'hold' the reference was a SU 'hack' and some of these are being 'put right'...
john
-
@driven said:
@unknownuser said:
...it groups them together, moves the group, then explodes the group...
exploding now deletes all references to the group entities, i.e. they all are 'deleted entities' after the explode...
in one of mine I 'now' store the face.bounds.center.z and then after exploding re-find faces using that as a conditional...
I believe the former ability to 'hold' the reference was a SU 'hack' and some of these are being 'put right'...
john
I discovered this in bug testing, can confirm. It kind of sucks, as it was nice to store a selection set in an object array, manipulate, then get your selection set back by selection.add(array) which you can't do now since it views the objects as 'deleted.'
Alternately - and this may work well for your case, as even edges/faces/etc get these - each object now has a property called persistent_id, and by referencing back to that you wouldn't have to compare geometry (if I read your post right). My work around for now is to store the persistent_id's in an array, then go the the drawing objects and find the ones that have those id's when I need to reselect them. This is way, WAY slower than just being able to reference back to an array of entities, but I guess it is what it is... unless someone else knows of an easier way to get the selection set back.
Advertisement