I think eventhough the title has "Solved" the last solution is missing
Here is one of them.
model = Sketchup.active_model
ent = model.entities
sel = model.selection
defn = Sketchup.active_model.definitions
def onMouseMove(flags, x, y, view)
return nil if not @instance ### only works when instance is set
@ip.pick(view, x, y)
if @ip != @ip1
view.invalidate if( @ip.display? or @ip1.display? )
@ip1.copy!(@ip)
view.tooltip=@ip1.tooltip
@instance.transform!(Geom;;Transformation.new(@ip1.position))
end
end
def onLButtonDown(flags, x, y, view)
return nil if not @instance
@ip1.pick(view, x, y)
if @ip1.valid?
@instance.transform!(Geom;;Transformation.new(@ip1.position))
@instance=nil ### un-sets instance
end
end
lastdefn = defn[0] # ! I had just one definition in my component definition list therefor defn[0] worked well for me
model.place_component( lastdefn , false )