Page 1 of 1

How to access the contents of an Edge object

Posted: Wed May 17, 2017 9:57 pm
by DrBwts
With a Vertexes object I see its contents if I type

Code: Select all

myObject.Vertexes[0].Point
for instance.

What is a similar method for access the information stored in the Edge object?

I've searched though the TopoShape API but with no success.

Re: How to access the contents of an Edge object

Posted: Thu May 18, 2017 5:58 am
by damian
for instance, in FreeCAD 0.17 (daily)

Code: Select all

>>> lineSegment = Part.LineSegment()
>>> edge = lineSegment.toShape()
>>> edge.Curve
<Line object>
>>> edge.FirstParameter
0.0
>>> edge.LastParameter
1.0
>>> edge.Length
1.0
>>> edge.Orientation
'Forward'
>>> edge.ParameterRange
(0.0, 1.0)
>>> edge.firstVertex().Point
Vector (0.0, 0.0, 0.0)
>>> edge.lastVertex().Point
Vector (0.0, 0.0, 1.0)
I think to remember that this query was a little bit more difficult with FreeCAD 0.16

Re: How to access the contents of an Edge object

Posted: Thu May 18, 2017 11:10 am
by DrBwts
I'm using 0.16 and there is no firstVertex().Point attribute. Is there another way collecting the start end data of an Edge in a Part?

Also is there a full list of attributes & methods somewhere or this still an on going documentation thing?

Re: How to access the contents of an Edge object

Posted: Thu May 18, 2017 11:27 am
by damian
DrBwts wrote:I'm using 0.16

Code: Select all

>>> line=Part.Line()
>>> edge=line.toShape()
>>> edge.FirstParameter
0.0
>>> edge.valueAt(edge.FirstParameter)
Vector (0.0, 0.0, 0.0)
>>> edge.LastParameter
1.0
>>> edge.valueAt(edge.LastParameter)
Vector (0.0, 0.0, 1.0)
OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6710 (Git)
Build type: None
Branch: releases/FreeCAD-0-16
Hash: f8eca0f9311f07c125dd6742a607724c1fa0b77c
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
DrBwts wrote:a full list of attributes & methods
I use the python console
python_console.png
python_console.png (185.86 KiB) Viewed 1807 times

Re: How to access the contents of an Edge object

Posted: Thu May 18, 2017 12:15 pm
by DrBwts
Thanks that's exactly what I was after.