Hi.,
Normally the input to the sketchup from ruby code is in absolute coordinate system.,
Could anyone guide or throw some light, how to input the values in relative coordinate system in ruby.
the below code is absolute coordinate system.
# Default code, use or delete...
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selection
#declaration of variables
height = 720.mm #Height of the cabinet
depth = 550.mm #depth of the cabinet
wd = 600.mm #width of the cabinet
thickness =18.mm #thickness of the panel
# Left side Panel
pt = [0,1,2,3]
pt[0] = [0,0,0]
pt[1] = [thickness,0,0]
pt[2] = [thickness,depth,0]
pt[3] = [0,depth,0]
#creation of face - LH Side panel
face = ent.add_face(pt)
face.reverse!
face.pushpull(height, true)
lh_group = ent.add_group face.all_connected
lh_group.name= "LH Panel"
The point relative to earlier coordinate position. Since in the ruby scripting, we have to give the coordinate in the array, which has been taken by the sketchup in absolute coordinate system for drawing the entities.
Would like sketchup to get the inputs from ruby in terms of relative coordinate system.
Ex: want to draw face of 18mm thk and 550 mm depth.
so the input of coordinates (x,y,z) is something similar to
0,0,0 # starts from origin
18,0,0 # draws a line at x axis of length of 18mm from origin
0,550,0 # draws a line at y axis of length 550 mm from earlier position
-18,0,0 # draws a line at x axis of length -18 mm from earlier position (negative x axis)
0,-550,0 # draws a line at y axis of length - 550 mm from earlier position (negative (y axis)