Group in a group in a group... - transform point to outside?
-
Also this will only work with groups, but not components as how do you get the exact instance ? and it can get murky if there are more than one instance of a group !
You could try to shoot a ray from the center of everything [until it hits its 'container'] and then it returns all of the containing groups/instances as an array... -
Oh, this sounds more complicated then expected...
I'm thinking about this way:
I take the outer group and explode them... Lets think about this situation:
- Group 1 ___- groupA ____- faces, points etc ___- groupB ____- faces, points etc ___- groupC ____- faces, points etc
What will happen, when I explode Group1? Will I get all the faces and points in the deepest groups? Or will I get the three groups (groupA, groupB, groupC)?
Means: When I explode an other group, will I explode all inner groups too? => that would be great!Thanks for your help!!
-
Explode? That's a destructive thing to do. If you do that just to get the position of the face in relationship to the model coordinates then it's not the right thing to do!
Question here is; How are you getting the face?
If you're using PickHelper or InputPoint to allow the user to pick the face then these classes will also provide the transformation required.And is the face in the current context? (
model.active_entities
)
If so thenmodel.edit_transformation
is all you need.If you can detail more specifically what and why you are trying to do what you do it'd help.
-
Okay, sorry, let me explain the situation a little more in detail...
An user choose any "things" in the Sketchup Model. Things: Groups, faces, lines etc
My plugin should collect every face selected and give all the coordinates of these things. But important: the coordinates have to be based on the outside coordinate system.
So, there could be a possibility that the user choose a group with a lot of groups inside, with a lot of groups inside... ... with faces inside => thats my problem, to get easy the outside coordinates of these faces.
-
So the user picks a group in the current context and you want to drill down into all the sub-groups and report coordinates for each face?
-
@thomthom said:
So the user picks a group in the current context and you want to drill down into all the sub-groups and report coordinates for each face?
Yes, you are right! I mean, I know how to drill down into all the sub-groups until I get a face. But now, whats the easiest ways to get the coordinates? Undependent of the number of the nested groups...
-
As you drill down each level, combine the transformations of the previous levels. Then apply that transformation to the local coordinates.
-
@thomthom said:
combine the transformations of the previous levels
I transform a vertex in such a way:
vertex.position.transform(group.transformation)
So, do you mean something like that:
vertex.position.transform(group3.transformation).transform(group2.transformation).transform(group1.transformation)
group1: outer group
group2 and group3: inner group -
You combine transformations as such:
new_transformation = transformation1 * transformation2
http://www.sketchup.com/intl/en/developer/docs/ourdoc/transformationAs you dig into each level, pick up the transformation and apply it to your total transformation. You then have one transformation object which you apply once per 3d point.
-
If you have got a reference to a Vertex it belongs to an Edge [to which you can get a reference too].
That Edge has a Parent.
It's either the Model or a ComponentDefinition.
It's not a Group - although it might be a group that might be theComponentDefinition.instances[0]
, assuming there are no copies of the group - if there are we get into problems.
If it's a ComponentInstance we have problems finding the right instance if its definition has more that one instance.
Assuming you get a lone group, it has a transformation.
If that group is inside another 'parent' the issue repeats... and you must get each container's transformation etc in turn.
As TT explained - usetr = tr2 * tr1 * tr0
to combine several transformations.
Andtr.inverse
unravels it 'backwards', depending on how you want to use it...If your reference is not to a specific Vertex, but rather to a Point3d picked/determined in the Model, that you wish to 'transform' back into an equivalent Point3d inside a group or grouped group etc, then the inverse transformation of all of the nested groups should return that. Also as you know the outermost group from it being picked etc and that the inner nesting is only ever one group then group.entities[0] will return the nested groups in turn, rather than a definition; so this 'inward mining' approach will work, whereas 'outward mining' is fraught !
-
When you use
vertex.position.transform(group.transformation)
it will not transform the vertex, it only returns the point that it had as a new point.
The vertex remains unchanged.
Is this what's expected?
If you want to really transform a vertex or vertices you need to use a way likeverts[0].edges[0].parent.entities.transform_entities(transformation, [verts])
or.transform_by_vectors([verts], [vectors])
... -
Just thinking out loud, but he's drilling down then he's already got the right component instance because he would have found it while iterating over the current level of entities.
When he drills down into it, he'll know what instance he's in. So once he drills into it, could he find a faces parent definition, then iterate over all those definition instances to see which matches the object_id of the instance he knows he's inside of?
-
Since he's going from the current context down into sub-components it's no need to preference parent entities at all. He just picks up the transformation for each level he digs into.
-
You helped me a lot! Thanks!!!!
Now, my current (but not yet perfectly working result):
<span class="syntaxdefault">group </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> projectGroup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_group<br /><br /></span><span class="syntaxcomment"># add selected faces to group<br /></span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">tmp</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> if tmp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">ComponentInstance</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">||</span><span class="syntaxdefault"> tmp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Group</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> getEntities</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">tmp</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> nil</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> group</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> elsif tmp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Face</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> newFace </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> tmp</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">copy</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">group</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> nil</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> end<br />end</span>
<span class="syntaxdefault"></span><span class="syntaxcomment"># Thanks to http://sketchucation.com/forums/viewtopic.php?f=180&t=29138&start=0<br /></span><span class="syntaxdefault">class Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Face<br /> def copy</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">ents</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> trans</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> vec </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Vector3d</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">new 0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">0<br /> dist </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 0<br /><br /> ov</span><span class="syntaxkeyword">=[]<br /></span><span class="syntaxdefault"> vec</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">length </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> dist if dist </span><span class="syntaxkeyword">!=</span><span class="syntaxdefault"> 0<br /> self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">outer_loop</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">vertices</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> if dist </span><span class="syntaxkeyword">!=</span><span class="syntaxdefault"> 0<br /> ov</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">push</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">position</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">offset</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">vec</span><span class="syntaxkeyword">))<br /></span><span class="syntaxdefault"> else<br /> if </span><span class="syntaxkeyword">(!</span><span class="syntaxdefault">trans</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">nil</span><span class="syntaxkeyword">?)<br /></span><span class="syntaxdefault"> ov</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">push</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">position</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transform</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">trans</span><span class="syntaxkeyword">))<br /></span><span class="syntaxdefault"> else<br /> ov</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">push</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">position</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> end<br /> end<br /> end<br /> outer_face </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> ents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_face ov<br /> outer_face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">material </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">"green"<br /><br /></span><span class="syntaxdefault"> inner_faces </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[]<br /></span><span class="syntaxdefault"> if self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">loops</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">length </span><span class="syntaxkeyword">></span><span class="syntaxdefault"> 1<br /> il </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">loops<br /> il</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">shift<br /> il</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">loop</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> ov</span><span class="syntaxkeyword">=[]<br /></span><span class="syntaxdefault"> loop</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">vertices</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> if dist </span><span class="syntaxkeyword">!=</span><span class="syntaxdefault"> 0<br /> ov</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">push</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">position</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">offset</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">vec</span><span class="syntaxkeyword">))<br /></span><span class="syntaxdefault"> else<br /> if </span><span class="syntaxkeyword">(!</span><span class="syntaxdefault">trans</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">nil</span><span class="syntaxkeyword">?)<br /></span><span class="syntaxdefault"> ov</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">push</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">position</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transform</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">trans</span><span class="syntaxkeyword">))<br /></span><span class="syntaxdefault"> else<br /> ov</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">push</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">v</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">position</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> end<br /> end<br /> end<br /> inner_face </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> ents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_face ov<br /> inner_faces</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">push</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">inner_face</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> end<br /> inner_faces</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">f</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> f</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">erase</span><span class="syntaxkeyword">!<br /></span><span class="syntaxdefault"> end<br /> end<br /> return outer_face<br /> end<br />end </span><span class="syntaxcomment"># Class Face </span><span class="syntaxdefault"></span>
<span class="syntaxdefault">def getEntities</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">element</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> trans</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> group</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> entitiesArray </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Array</span><span class="syntaxkeyword">.new()<br /><br /></span><span class="syntaxdefault"> if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">element</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">ComponentInstance</span><span class="syntaxkeyword">))<br /></span><span class="syntaxdefault"> elementEnts </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> element</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">definition<br /> else<br /> elementEnts </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> element<br /> end<br /><br /> elementEnts</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">entity</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> if entity</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">ComponentInstance</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">||</span><span class="syntaxdefault"> entity</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Group</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> if </span><span class="syntaxkeyword">(!</span><span class="syntaxdefault">trans</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">nil</span><span class="syntaxkeyword">?)<br /></span><span class="syntaxdefault"> trans </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> trans </span><span class="syntaxkeyword">*</span><span class="syntaxdefault"> entity</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transformation<br /> else<br /> trans </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> entity</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transformation<br /> end<br /> getEntities</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">entity</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> trans</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> group</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> elsif entity</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Face</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> newFace </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> entity</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">copy</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">group</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> trans</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> end<br /> end<br />end</span>
Oh my goodness - lots of stuff
So, copying all the faces into the group "group" is successful. Problem: At the end, the position of "group" is different then the original one... so, the transformation doesn't work.
Do you understand my Ruby code and, with a little bit of luck - can you find a mistake using the transformation? I'm not quite sure about
trans = trans * entity.transformation
Thanks again for all your help!!!
EDIT: Oh, why the tabs in the code are not shown? Now, the code looks not very clear...
-
Regarding your modification of the
Sketchup::Face
class: please don't release this code in a public plugin. Modifying base classes can easily conflict with other plugins. More info: http://www.thomthom.net/thoughts/2012/01/golden-rules-of-sketchup-plugin-development/ -
@thomthom said:
Regarding your modification of the
Sketchup::Face
class: please don't release this code in a public plugin. Modifying base classes can easily conflict with other plugins. More info: http://www.thomthom.net/thoughts/2012/01/golden-rules-of-sketchup-plugin-development/Good hint! Thanks a lot! I will try to write everything in a module to avoid problems with other plugins!
Thanks for pimping my code style!!
-
@thomthom said:
Regarding your modification of the
Sketchup::Face
class: please don't release this code in a public plugin.If you read the new Trimble edition of the API Terms of Use, it can be understood that modifying the API classes is a violation of the terms.
-
<span class="syntaxdefault"><br />Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">modelEnt</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> if modelEnt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Group</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&</span><span class="syntaxdefault"> modelEnt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">name </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> </span><span class="syntaxstring">"Model2GCode_project_x"<br /><br /></span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">messagebox modelEnt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transformation</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">origin</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_s<br /> modelEnt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">projectEnt</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> if projectEnt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Group</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&</span><span class="syntaxdefault"> projectEnt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">name</span><span class="syntaxkeyword">.include?(</span><span class="syntaxstring">"Model2GCode_part_x_"</span><span class="syntaxkeyword">)<br /><br /></span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">messagebox projectEnt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transformation</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">origin</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_s<br /> projectEnt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">partEnt</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> if partEnt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Face</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> partEnt</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">vertices</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">each do </span><span class="syntaxkeyword">|</span><span class="syntaxdefault">vertex</span><span class="syntaxkeyword">|<br /></span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">messagebox vertex</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">position</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_s<br /> end<br /> end<br /> end<br /><br /> end<br /> end<br /><br /> end<br />end<br /></span>
I solved a lot of problems... but a last one is very tricky...
But let me explain a little bit more:
I have a group "Model2GCode_project_x". In this group, there is another group "Model2GCode_part_x_y". In this group, there are a lot of faces.
The faces inside this inner group start in the coordinates origin of Sketchup. So, at the end, I should get at least one point in (0, 0, 0). But I get very strange points with completly different positions.However, the group.transformations are identity, means the origin of these transformations are (0, 0, 0).
At first: Do you understand my problem?
And then: Do you have any idea, what's going wrong? I tested a lot, but always the same problem...Thanks a lot for your help!!
-
It is not advisable to use
UI.messagebox()
for debugging. (If the string argument is invalid, thenUI.messagebox()
either fails silently, or causes a error by itself.)Use
puts()
to output inspection strings to the Console instead. -
I tried to simulate your problem using the code you posted but I got 0,0,0 points for some of the faces as expected.
Perhaps if you posted a model just so we are working on the same problem.
Advertisement