I created a sketchUp plugin that draws a wall (with lenght, width and height).
Now I would like to insert a "window" in that wall (fixed length, width and height, depending on the wall). How can I:
The easy way to do it, that doesn't fulfill your request 100% - but do use existing SketchUp conventions, is to create a component definition and then use Model.place_component
to activate SketchUp's native tool to position a new component instance.
In order to fulfill your question 100%:
A Group is an instance. You cannot create one and not place it in the model. You can create it in step 3 when the user clicks. (Though, a window sounds like a candidate for a component since you usually have multiple copies of the same window type.)
You cannot constrain the mouse cursor itself, but if you implement a custom Tool
and make use of the InputPoint
class you can selectively determine what is a valid insertion point when the user clicks. You can also draw virtual lines and polygons to the viewport to give a preview of your window.
Profit!