How to access the contents of an Edge object

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
DrBwts
Posts: 101
Joined: Sun Oct 26, 2014 5:23 pm

How to access the contents of an Edge object

Post 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.
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: How to access the contents of an Edge object

Post 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
DrBwts
Posts: 101
Joined: Sun Oct 26, 2014 5:23 pm

Re: How to access the contents of an Edge object

Post 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?
damian
Posts: 583
Joined: Sun May 31, 2015 6:16 pm

Re: How to access the contents of an Edge object

Post 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 1796 times
DrBwts
Posts: 101
Joined: Sun Oct 26, 2014 5:23 pm

Re: How to access the contents of an Edge object

Post by DrBwts »

Thanks that's exactly what I was after.
Post Reply