Yes scripting could be very powerful, as it can do complex things, without having to think about complexity.
every improvement are permitted, even with complex things.
Once achieved a step you could ever save the file, rename and starting incrementing complexity.
If you learn to think parametric, you could also model an entire new model, simply modifying one or two parameters.
in the example:
You could see how the internal diameter is a function of r1 and thick, so you can always modify the diameter or the dome thickness without to recalculate r2 (internal diameter).
Obviously this is a rough way, as maybe in real project you have to state internal diameter (to accomodate maybe electronics) and leve the external diameter depending on thickness.
Similar:
Code: Select all
wall_th = 2
wall = Part.makeBox(wall_th, r1 * 2, r1 * 0.95)
wall.Placement = FreeCAD.Placement(Vector(wall_th * -0.50, r1 * -1, 0), ROT0)
I have guessed a Z height using the external diameter using a factor, without considering the real thickness, but as this wall is simply a square wall that has to be cut by the third sphere that uses "middle diameter" to make a fusion with the dome, I have cheated a little.
Example was more important than precision in this case.
You could even design all the walls, as a polygonal and then use an offset (to obtain the "horizhontal thickness") and extrude (to obtain the height)
and then cut the resulting solid using "cube.cut(middle_dome)" if you pass me the hybrid code to explain the real operation.
in your case as "internal reinforcement" seems to have a limited height, you could have fixed the Z height and then cut the part that execeed with the "cube.cut(middle_dome)" .
In the code there is some commented out code to make a "section cut" to check thickness and maybe intersections.
This way keep you safe also from some problem with complex models, when you have to modify maybe tens if not hundreds of parts, FreeCAD will simply recalculate them when you run the modified script.
Similar things could be achieved using a Spreadsheet to pass parametric data to the model, but scripting is more compact and safe, as script are simply text files, compact and rather small.
Downside is that you have to learn "Python" and the appropriate calls to FreeCAD methods, but it is not a "big job".
Sorry if this post has been boring.
Regards
Carlo D.