You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Lock inference to X axis.
# The points can be anywhere; only the vector between them affects
# the result.
view.lock_inference(
Sketchup::InputPoint.new(ORIGIN),
Sketchup::InputPoint.new(Geom::Point3d.new(1, 0, 0))
)
This is untrue. The points define a line in space that inference is locked to. Not just a vector.
This tool can only lock inference onto the model coordinate axes, not parallel to the axes as the comment suggests.
classTestTooldefinitialize@ip=Sketchup::InputPoint.newenddefdraw(view)@ip.draw(view)enddefonKeyDown(key,_repeat,_flags,_view)casekeywhenVK_RIGHTlock_axis(0)whenVK_LEFTlock_axis(1)whenVK_UPlock_axis(2)endenddefonKeyUp(key,_repeat,_flags,_view);enddefonLButtonDown(flags,x,y,view);enddefonMouseMove(flags,x,y,view)@x=x@y=ydo_pick(view)endprivate# Extracting the picking from mouse move allows the input point to be updated# immediately once the inference lock is released.defdo_pick(view)# May get called as tool is activated, before the first mouse eventreturnunless@xreturnunless@y@ip.pick(view,@x,@y)view.tooltip=@ip.tooltipview.invalidateend# Lock the tool inference to a drawing axis.## @param axis_i [0, 1, 2] 0 = red, 1 = green, 2 = bluedeflock_axis(axis_i)model=Sketchup.active_modeldirection=model.axes.axes[axis_i]model.active_view.lock_inference(Sketchup::InputPoint.new(ORIGIN),Sketchup::InputPoint.new(ORIGIN.offset(direction)))end# Lock the tool inference to what is currently hovered.deflock_hoveredSketchup.active_model.active_view.lock_inference(@ip)end# Unlock any tool inferencedefunlockview=Sketchup.active_model.active_viewview.lock_inferencedo_pick(view)endendSketchup.active_model.select_tool(TestTool.new)
If you change the inference lock to use the input point from the mouse cursor, you can lock along the line the inputpoint is on, as you would expand from a SketchUp tool.
Eneroth3
changed the title
Unexpected behavior f inference locking with two inputpoints
Unexpected behavior of inference locking with two inputpoints
Nov 15, 2024
The Ruby API docs state the following.
This is untrue. The points define a line in space that inference is locked to. Not just a vector.
This tool can only lock inference onto the model coordinate axes, not parallel to the axes as the comment suggests.
If you change the inference lock to use the input point from the mouse cursor, you can lock along the line the inputpoint is on, as you would expand from a SketchUp tool.
The text was updated successfully, but these errors were encountered: