This is moslty for @wandererfan I guess
I'd like to pursue this idea to use TD to create hatching of objects inside the model itself, that is, as OCC geometry.
The way I see it: The TechDraw::DrawGeomHatch is the main object to use there, right? It seems to be able to create hatching as a collection of OCC edges. I'm thinking of extending its Python interface so we can manipulate it directly form Python.
My question is, how is it meant to be used? It seems to be used only temporarily, to create the hatching, then it is deleted, is that right?
Then we could do the same from Arch/Draft...
Using TD to create hatches in the FreeCAD model
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- wandererfan
- Veteran
- Posts: 6268
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Using TD to create hatches in the FreeCAD model
DrawGeomHatch(DGH) does create OCC edges based on a planar face outline and a PAT hatch specification. I don't think it will handle 3d faces in it's current form. It cheats a bit in using simple 2d algebra to find the endpoints of the hatch lines. You could do it in 3D with OCC functions, but it would be a significant change.yorik wrote: ↑Thu Jan 23, 2020 3:28 pm I'd like to pursue this idea to use TD to create hatching of objects inside the model itself, that is, as OCC geometry.
The way I see it: The TechDraw::DrawGeomHatch is the main object to use there, right? It seems to be able to create hatching as a collection of OCC edges. I'm thinking of extending its Python interface so we can manipulate it directly form Python.
My question is, how is it meant to be used? It seems to be used only temporarily, to create the hatching, then it is deleted, is that right?
DGH isn't deleted after the hatches are created. If the base face changes or the pattern parameters are changed then hatches have to be recreated and DGH hangs around in case the parent view needs new hatches.
Not completely relevant side note: DGH and it's Svg equivalent (DrawHatch) probably shouldn't be DocumentObjects at all, but extensions to DrawViewPart and descendants. DGH & DH are going to be subsumed into a more general FacePainter in a future interation of TD.
You're looking for something like this?
Code: Select all
myHatch = list() #list of ?TopoShapeEdgePy?
myHatch = hatchAFace(myFace, myPatFile, myPattern);
Re: Using TD to create hatches in the FreeCAD model
Yes, that would be exactly what I have in mind. I wonder if we can't keep the DGH object anyway, seems practical... And transforming a face to be flat before performing the algorithm doesn't seem a big problem...wandererfan wrote: ↑Thu Jan 23, 2020 4:05 pm myHatch = list() #list of ?TopoShapeEdgePy?
myHatch = hatchAFace(myFace, myPatFile, myPattern);
Re: Using TD to create hatches in the FreeCAD model
It would be nice to have a Hatch command, to add hatches as real geometry to i guess faces and cross-sections directly in the 3D view.
https://forum.freecadweb.org/viewtopic. ... 10#p144481
https://forum.freecadweb.org/viewtopic. ... 10#p144481
Re: Using TD to create hatches in the FreeCAD model
I made some progress and came up with this, but it still crashes when trying to use it, not sure yet why..
Seems the good direction to you @WF?
https://github.com/yorikvanhavre/FreeCA ... 9d05230bbb
Seems the good direction to you @WF?
https://github.com/yorikvanhavre/FreeCA ... 9d05230bbb