The contour and profile operations are always generating their paths from 2D geometry. We're staring with 3D objects because that helps us make reasonable guesses at starting and ending depths but the actual path is calculated from 2D. They get the needed geometry by projecting 3D objects onto a plane and there are several helper functions available to make this easier.jcf wrote:Now I can generate a contour path by script.
The next step is to attack the profile path.
I have looked at the code which seems to be more complex, while part of this complexity lies in guessing the base object as it seems to me.
I have not fully understood which kind of object this must be. May it be 2D? For my approach the easiest would be Rectangle, Circle etc.
for example, you can take a sold object and do:
Code: Select all
import TechDraw
mywire=TechDraw.findShapeOutline(myobj.Shape, 1, Vector(0,0,1))
Code: Select all
edgelist = mywire.Edges
Code: Select all
edgelist = Part.__sortEdges__(edgelist)
Much of the complexity in Path has to do with handling user selections, making guesses at depths, keeping track of tools, etc. Be careful you don't start trying to reinvent all those wheels too.Or would it be better to switch to 3D? Note that my decision to start with 2D and to write my own code was that there were difficulties making a path at all, and problems with changes in FreeCAD that made me going mad as what worked yesterday did not work today. So I hoped that if I understand the code I can build something that works for me, as long as FreeCAd is still evolving.
So my question is: how can I make a contour path by code, based on objects that I selected befor or that I set by code?