def self.activate_rectangle_tool
Sketchup.active_model.select_tool(RectangleTool.new)
#and how to active face that is created by rectangle tool???
face.pushpull(100.mm)
end
activate_rectangle_tool
I want to make box directly using rectangle(face)tool
You can’t do this.
Simply put… your tool needs to add a face from 4 specified corner points, then use pushpull on that new face [taking into account the face’s normal which is not definable if z=0 and needs trapping for]
If already you have some API code to make a rectangle then use that and add on your pushpull code for the created face…
… is because it is making the call from within it’s own extension sub-module where RectangleTool is a locally defined constant identifier.
But outside that namespace, in your own namespace(s), you need to fully qualify the constructor method call.
However, this rectangle extension is an example and you would be better to change it to be within your own namespace modules, and perhaps modify it to dynamically extrude the box. (It would need to be renamed as a DrawBox tool.)
You can also see a parametric Box example (using a inputbox for dimensions) in the Community Shapes extension …