in3dca-freegrid icon indicating copy to clipboard operation
in3dca-freegrid copied to clipboard

Consider changing z unit height to mm

Open hasecilu opened this issue 2 years ago • 7 comments

The last 2 days I have been testing your Macro and I totally like it. The only drawback I had while using it it was with the z unit height constraint, it is restrictive with very small vertical spaces. I have a 55mm height desk drawer, I designed a through hole resistor box (available at cults3d) and with only 48 mm available for boxes, 10mm boxes wouldn't leave space for resistors, with 20mm boxes would have use more grids, so I used 15mm boxes and I can stack 3 boxes allowing up to 18 different resistor values per 3 square grid units. The macro will be more flexible if it allows to specify the z height directly in mm in the GUI versus having to modify the z unit height in the code. As I showed, this consideration is relevant in small closed spaces, in an open space on a shelf seems irrelevant. Anyway now my resistors are happily organized in 9 square grid units. Greetings.

hasecilu avatar Aug 08 '22 18:08 hasecilu

Hi and thanks for your comments!

I have been considering creating an "advanced" tab that lets people adjust some of these parameters from the GUI, including the overall grid size (so that people could print Infinigrid sized boxes if they wished). The unit height is set so that people don't wind up with a bunch of odd height boxes that don't stack well. I think that's a fairly important principle, but your use case is an obvious exception.

However while that's easy to describe, it's a non-trivial amount of work, and there are lots of edge cases to consider. So it might be a while before that gets implemented.

instancezero avatar Aug 08 '22 22:08 instancezero

Thanks for your response, considering the effort to change the behaviour it's better to modify the code, it's not hard. The consistency in z is a very reasonable point. For the time being I'll be creating more boxes.

hasecilu avatar Aug 09 '22 21:08 hasecilu

I wonder how hard it would be to treat a number as 10mm units, but a dimensioned number "15mm" literally? I wonder whether FreeCAD has a custom validator written for this?

johnsonm avatar Aug 22 '22 23:08 johnsonm

Could try to parse as int, and if doesn't parse as int, use FreeCAD.Units.parseQuantity to find an arbitrary height, and I'd think you could just use that parsing as a validator function, including restricting to a positive range.

https://wiki.freecadweb.org/Units

johnsonm avatar Aug 27 '22 15:08 johnsonm

Ok, now in #11 I submitted a change to use FreeCAD's Quantity parser so the user can enter any valid length unit. The drawback is that the standard z unit is not used anymore.

The name of the generated boxes indicates the z height in mm regardless of the unit used: In3D_1x2x152_4mm_box, In3D_1x1x42_0mm_box, but can be changed to reflect the unit used.

Info: https://wiki.freecad.org/Quantity

hasecilu avatar Oct 28 '23 05:10 hasecilu

If you choose the z height in cm rather than mm by default, it will retain its current behavior for undimensioned heights, but also be capable of being set to any other height.

johnsonm avatar Oct 30 '23 02:10 johnsonm

Just wanted to let you guys know that I'm not dead, just busy as heck. I'll get these merged Real Soon Now (tm)

instancezero avatar Oct 30 '23 14:10 instancezero

Macro: Done in 6f5970e4065b, merged on #11.

The Workbench only accepts length quantities.

hasecilu avatar Oct 16 '24 19:10 hasecilu