Part.Line has no StartPoint and no EndPoint in 0.17

Need help, or want to share a macro? Post here!
wmayer
Site Admin
Posts: 14789
Joined: Thu Feb 19, 2009 10:32 am

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

Postby wmayer » Wed Jun 12, 2019 3:12 pm

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
Posts: 8336
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

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

Postby bernd » Wed Jun 12, 2019 4:21 pm

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 119 times
User avatar
bernd
Posts: 8336
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

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

Postby bernd » Wed Jun 12, 2019 4:47 pm

carlopav
Posts: 242
Joined: Mon Dec 31, 2018 1:49 pm

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

Postby carlopav » Wed Jun 12, 2019 5:00 pm

Cool, so it seems there's the material for a new Draft command too! :D
User avatar
bernd
Posts: 8336
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

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

Postby bernd » Wed Jun 12, 2019 6:24 pm

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!