

- Freecad python scripting examples for free#
- Freecad python scripting examples software#
- Freecad python scripting examples code#
- Freecad python scripting examples download#
The great part about GSoC is that students apply for specific projects, so you yourself determine how exciting the thing you work on is if you get accepted. But there are also more niche organizations that are not so widely known. Among the organizations are well known ones like Arduino, Ruby or Wikimedia.
Freecad python scripting examples code#
Google Summer of Code (GSoC) is a program run by Google that gives stipends to students who over a period of three months implement an open source project with a mentor organization. This gives great flexibility and allows for fast customization. All the relevant details depending on this number will be automatically recomputed by FreeCAD. For example with my lamp design the number of aluminium bars is a parameter I can simply tweak at any point in time. The parametric approach allows you to easily modify your design at any time just by tuning these parameters.

Is FreeCAD NP-complete? Probably, but that’s a topic for another time. And every step is based on certain parameters that can reference previous parameters. Then you create a 3D shape out of your 2D sketch, for example by extruding it.

The geometric figures of the 2D drawing - circles, recatangles, lines - are all constrained with parameters. That means that you specify shapes with parameters. FreeCADs approach to CAD is a parametric design. Still it’s very usable and once you get the gist of it you can create powerful and complex designs.
Freecad python scripting examples software#
The software is still in it’s alpha version and is far from perfect as you can tell by the current release version number 0.19 and the heated discussions around how soon a 1.0 release could be reached.
Freecad python scripting examples for free#
It still amazes me that people created this for free in their spare time. FreeCAD is an amazing open source CAD program. If you change one of the properties (radius, eccentricity, etc.) model will be automatically refreshed.Accidentally while creating a lamp I ended up learning FreeCAD. If _name_ = "_main_": #feature will be generated after macro executionĪfter macro execution effect should be similar to first one. Wankelblock=doc.addObject("Part::FeaturePython","Wankel_Block") #add object to document Steps=int(fp.Segments) #get value from propertyĮxt=diff.extrude(Base.Vector(0,0,h)) #extrude the cut (face) If prop = "Radius" or prop = "Eccentricity" or prop = "Height" or prop = "Segments": #if one of these is changedĭef execute(self, fp): #main part of script Obj.addProperty("App::PropertyLength","Segments","Wankel","Number of the line segments").Segments=72 Obj.addProperty("App::PropertyLength","Height","Wankel","Height of the block").Height=30.0 Obj.addProperty("App::PropertyLength","Eccentricity","Wankel","Rotor eccentricity").Eccentricity=12.0 Obj.addProperty("App::PropertyLength","Radius","Wankel","Base radius").Radius=60.0 ''' Add the properties: Radius, Eccentricity, Height, Segments (see Property View) '''
Freecad python scripting examples download#
Parametric way:Open a new document and create a macro from below code ( download macro): Unfortunately the Shape is not editable:( You can click Fits the whole content of the screen button to tune view area. You should see Shape object in the Tree view and Wankel block model in the view area. Part.show(ext) #show extrude in FreeCAD window

Wire1 = Part.Wire() #rectangleįace1 = Part.Face(wire1) #face from rectangleįace2=Part.Face(wire2) #face from epitrochoid ĭiff = face1.cut(face2) #boolean cut epitrochoid from rectangleĮxt=diff.extrude(Base.Vector(0,0,30)) #extrude the cut (face) X2=e*s(3*ang)+r*s(ang) #coords for line endpointĮdge1 = Part.makeLine((-halfw,halfh,0), (halfw,halfh,0)) #lines needed to create rectangleĮdge2 = Part.makeLine((halfw,halfh,0), (halfw,-halfh,0))Įdge3 = Part.makeLine((halfw,-halfh,0), (-halfw,-halfh,0))Įdge4 = Part.makeLine((-halfw,-halfh,0), (-halfw,halfh,0)) X1=e*s(3*ang)+r*s(ang) #coords for line startpoint ( Download macro)įrom _future_ import division # allows floating point division from integersįor i in range(steps): #make many lines and connect they in wire (polyline, epitrochoid) Put below script in the Python interpreter line or create a macro.
