Question about Coordinate Systems in and out of Group Edit Mode

Hello everyone,

First of all, I would like to say hi to the community staff and all participants here.

I have a question about the behavior of coordinate systems when working with groups in SketchUp.

It seems that different coordinate systems are used depending on whether I am in or out of group edit mode. For instance:

  • When adding a construction point to a group without entering group edit mode, the local coordinate system of the group is used.
  • However, when I enter group edit mode, the global coordinate system is applied instead.

My question is: why does SketchUp use the global coordinate system when entering group edit mode? What is the design rationale behind this behavior?

Here is a code example to illustrate the issue:

model = Sketchup.active_model
entities = model.entities
group = entities.add_group
face = group.entities.add_face([[0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0]])
face.pushpull(-50)
group.transformation = Geom::Transformation.translation([200, 0, 0])
# Without the following line, the added point will appear at the group's local coordinate origin
model.active_path = [group]
group.entities.add_cpoint([0, 0, 0])

I’ve spent an entire day searching through the community forums and online resources but haven’t found any explanation for this behavior.
Any insights or explanations about this behavior would be greatly appreciated. Thank you in advance!

Yes, that’s how it works. I think I saw it explained once, but I’ve forgotten the reason.

Thank you for your response. If you happen to remember the reason later, please let me know. Much appreciated. :smiley:

I will guess it is how the code for inactive tools must work.

I remember Thomas telling me that the API methods (and hence the C++ functions they wrap) expect global coordinates in edit contexts because the C++ also does.

These methods can help when dealing with edit situations:

1 Like

That’s true, but it doesn’t really explain why the C++ works that way.

We also discussed this here:

1 Like

Thank you. I’ve often seen you helping others in the community, and many of my questions were actually clarified by reading your responses.

I was just curious about the underlying principle behind this behavior, as it’s not very intuitive and seems to involve some extra unnecessary steps (applying group.transformation.inverse to the added cpoint).

Anyway, I’ll just accept it as one of SketchUp’s characteristics.

Finally, thank you for your response.

The code base was inherited from the original guys who wrote it (as a college project I think.)
It was written to use the OpenGL libraries (originally) so perhaps this is the “culprit”.

With the release of SketchUp 2024 we’ve seen the rewrite of the graphics pipeline to leverage native speed of DirectX (on Win) and Metal (on Mac).
But the API must remain the same or risk breaking the majority of extensions “in the wild”.

J.C. Eneroth gave this answer some years ago …

1 Like

I’ve read through this response early and understand the situation now.

Thank you both very much for your replies and your work.

It’s getting late here and I need to rest. Have a nice day! :grinning: