How do I create two points using onLButtonDown

I’m building an EXTENSION that automatically builds boxes.
Thankfully, the first plug-in was able to implement a box by entering coordinate values ​​at one point by applying a plug-in made by a creator called ‘mat666’ (using onLbuttondown)
However, I realized that making it through one point is difficult to cope with multiple angles from the axis, and I am trying to make a plug-in using two points. I’ve been using @case through various explanations, but I’m still having a lot of difficulties. can i get some help? :joy:

def onLButtonDown(flags, x, y, view)
	@ip1.pick view, x, y
	if( @ip1.valid? )
		self.create_geometry(@ip1.position,view) ##errpr

Have a look at the examples in the repository on GitHub …

1 Like

Thanks for the answer, but I’m not sure if the answer I’m looking for is within the Git hub.
At least I wanted to create two points within sketchup and know the location of the points, but that answer seems too abstract. I’ll do a bit more research and take a look. Thank you. :grin: :grin: :grin:

The example edge tool ("02_custom_tool") draws an edge between two points that the user clicks.

There is also another example that shows how to get two points via a click, drag and release.

1 Like

Thanks for your help :slight_smile:
It’s not that way, but I understood the concept after seeing the ruby you asked me to see, and as a result, I got what I wanted. Thank you very much.


You’re welcome. Another concept is to write “SketchUppy” tools which should use the VCB (Value Control Box, also called the “Measurements” input,) like the native tools do. There is at least one example that shows how to accept user input from the VCB.

1 Like