Multi-Point Tool

I’m working on a new tool for the foundation plugin (Medeek Design Inc. - Medeek Foundation) that allows the user to select a single point for positioning a simple spread/pad footing.

Under regular usage the user will select the point and then the tool will draw the footing (rebar, post, pedestal etc…) This is fairly straight forward for me to code.

What I would like to do is make it possible to hold down the control key or some other key while selecting the point to position the footing, thereby the allowing the user to select multiple points. The footing component (assembly) instance will then be created at each location.

Is such a thing possible?

Your Tool’s onLButtonDown callback can examine the flags argument to detect whether the user is pressing the ctrl key and gather points for multiple footings when that happens. You just need to accumulate the points and draw at each of them when your extension detects a finishing condition, e.g. a click without the ctrl key modifier.

This is exactly the information I needed, thank-you.

The convention for SketchUp is that the CTRL key acts as a toggle in and out of copy mode. (This is why the API defines the constants as COPY_MODIFIER_KEY and COPY_MODIFIER_MASK.

Examine how the SelectionTool switches in and out of add or subtrcay mode, and the cursor changes to show + or - satellite icons. Or the MoveTool, … etc.

You’ll need to decide how to let the user tell the tool when they are done picking points.

Another convention is that the ESC key resets the tool to it’s initial state, or cancels the current state. (See the onCancel callback.)

The ENTER is another way, detected via a onReturn or onKeyUp callback.

There are two main ways to help a user locate and place one or more new custom geometric objects.:

  1. Create a Toolbar Command than calls a new Tool object that you create and instance. This is what you are doing. But creating interactive tool objects can be a lot of work, and tricky to get right. And this may not be the easiest for the user: he has to precisely pick each point to add each footing
  2. Create a Toolbar Command that uses the current selection to determine location(s), then adds the footings. No TOOL object required.

Any designer of foundations will not be locating pad footings in space: He will already have some graphic objects, like lines or construction lines defining a column grid. Once these exist he can preselect one or more intersection point(s) with a simple selection box dragged from right to left. No precise picking needed. Then your method can easily determine all intersection points where a footing should be placed.

Similarly with continuous perimeter wall footings: The user will already have a bounded face defining the perimeter of the building so don’t make him pick all the perimeter points again. Just have him select the face.

At first I was just going to setup the tool so the user could pick a single point, that will be the default mode of the tool. To instigate the multi-point placement mode my idea is to have the user pick the points while holding down a specific key (cntrl). To end the multi-point selection the user could release the ctrl key and select the final point or press the enter key or both.

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