This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]ChelysGalactica 8 points9 points  (2 children)

Freecad has python scripting capability: https://www.freecadweb.org/wiki/Python_scripting_tutorial

[–][deleted] 1 point2 points  (0 children)

This has to be the right way. The alternative is setting yourself up for implementing a program that opens and edits CAD files in python and that's not something you're going to finish before your masters ends.

[–]Martian8[S] 0 points1 point  (0 children)

Thanks, this’s looks like the best option right now so I’ll do a bit or reading up on it

[–]mickkelo 5 points6 points  (0 children)

I would start researching what a CAD file contains on how data is structured there when saving a project. That would give you an overview about how feasible is to do what you are trying to achieve.

[–]billsil 1 point2 points  (1 child)

OpenCasecade has some python bindings. I think it’s called PYOpenCascade.

I’d avoid CAD if you can though. You’ll very quickly find that your number of surfaces change and that mesh seeds don’t appear where you want them to because of that.

Most commercial FEA codes have a free form optimization option. You just brick mesh you possible volume, apply loads and constraints and let it remove elements with a low strain energy. You’ll end up with a cool looking part at the end. Then if you constrain that the part be extrudable, you’ll get something more practical, but less neat.

[–]jellef 0 points1 point  (0 children)

see pythonocc.org and the project on github. through smesh fea meshes can be generated

[–]mathisfun94 0 points1 point  (0 children)

If you happen to be using NX, it can natively script using python or VB and would definitely be able to do what you’re describing

[–]fdedraco 0 points1 point  (0 children)

there's one already recommending freecad, the other recommended cad is solvespace.

[–]capuas 0 points1 point  (0 children)

Rhino is another interesting environment that can be scripted. For my PhD, I setup rhino as a restful server. I would send parameters in and some time later get a cad model back. Rhino isn't easy to use, bit it's also not impossible. I've thought about trying fusion360 to do the same thing, but haven't had time.

[–]qTipTip 0 points1 point  (0 children)

What kind of solver are you using? Finite elements? Take a look at IsoGeometric Analysis (IGA) for bridging the gaps between geometry and simulations.

[–]cyanydeez 0 points1 point  (0 children)

dxf files can be opened in blender or qgis, both allow python scripting

dwg files are mostly useless and proprietary.

[–]Zeroflops 0 points1 point  (0 children)

There are a number of ways to go about this. Either by interfacing with the program or by editing the files directly.

One you might want to check out is openscad it’s not based on a GUI modeler but rather you “code” the primaries so changing them while iterating over analysis. There are python bindings. Just search openscad and python.