Saturday, 16 February 2013

Drawing Module: Section Views

This past week has been a tremendously busy one at University, but in the few bits of time I do have available, I have been looking at incorporating section views into my experiments on the Drawing Module. For those unfamiliar what a 'Section' views, below is an example. These are highly important in mechanical design and allow complex features to be seen and also annotated

Sectional View Along Axis A-A
Yorik, already did some work within his arch module purely using the python capabilities within FreeCAD. This can be used in the latest release of 0.13. His solution is simple but works well. Below is a representation of the sectioning algorithm (I am currently waiting for a download to finish so found the time to draw it)

  1. The user defines a 3D plane. The 3D Plane is then checked to see if it intersects with the object
  2. The bounding box for the FreeCAD part is then projected onto the cutting plane - there are 8 points.
  3. The maximum size of each projection on the principal axes of the plane are found. These are then turned into an extruded box prism and a boolean cut operation leaves the remaining part.
  4. The remaining sectioned part remains. The faces are then projected and if they are coincident with the cutting plane it will be sectioned face.
Interestingly enough I decided to mimic such behavior in the Sectioned View of this. Although relatively simple, in c++ requires finding the correct modeling algorithms in OpenCascade. After some mind boggling, I eventually got something crude to work.

The functionality I am aiming towards is something similar to the functionality in other commercial CAD packages (namely Solidworks). My view is that using a 3D plane to section an object can be slightly tedious and awkward - atleast until we get a plane feature with the arrival on the Assembly Module. Instead I think it is more practical to create a section in the 2D Drawing User Interface.

 The user can create both 3D and Orthographic projections of the object and the user will 'draw' a section line AA in 2D. Upon completion this will create a new 'Section' View to the side that can be freely positioned.

The section plane is calculated simply by taking the cross product of the current view normal and the line, which produces the new normal of the plane.

This would hopefully cover most cases, but it should also allow an arbitrary plane to be set to create more flexibility when sectioning. 

The one complication that arises is that references will be lost because of the boolean operation. This will be of concern atleast until we get the more robust naming mechanism.


Any sectioned faces or even chosen ones should be fillable with a hatch pattern. This can be detected automatically if the face is coincident on the plane. I haven't yet decided the approach for storing hatching information but should be relatively straight forward.

I am hoping to get some more of this done tonight or tomorrow and have something to show but that all depends on University work...