Make box using Rectangle tool

def self.activate_rectangle_tool
  #and how to active face that is created by rectangle tool???


I want to make box directly using rectangle(face)tool

Could you give me some help to edit code?

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…

If you have the Rotated Rectangle Tool Example extension installed …

… then from within your extension’s namespace you’d need to call …


The reason that the Rotated Rectangle Tool Example extension can do this …"Draw").add_item("Rotated Rectangle") {

… 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 …



1 Like