Hi there,
I’m facing some unexpected behavior when handling geometry with the ruby API (for info I’m working on SU2017, the version deployed in my company). Here is a use case explaining what I’m facing that I’m not able to understand and handle correctly… I hope someone may help on this (I’ve made some reseach on google and on the community without success, maybe the keywords used wheren’t the good ones).
Here is an exemple (TEST_cnc.skp (145.9 KB) ), where I’m trying to combine the CNC_hole component geometry into the ITM group.
My problem is to correctly send the component geometry into the group so (to shorter the code below I’m using the object name instead of variables) :
- If I’m doing something like
ITM.entities.add_group(CNC.explode)
, I get the error below which leads me to understand that not all exploded geometry should be reparented but maybe a part of it (Instead of the error sometime it works but I also get a BugSplat in the meantime).
Error: #<ArgumentError: All Entities must have a common parent> - If I’m exploding the CNC component (
CNC.explode.collect{|e| e.class}.uniq
) to look what I’m getting , I get this list of classes [Sketchup::Edge, Sketchup::Face, Sketchup::Vertex, Sketchup::EdgeUse, Sketchup::Loop]. - If I’m only reparenting the [Sketchup::Edge, Sketchup::Face] by using this command
ITM.entities.add_group(CNC.explode.select{|e| [Sketchup::Edge, Sketchup::Face].include? e.class})
(trying to include any of these classes [Sketchup::Vertex, Sketchup::EdgeUse, Sketchup::Loop] leads to the starting error). Then I’m getting what I want but the group is generated into the model but not in the ITM group. WTF !?!
- An another strange thing is that trying to send the CNC component into the group leads to the same behavior as the previous bullet (
ITM.entities.add_group(CNC)
).
Am I trying the right way to do it ? Did I missed something ? After that if my geometry is at the right place I’ve been able to manage/lead correctly the geometry merge process : I have the start and the end but something is going wrong in between.
Thanks all for reading so far and for your appreciated help !