Hello,
I have reference Dezmo post the code which has use in
class Testtool
def initialize
@face = nil
@tr = IDENTITY
end
def get_trans(ph, obj)
ph.count.times{|i|
if ph.leaf_at(i) == obj
return ph.transformation_at(i)
end
}
IDENTITY
end
def onMouseMove(flags, x, y, view)
ph_fe = view.pick_helper
ph_fe.do_pick(x, y, 0)
face = ph_fe.picked_face
@face = face ? face : nil
@tr = get_trans( ph_fe, face ) if face
view.invalidate
end
def onLButtonUp(flags, x, y, view)
@dist = 0.3.m
# Vector X-axes, Y-axes, Z-axes,
@tvec = Geom::Vector3d.new([@dist, 0, 0]) # Vector X-axes
if @face
#@face.pushpull @dist, false, # work properly
Sketchup.active_model.entities.transform_entities(Geom::Transformation.translation(@tvec),@face.parent)
# face transforming but something wrong
end
view.invalidate
view.refresh
end
def draw(view)
if @face
loop = @face.outer_loop.vertices.map{|v|
v.position.transform( @tr )
}
view.drawing_color = [255,20,147, 75]
view.draw(GL_POLYGON, loop)
end
end
end
Sketchup.active_model.select_tool(Testtool.new)
please check and revert
thanks