Hi,
does anyone know are there any line clipping algorithms implemented in FreeCAD or in the connected libraries?
There are a few options, I need one for the outline path generation.
https://forum.freecadweb.org/viewtopic. ... 69#p549935
I want to clip every single path as soon as it leaves a defined area / stock (maybe plus/minus some offset)
https://en.wikipedia.org/wiki/Line_clipping
----
Problem solved, Zheng Lei directed me to Path.Area which already has an implementation for this.
just something like that:
Part.show(Path.Area().add([FreeCAD.ActiveDocument.Sketch002.Shape, FreeCAD.ActiveDocument.Sketch.Shape], op=2).getShape())
Line clipping algorithms
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Line clipping algorithms
line clipping is somewhat different, from Path.Area.
You could find the intersection of the lines and rearrange start and ending points (I intend it using scripting).
same for extend, there are also some OOCT methods that do such things.
Hope it helps
Carlo D.
You could find the intersection of the lines and rearrange start and ending points (I intend it using scripting).
same for extend, there are also some OOCT methods that do such things.
Code: Select all
from draftgeoutils.intersections import findIntersection
np_a = line1
np_a = line2
cc = findIntersection(np_a, np_b, True, True)
# this is a list of intersection points
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/