Using mouse input to position an object?


Continuing the discussion from LineTool example:

Also in the descriptive text of “linetool.rb”, it states:

“You should also look at the TrackMouseTool defined in utilities.rb for an example of a simpler tool.”

(You need to download the Utilities Tools example extension separately.)

But there are different ways to “position” objects based upon the object type, and where it is coming from. It would be best to be a bit more specific.

Is the object in the selection set ?

Is it a primitive (edge or face) ?

Is it a component that is not yet in the model ?

Is it a group or component instance, whose definition is already present in the definition list ?

Will it move the object, or insert another instance, or a new unique copy ?


Oh sorry I did not see this,

Since this I have found the trackmouse example and others in Automatic Ruby and FredoTools DrawAlong.

It is an undefined tool. I was hoping to find a basic structure that does everything the LineTool does that I can build upon.

The linetool.rb does all the basic mouse stuff and I have made a tiny bit of progress toward understanding it.

I get an odd behavior in the linetool.rb and the AutomaticRuby sphere.rb where the the drawline view is not displayed correctly at some distances between pt1 and pt2

I learned that I can change any method in the linetool example which is not listed in the API index and that there is no simple way to use the mouse.

I appreciate your help,
learning Ruby is very frustrating -in the first few weeks particularly