Rewriting native tools or not?

Hello,

I would like a single tool that can simply create a parallelepiped to replace the combination of Rectangle tool + PushPull tool + Create Component command.

To achieve this goal I have explored 3 alternatives :

1 - Finding an existing extension that does this job. No luck, but maybe I miss something ?
2 - Combining native tools. Even if I use some observers it seems to be impossible to “control” native tool. Am I wrong ?
3 - Rewriting Rectangle and PushPull native tools in a custom tool. Hard job as native tools contains a lot of “hidden” features.

I tried to go for the third alternative. It currently does the basic job, but on the PushPull part, it is not so easy to handle the inference as desired.

So my question is : In your opinion what could be the best alternative to use ?

s4u Make Box | SketchUp Extension Warehouse

Yes, I bought and try it. But sadly s4u Make Box doesn’t permit to draw the box base as the Rectangle tool do with only 2 points

Curic DIO2 extension

Rectangle with 2 points. Trowel (PushPull) activates automatically.

3 Likes

I agree with the third one. I also tried to make my own Rectangle Tool - but the “hidden” things make it quite difficult… I didn’t finish it. :blush:

Perhaps if you change the order and use shortcuts, than this will more efficient with the native tools.

g Create Component command… + r Rectangle tool… + p PushPull tool


Anyway Mihai give you an other one… :slight_smile:

2 Likes

Hi Boris,

We’re working on an AI tool that can create much of what you are suggesting. We are in beta but if you would like to try it we would love your feedback. Just download it at download.coolaiid.com. You’ll get some free chats. Would love to know if it helps.

Thanks,
Frank

Hi Frank,

Interesting tool, but I think typing a prompt will be slower than using the native tools with shortcuts.
And it would be hard to stick to the rest of the geometry.

1 Like

Fair point. We’re seeing people try to build out larger concepts (e.g. full rooms, retail spaces, etc.). I think we might be able to provide an initial set of building blocks customised to someone’s specs and enhanced with built-in and native tools (as you described). Whatever makes it easier and quicker to build with makes sense to me.

If you want to use basic tools, try this.

Create a base component such as a cube that could be 1 m x 1 m x 1m or anything that suits you then save that.

Then you import that model in your model and it will become a component. Then you use the scale tool with precise measurements instead of a scale factor.

For example, following these steps produces a cube of 5 m x 4 m x 3 m :slight_smile:

1 - Select the cube.

2 - Select the Scale tool.

3 - Grab one corner handle and stretch the cube.

4 - Let go of the mouse and type 5m;4m;3m or anything suits you. Use a comma if your system is set to use the dot as the decimal separator and the comma for list separator.

5 - Press the Enter key or the Return key to complete the scaling operation.

Note that you can import the cube once and make copies to save the import time

It works but I think that drawing a rectangle to proper size and pulling it up to proper height might be faster.

Thank you for you answer @jean_lemire_1, but maybe this method needs quite more clics than using both Rectangle and PushPull tool, no ?

To reduce false values, I have added a construction line in the center. Perhaps this method will suit you?

Hello @bobecka,

Thank you for this advice.
Finally, I wrote the following magic ruby line that solve my push pull inference issue.

_, picked_point = Geom::closest_points([ @picked_second_ip.position, @normal ], view.pickray(x, y))

And exclude points that share the rectangle plane.

2 Likes

The full piece of code is :

        if @mouse_ip.degrees_of_freedom > 2 ||
          @mouse_ip.instance_path.length == 0 ||
          @mouse_ip.position.on_plane?([ @picked_second_ip.position, @normal ]) ||
          @mouse_ip.face && @mouse_ip.vertex.nil? && @mouse_ip.edge.nil? && !@mouse_ip.face.normal.transform(@mouse_ip.transformation).parallel?(@normal)
          _, picked_point = Geom::closest_points([ @picked_second_ip.position, @normal ], view.pickray(x, y))
          @picked_third_ip = Sketchup::InputPoint.new(picked_point)
        else
          @picked_third_ip.copy!(@mouse_ip)
        end
1 Like

Personally I’d write a new tool. It gives you more precise control, and you can have correct info in the statusbar and instructor, conveying what the tool actually does.

Building on top of native tools with observers is fragile if those tools ever change. The statusbar and instructor would explain the native tools, even if your “combo tool” works differently. The toolbars would visually display the native tools as selected, even if it’s supposed to feel like a separate process. There are a bunch of edge cases to handle, like if the user changes their mind halfway through the process and switch to another tool, or maybe reactivate any of the tools you have combined, but with the intention of using it as the original tool.

We have some code examples how to build a custom tool: sketchup-ruby-api-tutorials/examples at main · SketchUp/sketchup-ruby-api-tutorials · GitHub

3 Likes

Thank you for your feedback @ene_su !

Finally, I came to the same conclusion and with a little observation of the rectangle and pushpull tools. I copied the main principles into my custom tool.

This indeed opens up more possibilities while keeping a use as close as possible to standard tools.

8 Likes

Try the extension Wood Framing by Steve Baumgartner (@slbaumgartner) and me, from SketchUcation (free).

You have to choose from a predefined (but customisable) set of rectangular profiles, either of nominal softwood sizes or actual sizes.

If that doesn’t meet your needs, you could perhaps adapt the code to draw the cross-section rectangle first, instead of picking it from a list.

Sorry if this is too late to be useful

1 Like

Thank you @john_mcclenahan, I didn’t know about this extension :+1:

1 Like

Hello,

My tool was improved. It is now be able to draw solid from rectangle, circle, and polygon shapes.

But I’m facing a strange behavior with VCB.

If I type the key “s”, it switches to the scale tool because of the “s” keyboard shortcut.
But if I type “2” + “4” + “s”, it displays “24s” in VCB without changing the tool :+1:
Unfortunately this doesn’t occur with all letters … :frowning:

For example to set the offset from VCB I would be able to type “100o”. But in this case, SketchUp switch to the Orbit tool.

So my question is : Is the ability to type an “s” after a number in VCB hardcoded into VCB or is it possible to extend it to other letters?

1 Like

Yes, it is hardcoded for use with the Polygon and Circle tools (perhaps also Arc tools).

This has been an ongoing bug for … like forever on the Mac. On Windows returning true from the onKeyDown and onKeyUp callbacks will cause SketchUp to ignore the keystroke. But it has long been a bug on Mac platform.

Ok, so it’s an impossible feature to use VCB for this. Thank you @DanRathbun!