Part.Line has no StartPoint and no EndPoint in 0.17

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Part.Line has no StartPoint and no EndPoint in 0.17

Post by wmayer »

In the past Part.Line was handled as a line segment which had a start and end point. This however was inconsistent to other geometry types and thus Part.LineSegment has been introduced and Part.Line is considered as an infinite line from then on.

The Curve attribute of an edge always returns the actual (untrimmed) geometry -- in your case the infinite line.
There are two ways to get the both end points of the edge:

Code: Select all

box.Edge1.firstVertex().Point
box.Edge1.lastVertex().Point
or

Code: Select all

segm=box.Edge1.Curve.trim(*box.Edge1.ParameterRange)
segm.StartPoint
segm.EndPoint
There is one point you have to take care of:
If an edge has reversed orientation then the edge's start and end points are swapped compared to the underlying geometry. So, in case it's important to consider the orientation of the edge you must pass True to the functions firstVertex/lastVertex.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Part.Line has no StartPoint and no EndPoint in 0.17

Post by bernd »

thanks werner for the explanation in the regard of line, line segment and curve.
carlopav wrote: Wed Jun 12, 2019 2:07 pm Draft module DraftGeomUtils.py have a fillet function, but I've never played with it...
seams to do the trick :)

Code: Select all

import Part, DraftGeomUtils
box = Part.makeBox(10,10,10)
l1 = box.Edges[0]
l2 = box.Edges[1]
radius = 5
edges = DraftGeomUtils.fillet([l1, l2], 5)
Part.show(l1)
Part.show(l2)
for e in edges:
    Part.show(e)

Screenshot_20190612_182124.png
Screenshot_20190612_182124.png (10.26 KiB) Viewed 680 times
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Part.Line has no StartPoint and no EndPoint in 0.17

Post by bernd »

carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Part.Line has no StartPoint and no EndPoint in 0.17

Post by carlopav »

Cool, so it seems there's the material for a new Draft command too! :D
follow my experiments on BIM modelling for architecture design
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Part.Line has no StartPoint and no EndPoint in 0.17

Post by bernd »

carlopav wrote: Wed Jun 12, 2019 5:00 pm Cool, so it seems there's the material for a new Draft command too! :D
yeah!
Post Reply