Position absolute and relative

Hi,

Im using Sketchup 2019,1,173, pro french release on mac OS. 10,14,4.

I have a component instance (with transformation) that contain one group (with a transformation) that contain one line.

In ruby console I do:

puts Sketchup.active_model.entities[0].definition.entities[0].entities[0].start.position
(1852 mm, 1,246711 mm, 725,992349 mm)

I double clic two time on the component and the group to enter and redo the command line

puts Sketchup.active_model.entities[0].definition.entities[0].entities[0].start.position
(49,443298 mm, 45,231205 mm, -81,507651 mm)

after I select the edge and do:

Sketchup.active_model.selection[0].start.position
(1852 mm, 1,246711 mm, 725,992349 mm)

The first and last method return the xyz from the origin of the model the second from the component.
Can someone clarify when position are relative or absolute?
What is the best pratice in ruby? Use the first method and apply transformation ?

Thanks for your help

When a drawing context is open for editing (also including parent drawing context) SketchUp transforms all coordinates to global space. For closed drawing context SketchUp returns and expects the actual, local, coordinates in that context.

It’s not a transparent or well documented behavior, but quite often it happens to be what you need.

3 Likes

as all ways, thanks @eneroth3 ! each time, I ask a question you’re the one who answer nicely clearly. Are you working for/with Sketchup now ?

I’m afraid not, but I’m working for IKEA which is quite nice :slight_smile: .