Wrapper Classes for FreeCAD These classes provide a stable interface for 3d objects, independent of the FreeCAD interface.
Future work might include use of pythonOCC, OCC, or even another CAD kernel directly, so this interface layer is quite important.
Funny, in java this is one of those few areas where i’d actually spend the time to make an interface and an implementation, but for new these are just rolled together
This interface layer provides three distinct values:
 It allows us to avoid changing key api points if we change underlying implementations. It would be a disaster if script and plugin authors had to change models because we changed implmentations
 Allow better documentation. One of the reasons FreeCAD is no more popular is because its docs are terrible. This allows us to provie good documentation via docstrings for each wrapper
 Work around bugs. there are a quite a feb bugs in free this layer allows fixing them
 allows for enhanced functionality. Many objects are missing features we need. For example we need a ‘forConstruciton’ flag on the Wire object. this allows adding those kinds of things
 allow changing interfaces when we’d like. there are few cases where the freecad api is not very userfriendly: we like to change those when necesary. As an example, in the freecad api, all factory methods are on the ‘Part’ object, but it is very useful to know what kind of object each one returns, so these are better grouped by the type of object they return. (who would know that Part.makeCircle() returns an Edge, but Part.makePolygon() returns a Wire ?
Plane(origin, xDir, normal)  A 2d coordinate system in space, with the xy axes on the a plane, and a particular point as the origin. 
Vector(*args)  Create a 3dimensional vector :param *args: a 3d vector, with xyz parts. 
Solid(obj)  
Shell(wrapped)  
Wire(obj)  
Edge(obj)  
Vertex(obj[, forConstruction]) 
Create a 3dimensional vector
Parameters:  *args – a 3d vector, with xyz parts. 

FreeCAD’s vector implementation has a dumb implementation for multiply and add– they modify the existing value and return a copy as well.
This vector is immutable– all mutations return a copy!
The center of myself is myself. Provided so that vectors, vertexes, and other shapes all support a common interface, when Center() is requested for all objects on the stack
A 2d coordinate system in space, with the xy axes on the a plane, and a particular point as the origin.
A plane allows the use of 2d coordinates, which are later converted to global, 3d coordinates when the operations are complete.
Frequently, it is not necessary to create work planes, as they can be created automatically from faces.
Determine if testWire is inside baseWire, after both wires are projected into the current plane
Parameters: 


Returns:  True if testWire is inside baseWire, otherwise False 
If either wire does not lie in the current plane, it is projected into the plane first.
WARNING: This method is not 100% reliable. It uses bounding box tests, but needs more work to check for cases when curves are complex.
Create a predefined Plane based on the conventional names.
Parameters: 


Available named planes are as follows. Direction references refer to the global directions
Name  xDir  yDir  zDir 

XY  +x  +y  +z 
YZ  +y  +z  +x 
XZ  +x  +z  y 
front  +x  +y  +z 
back  x  +y  z 
left  +z  +y  x 
right  z  +y  +x 
top  +x  z  +y 
bottom  +x  +z  y 
returns a copy of this plane, rotated about the specified axes, as measured from horizontal
Since the z axis is always normal the plane, rotating around Z will always produce a plane that is parallel to this one
the origin of the workplane is unaffected by the rotation.
rotations are done in order x,y,z. if you need a different order, manually chain together multiple .rotate() commands
Parameters:  roate – Vector [xDegrees,yDegrees,zDegrees] 

Returns:  a copy of this plane rotated as requested 
Set a new origin based of the plane. The plane’s orientation and xDrection are unaffected.
Parameters: 


Returns:  void 
results in a plane with its origin at (x,y)=(4,4) in global coordinates. The both operations were relative to local coordinates of the plane.
Move the origin of the plane, leaving its orientation and xDirection unchanged. :param originVector: the new center of the plane, global coordinates :type originVector: a FreeCAD Vector. :return: void
Project the provided coordinates onto this plane.
Parameters:  obj – an object or vector to convert 

Returns:  an object of the same type as the input, but converted to local coordinates 
Most of the time, the zcoordinate returned will be zero, because most operations based on a plane are all 2d. Occasionally, though, 3d points outside of the current plane are transformed. One such example is Workplane.box(), where 3d corners of a box are transformed to orient the box in space correctly.
All objects inherit from Shape, which as basic manipulation methods:
Represents a shape in the system. Wrappers the FreeCAD api
Returns the right type of wrapper, given a FreeCAD object
Gets the underlying geometry type :return: a string according to the geometry type.
Implementations can return any values desired, but the values the user uses in type filters should correspond to these.
As an example, if a user does:
CQ(object).faces("%mytype")
The expectation is that the geomType attribute will return ‘mytype’
The return values depend on the type of the shape:
Vertex: always ‘Vertex’ Edge: LINE, ARC, CIRCLE, SPLINE Face: PLANE, SPHERE, CONE Solid: ‘Solid’ Shell: ‘Shell’ Compound: ‘Compound’ Wire: ‘Wire’
Returns True if the shape is the specified type, false otherwise
contrast with ShapeType, which will raise an exception if the provide object is not a shape at all
Rotates a shape around an axis :param startVector: start point of rotation axis either a 3tuple or a Vector :param endVector: end point of rotation axis, either a 3tuple or a Vector :param angleDegrees: angle to rotate, in degrees :return: a copy of the shape, rotated
returns a copy of the object, but with geometry transformed insetad of just rotated.
WARNING: transformGeometry will sometimes convert lines and circles to splines, but it also has the ability to handle skew and stretching transformations.
If your transformation is only translation and rotation, it is safer to use transformShape, which doesnt change the underlying type of the geometry, but cannot handle skew transformations
Attempt to extrude the list of wires into a prismatic solid in the provided direction
Parameters: 


Returns:  a Solid object 
The wires must not intersect
Extruding wires is very nontrivial. Nested wires imply very different geometry, and there are many geometries that are invalid. In general, the following conditions must be met:
This method will attempt to sort the wires, but there is much work remaining to make this method reliable.
Creates a ‘twisted prism’ by extruding, while simultaneously rotating around the extrusion vector.
Though the signature may appear to be similar enough to extrudeLinear to merit combining them, the construction methods used here are different enough that they should be separate.
(3) create a ruledSurface between the sets of wires (40 create a shell and compute the resulting object
Parameters: 


Returns:  a cad.Solid object 
Fillets the specified edges of this solid. :param radius: float > 0, the radius of the fillet :param edgeList: a list of Edge objects, which must belong to this solid :return: Filleted solid
computes the intersection between this solid and the supplied one The result could be a face or a compound of faces
makeBox(length,width,height,[pnt,dir]) – Make a box located in pnt with the d
imensions (length,width,height)
By default pnt=Vector(0,0,0) and dir=Vector(0,0,1)’
makeCylinder(radius,height,[pnt,dir,angle]) – Make a cylinder with a given radius and height By default pnt=Vector(0,0,0),dir=Vector(0,0,1) and angle=360’
makes a loft from a list of wires The wires will be converted into faces when possible– it is presumed that nobody ever actually wants to make an infinitely thin shell for a real part.
By default pnt=Vector(0,0,0), dir=Vector(0,0,1), angle1=0, angle2=90 and angle3=360’
makeTorus(radius1,radius2,[pnt,dir,angle1,angle2,angle]) – Make a torus with agiven radii and angles By default pnt=Vector(0,0,0),dir=Vector(0,0,1),angle1=0 ,angle1=360 and angle=360’
make a shelled solid of given by removing the list of faces
Parameters: 


Returns:  a shelled solid WARNING The underlying FreeCAD implementation can very frequently have problems with shelling complex geometries! 
Attempts to build a wire that consists of the edges in the provided list :param cls: :param listOfEdges: a list of Edge objects :return: a wire with the edges assembled
Attempt to combine a list of wires into a new wire. the wires are returned in a list. :param cls: :param listOfWires: :return:
Makes a Circle centered at the provided point, having normal in the provided direction :param radius: floating point radius of the circle, must be > 0 :param center: vector representing the center of the circle :param normal: vector representing the direction of the plane the circle should lie in :return:
Returns:  a vector representing the end point of this edge. 

Note, circles may have the start and end points the same
Create a line between two points :param v1: Vector that represents the first point :param v2: Vector that represents the second point :return: A linear edge between the two provided points
Interpolate a spline through the provided points. :param cls: :param listOfVector: a list of Vectors that represent the points :return: an Edge
Makes a three point arc through the provided points :param cls: :param v1: start vector :param v2: middle vector :param v3: end vector :return: an edge object through the three points