Geometry Scripting in Blender,Pythonocc and FreeCAD using Python

Tom Paul
3 min readJan 21, 2020

--

This article discuss about how to create or develop a geometry from given vertex data using python programming language in opensource packages mainly Blender, Pythonocc and FreeCAD. Python is used as an scripting language for these three packages.The purpose is to help the beginners who want to explore Additive Manufacturing design possibilities who have only experience in using User Interface of a CAD software.With programming knowledge, you can expand the application areas by creating your own customised functions.

All the video tutorial(with explanation) and link to python scripts have uploaded in my Patreon page.You can access it through my Patreon page by paying any small amount because it is posted to all Patrons. I have not yet started to post to a specific Tier category. But tutorials regarding Conformal Cooling Channles, Topology Optimisation and Lattice structures using implicit modelling will upload step by step. All these tutorials will be created by only using opensource packages.

Here I will show the images of the output from each script.

Blender

Fig 1: Creating each face of a cube using a for loop in Python from the given vertex data using the command ‘edge_face_add()’

Fig 2: Rotating selected vertices around Z axis, results in the modified shape

FreeCAD

Fig 3: Creating each face of a cube using a for loop in Python from the given vertex data using the command ‘Part.makeFilledFace’

Fig 4: Translating top and bottom mid points to the outer circumcircle while center section points move inwardly towards the center

Pythonocc

Fig 5: Displaying the vertices data

Fig 6: Displaying the Edges

Fig 7: Displaying the faces

Fig 8: Displaying the shell object

Fig 9: Displaying the solid object

Fig 10: Some vertex data altered and the modified geometry displayed here.

The benefit of using opensource packages is it will helps you to think logically. You will know step by step the power of Mathematics and Computation. As Additive Manufacturing can manufacture much more complex structures, we can today almost manufacture the simulation data. Process physics based or Goal focused design evolves while manufacturing constrain based design which world had followed for decades in Product development will give way for this new way of doing things.The skill you need for a customised product world will be designing algorithms which is efficient and faster. So,Learn to Code!

--

--

Tom Paul

Focused on exploring additive manufacturing geometric freedom capabilities by creating a realtime mutliphysics package which will be opensource as well.