Freecad Python scripts

I am working on FreeCad python scripts for making corner rails and couplers for the creation of enclosures. Not the enclosures themselves. These are just rails where panels/sheets can slide in at 90 degrees angles. The length is variable and can go from 76.2mm to 304.8mm. There are options for having about 12 types of material for the each slot. Still working on the script and it would be available with MIT licenses - There is also a coupler where each “rail” can be coupled with 4 5mm screws to each other to create relativly unlimited length. I would only supply one example stl file for the rails and one stl file for the coupler. This would include stl files with slots that are good for 1/16 aluminum sheets or 16ga steel or 1.5mm/1.6mm plastic and 250mm long, Is that type of file useful as it uses the latest FreeCAD python window to generate the files? I am also concerned that a Box catagory will not get much attention - nor enclosure. I am similarly concerned that this is not an appropriate forum for Freecad pythons scripts.

I am unclear as to what these are, who they apply to and how they would be used.

I expect that if your idea is something someone else will use then providing a clear Thing page with examples, images, and instructions would be useful and might help others see if the project would be useful to them.

If your projects has base requirements (ie. latest FreeCad), then providing them and making them clear to the user would be a necessity. If someone wants to use your project they would then ensure that they follow your instructions in order to get the results they want.

After rereading your post again I believe I understand that you are designing 3D printable parts that will act as corner joints when building enclosures out of other material like sheet metal or plywood. These would be used instead of making physical connections using the enclosure material itself. Similar to attachable gussets but running the length of the join and the connection is just a slide together fitting?

The two slots can be configured for up to 1/8 inch sheet material. There are two slots at perpendicular angles and each can be set for different materials. The minimum size is 16ga_steel sheet.

Expanded material property lookup table for CAD slot generation, Where the second variable in the list is the width of the slot. - I hope to make the selection list for each slot - a limited list by name.

Format: “Material Name”: (Nominal Thickness in mm, Slot Width with ~0.15-0.18mm clearance, Description)

MATERIAL_SPECS = {
“12ga_aluminum”: (
2.05,
2.25,
“Heavy-duty aluminum cover sheet; excellent thermal transfer”,
),
“12ga_steel”: (
2.66,
2.85,
“Heavy structural steel frame/chassis; maximum rigidity”,
),
“14ga_aluminum”: (1.63, 1.80, “Medium aluminum enclosure walls”),
“14ga_steel”: (1.90, 2.10, “Standard steel paneling”),
“16ga_aluminum”: (1.29, 1.45, “Lightweight aluminum covers”),
“16ga_steel”: (1.52, 1.70, “Standard thin-gauge steel”),
“18ga_aluminum”: (1.02, 1.20, “Thin aluminum trim or interior shrouds”), # Note: ~0.040 in, below 0.045 threshold
“18ga_steel”: (1.21, 1.38, “Lightweight steel brackets (~0.048 in)”),
“metric_1.5mm”: (1.50, 1.68, “Standard 1.5mm metric sheet stock”),
“metric_2.0mm”: (2.00, 2.18, “Standard 2.0mm metric plate stock”),
“plate_1_8in”: (3.18, 3.35, “1/8 inch heavy structural plate”),
“frp_09”: (
2.25,
2.40,
“0.09 inch fiberglass (FRP) structural panels; high electrical insulation”,
),
}

So its a work in progress at the moment -

Just a question because of a couple of projects I have tried lately.

Have you tried doing this using OpenScad? Thingiverse does have a (very old version) of a customizer that if you provided the file as a scad file users would be able to customize and export a stl directly.

So for me to visualize what is actually being made.

Is it basically a square (or similar) extrusion with slots in adjacent sides (where the sheet fits in) and some kind of hole (for a screw) to secure the sheet in place?

@ab4td Call it a “Pokemon enclosure” and you will get thousands of hits and likes, no matter what it is or whether it works or not.

Freecad does export Openscad - I have an example - it is currently set for slots for 16ga steel sheet. I dont see how to add it to a reply. I can see there is a link - but not a file transfer. I will see if I can post it.

An interesting proposal. Probably too true, but needs a different audience. lol

I didn’t mean for using in FreeCAD. I meant that maybe your design could be built in OpenSCAD and then it could be customized directly in Thingiverse using their Customizer. I expect that most people taking models from Thingiverse do not know how to do a lot of this stuff on their own so they require something easy and simple.

I think I understand your concern. It is a question of the usefulness to the user base. FreeCAD isn’t necessarily a wide spread tool in the user set. I am using because I can use python to generate the actual part. And of course I can export to OpenSCAD format, but missed the point. OpenSCAD might have been used to generate these parts for me. But I didn’t choose that path. And once my python FreeCAD scripts are published as MIT licensed files, I would like someone to update these to OpenSCAD generate parts. Now I have a new SheetMetalCornerRail item and it has an OpenScad file and a FreeCAD file. I case you want to review that. The use of FreeCAD is another free tool, and it is relatively easy to get to the python window and copy paste files to create the FreeCAD rendering. No expense - not dificult, but then again - yet another tool. I suspect this might not be the right websight to supply this as a tool.

Sorry, I didn’t mean it as a concern. I was thinking of it as another option for this particular user base and website. There has been some talk on the forum of trying to get FreeCad implemented as a Cutomizer tool but I have not really followed it because I haven’t had the need. My understanding is that the current scad customizer should be updated before any new system is implemented.

The material lookup table makes more sense now. Having the slot width tied to the selected material should make the script easier to use once the selection part is finished. I’d also include a small example showing how the generated joint looks with a couple of different sheet thicknesses. That would make the intended use much clearer for someone trying the script for the first time.

I am working on a few changes to the python script before submitting these. I have to modify the slot dept/rail height to accomodate more strength where the two sheet holding screws are placed. I am adding a minimum of 2mm slot depth and rail height by default to put more plastic around the two 3mm screws per sheet.. I am adding in an option for a selection for 16mm slot depth and 8mm more height for additional strength for the two 3mm screws per sheet. The Rail part is arranged to sit on a 45 degree corner flat of 8mm width. It 3d prints at 45 degrees so there is no supports required. It makes the slots come out clean. But since the walls are at 45 degrees, there is a problem with most materials where most filament types have a WARP_FACTOR adjustment specific to the filament type. This is an attempt to keep the two 90 degree legs as close 90 degrees as possible. This is applied to the actual rendering of the part in FreeCAD - such that each FreeCAD rendering is unique for the filament type. This must be specified and unfortunately somewhat emperically discovered. And option will be specified and input as a number between .00 to .50 as it specifies a mm offset between to adjust by mm in distance. I have a PETG part that when printed with .00 has about .12 per 1mm distances. That keeps the 90 degrees at at about 93 degrees further apart than specified. Interesting limitation. If you were constructing the part for aluminum extrusion or milling this doesn’t need the WARP_FACTOR or 3d printing a part with 90 degree walls, then a value of .00 would be perfect. As confusing as that is, it is a fact of life with printing at an angle. I was surprised - Its because of the uneven cooling of the part which varies by filament and by printing conditions.
So I will add those to selection options to this python script to generate the part. When I started to make this part I was using ASA, and the warping was at least 100 degrees for the 90 degree angle. Switching to PETG the angle was more like 93 degrees or so, better but not perfectly 90. Then I switched to PETG-CF and it is still a little over 90. I have not tried any more filaments - and setting a selection of correction factors for warping is not in the cards as my sampling of filaments and priinting conditions are not ranging far enough to do that. I will be putting this design on Github as the primary distribution method. I can put out a few stl files for PETG and maybe PETG-CF with specific corrections for acheiving a true 90 and submit to Thingiverse. I am wondering if I should include metric or SAE part lengths - I can work on providing a length of 300mm 250mm and 125mm parts or 12" , 10" , and 5" parts - These would have the 10mm slot depth and 1/16 aluminum slot width. That should provide for a 16 ga aluminum, 1.5mm thick sheet material and 16ga steel.
I will write up a reference to the Githup access for documentation - and information.

1 Like

I think I understand your concern. It is a question of the usefulness to the user base. FreeCAD isn’t necessarily a wide spread tool in the user set. I am using because I can use python to generate the actual part. And of course I can export to OpenSCAD format, but missed the point. OpenSCAD might have been used to generate these parts for me. But I didn’t choose that path. And once my python FreeCAD scripts are published as MIT licensed files, I would like someone to update these to OpenSCAD generate parts.

I have modifications to my FreeCAD pythond scripts - In that my scripts had no real options that worked to minimize the WARP - in that since the part has to be printed at a 45 degree angle from vertical, the filament material sags to have the resulting slots be at more than 90 degrees apart. The fix is to have an input for the angular correction needed to correct this in the FreeCAD rendering of the part. I also have a FreeCad python script to render angle guages - with granularity to .01 degrees - up to 9.99 degrees. Which is overkill - but this should provide a way to evaluate how much warping occurs. The reason for using 3d printer orientation at 45 degrees is to eliminate any need for 3d printer supports. This would interfere with the creation of accurate slots in the wings of the parts. I am still estimating my printer filament warp printing at 45 degrees. It seems to be slightly greater than 0.9 with PETG filament. with a .6mm nozzle.. There are two “wings” on this part at 90 degrees apart. Each wing has a separately configurable slot along it to hold sheet material. I also included two slot depth sizes - 10mm and 16mm . The outside lip of the slot is 3.5mm thick and the inside lip of the slot varies as the slot width is determeined by the type of sheet material. The total thickness of the wing is 11mm. The largest slot width is 1/8" . I have tried this out and now I can post this version of the python script. I am still working on revising the coupler python script to fit the two slot depths. The coupler is used for two purposes. One is to provide an interior lip so a sheet can be cut that fits inside of the box- where there are screw holes in the coupler to mount it to the rail , and for this sheet to be screwed down to the coupler - That is one purpose of the coupler. The other purpose of the coupler is to fit inside two separate rails to align and connect the rails. This will allow the rail lengths to be added together for making a much larger box. The screw holes in the rails and the coupler match up. Even though I can only 3d print rails that are 12" long, or 300mm - I can join these together with couplers for any size. What ever makes sense . I am ready to drop the corner rail script. Probably tomorrow, but I will need to validated the coupler rendering and 3d printing for the coupler. And its takes me time to 3d print.