Okay, fixed in my PathArea branch. It is a silly bug. The orientation may take a while. It is much more complex.realthunder wrote:Not likely. Most likely due to the new patterns added. I'll look into that shortly.sliptonic wrote:Does this have anything to do with why the ZigZag pattern stopped working? I can get pocket paths out of offset but not zigzag.
Path.Area: Welcome, to the new era!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: Path.Area: Welcome, to the new era!
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: Path.Area: Welcome, to the new era!
I've submit a new fix. Please test the projection as well as the path orientation setting. Now orientation can only be 0=Normal, 1=Reversed, as I mentioned in my previous post.sliptonic wrote:Working more with Projection and sections I hit some weirdness.
I have also renamed the original 'clearance' parameter in fromShapes to 'resume_height' to avoid confusion. Resume height is the relative Z height above the next Z layer height when return from retraction. This can usually be set to step down value. However, Path.fromShapes does not have knowledge of step down, hence you need to manually specify this parameter here. This shall solve your retraction problem.
- sliptonic
- Veteran
- Posts: 3460
- Joined: Tue Oct 25, 2011 10:46 pm
- Location: Columbia, Missouri
- Contact:
Re: Path.Area: Welcome, to the new era!
Results from projects and orientation are looking very good now. No issues to report.
I'm trying to use the projection mode more consistently but there's something that TechDraw does that I can't figure out how to do with Path.Area:
With TechDraw, I can select several faces, make a compound, and then get the shapeoutline of the compound. But with Path.Area, I can't seem to section a single face parallel to the XY plane. I just get an empty projection. Is this possible?
I'm trying to use the projection mode more consistently but there's something that TechDraw does that I can't figure out how to do with Path.Area:
With TechDraw, I can select several faces, make a compound, and then get the shapeoutline of the compound. But with Path.Area, I can't seem to section a single face parallel to the XY plane. I just get an empty projection. Is this possible?
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: Path.Area: Welcome, to the new era!
If all the faces are in the same plane, then no need for the expensive projection operation. Just union the face and then remove all inner wires will do. I've added a new parameter called 'Outline'. Set it to true to get what you want.sliptonic wrote:Results from projects and orientation are looking very good now. No issues to report.
I'm trying to use the projection mode more consistently but there's something that TechDraw does that I can't figure out how to do with Path.Area:
With TechDraw, I can select several faces, make a compound, and then get the shapeoutline of the compound. But with Path.Area, I can't seem to section a single face parallel to the XY plane. I just get an empty projection. Is this possible?
Code: Select all
# union all faces, and then remove all inner wires
area = Path.Area(Outline=true).add([face1, face2, face3])
Part.show(area.getShape())
The difference between 'Outline' and 'Project' is that 'Outline' deals with 2D faces only, while 'Project' deals with 3D solid. If the faces are at different plane, then you have to either manually move the faces to the same plane or manually create compound and do section with projection.
- sliptonic
- Veteran
- Posts: 3460
- Joined: Tue Oct 25, 2011 10:46 pm
- Location: Columbia, Missouri
- Contact:
Re: Path.Area: Welcome, to the new era!
Nice! I'll try it. In my example, the faces were on different planes. I did exactly what you described but always got an empty list when sectioning the compound. I'll try again and attach a sample file if I get the same results.realthunder wrote: The difference between 'Outline' and 'Project' is that 'Outline' deals with 2D faces only, while 'Project' deals with 3D solid. If the faces are at different plane, then you have to either manually move the faces to the same plane or manually create compound and do section with projection.
- sliptonic
- Veteran
- Posts: 3460
- Joined: Tue Oct 25, 2011 10:46 pm
- Location: Columbia, Missouri
- Contact:
Re: Path.Area: Welcome, to the new era!
My problem with empty section is fixed - I was missing the coplanar check.
Results from outline project using a compound of faces are still showing a bug though.
I'm attaching a file, projectionbug.fcstd.
Cut002 is the original shape.
I selected Face13 and Face14 and ran this test macro:
shapeprojection is the overall silhouette of the whole object. It's perfect.
faceprojection is the projection of a compound from the two faces. You'll see the intersection lines don't meet correctly.
faceprojectionOutline is the projection with Outline=True. The problem is reduced but still present.
Results from outline project using a compound of faces are still showing a bug though.
I'm attaching a file, projectionbug.fcstd.
Cut002 is the original shape.
I selected Face13 and Face14 and ran this test macro:
Code: Select all
import Path
import PathScripts.PathUtils as PU
sel = Gui.Selection.getSelectionEx()[0]
obj = sel.Object
profileparams = {'Fill': 1, 'Coplanar' : 0}
c = Part.makeCompound(sel.SubObjects)
r = Path.Area(Project=True).add(c)
r.setPlane(Part.makeCircle(10))
r.setParams(**profileparams)
#env = PU.getEnvelope(c, 10)
#Part.show(r.getShape(-1, True))
sec = r.makeSections(heights=[0.0], project=True)
if len(sec) == 0:
print ('no section')
Part.show(r.getShape(-1, True))
else:
print ('section')
sec[0].getShape(-1, rebuild=True)
area = Path.Area(Fill=1, Coplanar=0).add(obj.Shape)
area.setPlane(Part.makeCircle(10))
Part.show(area.makeSections(heights=[1.0], project=True)[0].getShape(rebuild=True))
faceprojection is the projection of a compound from the two faces. You'll see the intersection lines don't meet correctly.
faceprojectionOutline is the projection with Outline=True. The problem is reduced but still present.
- Attachments
-
- projectionbug.fcstd
- (101.69 KiB) Downloaded 34 times
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: Path.Area: Welcome, to the new era!
I was not clear in my previous post. When I said make a compound, I actually mean to make a compound of face and then extrude a solid. Because makeSection is supposed to only work with solid. I am surprised that you even get any result for face compound. And you have just stumbled upon an unexpected usage of Path.Area.sliptonic wrote:Results from outline project using a compound of faces are still showing a bug though.
Here is what actually happened. Section won't work when there is no solid. So Area just do normal operation on all faces. When you set Coplanar=0, it will not check face plane, and simply convert face wires to 2D by ignore the Z value. That is actually some kind of projection! So, you don't need to call makeSections at all in this use case. The artifacts you see is due to those faces having some near coincident edges. If you enlarge the shape produced, you'll see the artifacts are actually small holes. So, by adding Outline=True, you can remove those holes. After setting Outline=True So in summary. Here is what you can do to get face outlines
Code: Select all
outline = Path.Area(Coplanar=0, Outline=True).add([face1, face2, face3]).getShape()
- sliptonic
- Veteran
- Posts: 3460
- Joined: Tue Oct 25, 2011 10:46 pm
- Location: Columbia, Missouri
- Contact:
Re: Path.Area: Welcome, to the new era!
O.k. Makes sense but those tiny cuts in the second screenshot are still a problem for me. For instance in a path that isn't offset (for example a laser cutting 'on the line' the beam will be spending more time than it should in that corner delivering too much heat. I don't get those cuts in the TechDraw method. Is that a tolerance thing?realthunder wrote:
So in summary. Here is what you can do to get face outlinesCode: Select all
outline = Path.Area(Coplanar=0, Outline=True).add([face1, face2, face3]).getShape()
Cool. I started adding the rebuild=True when I was seeing the projection orientation weirdness. I won't use it in my production code.One more thing, I see lots of getShape(rebuild=True) and getShape(-1, rebuild=True). You normally don't need to do that. Simple getShape() will do in most cases. And only use getShape(index) to get individual section if you doing section with SectionCount parameter in Path.Area instead of calling makeSections, You almost never need to set rebuild=True, I added that for debugging purpose. You'll be wasting time to rebuild in most cases.
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: Path.Area: Welcome, to the new era!
If you align those two faces together, you can see the gap. In this cases, you either need to fix the model itself, or you can use the trick to do a slight expansion offset, and then a second shrink offset to remove those gaps.sliptonic wrote:O.k. Makes sense but those tiny cuts in the second screenshot are still a problem for me. For instance in a path that isn't offset (for example a laser cutting 'on the line' the beam will be spending more time than it should in that corner delivering too much heat. I don't get those cuts in the TechDraw method. Is that a tolerance thing?
But, I am curious how TechDraw handles it. Could you please post your TechDraw code?
- sliptonic
- Veteran
- Posts: 3460
- Joined: Tue Oct 25, 2011 10:46 pm
- Location: Columbia, Missouri
- Contact:
Re: Path.Area: Welcome, to the new era!
Huh. That's weird. It's not in the model which is just made from stacked and cut cylinders. The gap occurs with the selected faces compounded together. Must be an OCC/tolerance/rounding thing.realthunder wrote:If you align those two faces together, you can see the gap.
In this cases, you either need to fix the model itself, or you can use the trick to do a slight expansion offset, and then a second shrink offset to remove those gaps.
But, I am curious how TechDraw handles it. Could you please post your TechDraw code?
Here's how I call the TechDraw function to generate the perimeter wire from the selected faces.
Code: Select all
sel = Gui.Selection.getSelectionEx()[0]
Part.show(TechDraw.findShapeOutline(Part.makeCompound(sel.SubObjects), 1, FreeCAD.Vector(0,0,1)))