Stu142 / FreeCAD-Gridfinity-Workbench

Generate Parametric Gridfinity Bins and Baseplates
GNU Lesser General Public License v2.1
37 stars 3 forks source link

Request to add parameter(s) to change part placement #1

Open dragon-architect opened 1 month ago

dragon-architect commented 1 month ago

When the Gridfinity workbench generates a part, it does so with one of the grid units (with respect to the X and Y axes, it is the front-left corner unit) centered on the origin. The generated blank cannot be moved unless it is part of a body, but then it will be offset by -20.75mm from the origin of the body's coordinate system on both the X and Y axes. If one desires to work from the front-left corner of a generated blank as a coordinate origin, one would need to compensate for this by changing the attachment offset of the geometry sketches (refer to attached screenshot).

Would it be possible to add a parameter or a set of parameters that can be set to change the placement of generated blanks using a multiple of gridfinity grid units?

In the implementation that I have in mind, positionX=0 and positionY=0 positions the generated blank entirely within the positive X and Y axes of the global coordinate system, with the 0.25mm tolerance also included. positionX=-0.5 and positionY=-0.5 could therefore replicate the current default hard-coded placement of generated gridfinity blanks. For a 2x2 gridfinity blank, positionX=-1 and positionY=-1 would center the blank entirely around the global coordinate origin.

Screenshot 2024-06-10 181719

Stu142 commented 1 month ago

This is a great idea, it should be fairly easy to implement the starting position to be 0,0 instead of offset by half a grid.

It should also be easy to add a movement variable as you describe.

I'm not sure when I will get to this I'm quite busy at the moment but when I do it shouldn't take long.

dragon-architect commented 1 month ago

I look forward to seeing it implemented when you do get around to it! Thanks for taking the idea. :)

bcwhite-code commented 3 weeks ago

An additional idea... When I create a blank, the XY-plane is at the top of the part (but below the stackable lip). Would it be better for this to be at the bottom (aka: the 7mm/1U mark)? Thus, the base would be -Z and the bin would be +Z.

I'm very new to this so it's difficult for me to judge what is best in this regard.

Stu142 commented 3 weeks ago

@bcwhite-code the z placement is actually an intentional choice so if you go to make a custom cuts into the bin blank you can set your sketch to be on the XY plane.

This avoids attaching the sketch to a face where you could run into Topological naming problems.

You could offset the sketch from the XY plane alternatively but that is more complicated for a beginner.

I could potentially make it so the other bins generate at z0 at the bottom if there was reason to.

Thanks for asking though I'm always open to ideas.

bcwhite-code commented 2 weeks ago

Yeah, that makes sense. I just need to find an easy way to make holes to the maximum depth, keeping 2mm of baseplate.

BTW, this is a really useful addon and works well. Thanks!

Stu142 commented 2 weeks ago

You can reference the properties of the bin in dimensions of sketches or features l.

So for example you draw a sketch on top of a blank bin then pad and put the expression

BinBlank.TotalHeight - 2mm

This will give you the two 2 mm at the bottom

Same this applies to all properties, I have been meaning to add some documentation on this to the page.

bcwhite-code commented 2 weeks ago

Nice. I didn't know about that. I've been attaching the sketch to the bottom, moving it -2mm Z then doing a pocket "through all".