Hi, Everyone. I’m new to making Tools, and I need some help with realisation of feature, that using practically in any tool of SketchUp.
When you trying to create or place something in model, that snaps to any surface like below.
How can I make a feature like that?
Use the InputPoint class for this.
In the Tool’s onMouseMove method Class: Sketchup::Tool — SketchUp Ruby API Documentation check for the best picked face for each input-point it generates: Class: Sketchup::PickHelper — SketchUp Ruby API Documentation and Class: Sketchup::PickHelper — SketchUp Ruby API Documentation
Get its normal face.normal.
Use that to transform your object [view drawn-graphics?] at the cursor to be on the faces plane.
Class: Sketchup::View — SketchUp Ruby API Documentation
The color of the object can be changed using the normal.parallel? X_/Y_/Z_Axis and coloring it Red/Green/Blue accordingly.
Or Black if not axial…
I really wouldn’t recommend that since the user may have changed the axis colors. View#set_color_from_line should be used instead.
This topic was automatically closed after 91 days. New replies are no longer allowed.