Is adding entities in Local or Global coordinates

Short answer: it’s a mess.

Long answer: In the active drawing context and all its parent coordinate systems all coordinates are global. In all other coordinate systems they are locale.

If you for instance make a drawing tool, you only have to think of global coordinates (and sometimes check the Axes object if you want your tool to depend on axes). If you make some code that edits the content of a selected group or component, you only have to think of local coordinates. If you however write code that interacts with or reads the model as a whole regardless of the user’s active drawing context, like a renderer, you may have some problems.

If you traverse the model hierarchy you can quite easily convert coordinates to global space by keeping a reference to the current transformation (see this example). If you need to get the transformation matrices of containers parent to the active drawing context however I think there is no other way than cache the values from before the user enters them.

1 Like