Inherit from native tool

I would like to add some logic to ComponentTool on mouse move.

First thing I tried to do is to override onMouseMove function of ComponentTool. To do so I created ToosObserver and in onActiveToolChanged I would like to change onMouseMove function of tool if ComponentTool was chosen. It looks like it cannot be done, or I am not smart enough. I would like to mention that I’m new to ruby so maybe I just don’t understand language mechanism for that case.

Another solution I thought is to create custom tool which inherit from ComponentTool but I don’t know is this possible and where native tools reside.

Any solutions?

You are correct. Ruby Tools cannot override native C++ tools.

All you can do is attempt to write a clone of ComponentTool in Ruby.

Also not possible.

What is it you wish to do ?

I would like to do some custom smart snapping while moving components. Purpose is to “glue” custom components one to another in specific way while moving component over scene.

Have you tried using the built-in “Glue To” property of native components yet ?

If this property is set correctly, the component will automatically snap around (rotate) to match mating surfaces.
But you also need to draw the component correctly with it’s origin and mating surface on the XY plane (with the Z axis pointing upward.) So you would draw a window laying flat pushed down into the XY plane to the amount that it will “mate” with a wall. Then set it’s “glue to” property appropriately.

I remember that AutoCAD had a snap rotate feature we could use whilst blocks were still attached to the cursor. I’ve always missed this with SketchUp. SketchUp has a built-in rotate but only after the component is placed (which is not always ideal.)

Now, it can be done as I believe Jim Foltz worked on a “smart snap” extension. Do not know if it is free or paid.

ping @jim_foltz

EDIT: I think I found it, and does cost a little bit …

http://extensions.sketchup.com/en/content/snap-connector

This extension will be really helpful. Thank you very much!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.