## Plotting vertex coordinates

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules

HG001
Posts: 1
Joined: Sun Sep 07, 2014 9:41 am

### Plotting vertex coordinates

Greetings,

I am looking to plot coordinates on xyz axis.

Example:

*MESH_VERTEX 0 0.079435 0.000199 0.113130

I am looking to be able to manually input multiple coordinates as points and to view them together.

Can this be done in FreeCAD?

jmaustpc
Posts: 9639
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

### Re: Plotting vertex coordinates

Hi
The simple answer is yes, but you would need to explain a bit more about what exactly you want to do and achieve for an accurate answer.

points/vertices can be places in Draft wb, Part work bench, Sketcher and Points wb. Each have their differences. they can also be inserted/generated via Python scripting and/or via Spreadsheet WB
HG001 wrote:MESH_VERTEX

This makes me wonder if you are wanting to work with meshes.
HG001 wrote:input multiple coordinates as points and to view them together.

here I wonder if you are wanting a points cloud? This is one entity in the tree view containing a number of vertices.

However you can create a Group and hold normal vertices in there.

Jim
JMG
Posts: 278
Joined: Wed Dec 25, 2013 9:32 am
Location: Spain
Contact:

### Re: Plotting vertex coordinates

Hi.

If you just want to place points on the 3d space, and you have a list of points like:
Points = ((x,y,z), (x1,y1,z1), ... , (xn,yn,zn))

Paste the points list on the python-command line and then this:

Code: Select all

``````import Part
for i in Points:
p = Part.Vertex(i)
Part.show(p)
``````
I'm sure that there is a more efficient way of doing it, but this one just works to me.

Javier.
FreeCAD scripts, animations, experiments and more: http://linuxforanengineer.blogspot.com.es/
Open source CNC hot wire cutter project (NiCr): https://github.com/JMG1/NiCr
Exploded Assembly Workbench: https://github.com/JMG1/ExplodedAssembly
Posts: 90
Joined: Fri Mar 06, 2015 10:02 pm
Contact:

### Re: Plotting vertex coordinates

You could also use draft workbench:

Code: Select all

``````
App.newDocument("new")

Gui.activateWorkbench("DraftWorkbench")
import Draft

for vertexNum, vertex in enumerate(vertices):
p=Draft.makePoint(vertex[0],vertex[1],vertex[2])
p.Label=str(vertexNum)

``````
DeepSOIC
Posts: 7600
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

### Re: Plotting vertex coordinates

Just in case the above answers wasn't enough... here's one more, done with Lattice2 add-on.
lattice-manual-arrays.xlsx
lattice-manual-arrays.FCStd
lattice-manual-arrays.png (130.17 KiB) Viewed 1046 times
Workflow is like that:
1. make an excel worksheet, with columns x,y,z.
2. Open attached project. Copy-paste columns, one by one, into corresponding LinearArray's Values property. Recompute.
One gotcha, you need to clean up empty line at the end of Values list, an empty value makes linear array to error. I should fix that...

You can also set up the arrays to suck values from a FreeCAD spreadsheet. But FreeCAD's spreadsheet workbench is seriously lacking compared to, say, MS Excel.
TheMarkster
Posts: 1400
Joined: Thu Apr 05, 2018 1:53 am

### Re: Plotting vertex coordinates

DeepSOIC wrote:
Wed Aug 22, 2018 4:29 pm
Just in case the above answers wasn't enough... here's one more, done with Lattice2 add-on.

...

Workflow is like that:
1. make an excel worksheet, with columns x,y,z.
2. Open attached project. Copy-paste columns, one by one, into corresponding LinearArray's Values property. Recompute.
One gotcha, you need to clean up empty line at the end of Values list, an empty value makes linear array to error. I should fix that...
Have you tested lattice2 with python3 and/or qt5 yet?

I loaded your file in 0.17 and it appears to work fine, but in 0.18 with python3 and qt5 I get errors. I lose the navigation cube, the cube appears to be in wireframe mode, and zooming in and out fails. This appears in the log file:
Err: Unhandled unknown exception caught in GUIApplication::notify.
Log: The event type 12 was sent to QOpenGLWidget
Object tree:
QOpenGLWidget is child of
SIM::Coin3D::Quarter::QuarterWidget is child of
QStackedWidget is child of
Gui::View3DInventor is child of
QMdiSubWindow is child of
QWidget is child of
QMdiArea is child of
Gui::MainWindowErr: Unhandled unknown exception caught in GUIApplication::notify.
I don't know if it's related to python3, qt5, openGL, or something else. I haven't noticed any similar issues on this build before this.
lattice2-err.png (70.96 KiB) Viewed 1021 times
lattice2-err-webm.webm
Works okay with this one:

Code: Select all

``````OS: Windows 10
Word size of OS: 64-bit
Version: 0.17.13522 (Git)
Build type: Release
Hash: 3bb5ff4e70c0c526f2d9dd69b1004155b2f527f2
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedStates (en_US)``````
Not okay with this:

Code: Select all

``````OS: Windows 10
Word size of OS: 64-bit
Version: 0.18.14374 (Git)
Build type: Release
Branch: master
Hash: 55fb5083468ea8be0a6853d84d7458f1555cfd1c
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)``````
If I start with a new document, create a linear array, change its values source property to values property, then paste info from one of the columns into it, I get this error:

Code: Select all

``````Err: Traceback (most recent call last):
File "<string>", line 1, in <module>
<class 'NameError'>: name 'unicode' is not defined
Err: Stack Trace: Traceback (most recent call last):
File "<string>", line 1, in <module>``````
which I suspect to be python3 related. The values appear in the properties at first, but then if I click on another property, the values property reverts back to what it was before. These could be 2 separate issues (probably, I think) or maybe this failure is causing the other.
DeepSOIC
Posts: 7600
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

### Re: Plotting vertex coordinates

TheMarkster wrote:
Wed Aug 22, 2018 10:38 pm
Have you tested lattice2 with python3 and/or qt5 yet?
Actually yes, Py3+Qt5 from conda, but only basic stuff... Thanks for pointers, I will look into it.

EDIT: https://github.com/DeepSOIC/Lattice2/issues/21
DeepSOIC
Posts: 7600
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

### Re: Plotting vertex coordinates

TheMarkster wrote:
Wed Aug 22, 2018 10:38 pm
If I start with a new document, create a linear array, change its values source property to values property, then paste info from one of the columns into it, I get this error:

Code: Select allErr: Traceback (most recent call last):
File "<string>", line 1, in <module>
<class 'NameError'>: name 'unicode' is not defined
Err: Stack Trace: Traceback (most recent call last):
File "<string>", line 1, in <module>

which I suspect to be python3 related. The values appear in the properties at first, but then if I click on another property, the values property reverts back to what it was before. These could be 2 separate issues (probably, I think) or maybe this failure is causing the other.
I have just tested it, I can reproduce. The problem is not with Lattice, unfortunately. It is FreeCAD property editor, which feeds this into python interpreter when I click OK:

Code: Select all

``FreeCAD.getDocument("lattice_manual_arrays").getObject("LinearArray").Values = [unicode('0', 'utf-8'),unicode('0.294610229', 'utf-8'),....]``
… which is obviously not python-3 compatible.

As for loading my example in Py3-Qt5 Freecad, it works for me, no graphics problems and no error messages (apart from Part-o-magic failing to run, it isn't Py3 compatible yet).

OS: Windows 10
Word size of OS: 64-bit
Version: 0.18.Unknown
Build type: Release
Python version: 3.6.5
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: Russian/Russia (ru_RU)

UPDATE: to fix, paste this to console:

Code: Select all

``````def unicode(arg, enc= 'ascii'):
try:
return __builtins__.unicode(arg, enc)
except Exception as err:
return str(arg)

``````
TheMarkster
Posts: 1400
Joined: Thu Apr 05, 2018 1:53 am

### Re: Plotting vertex coordinates

DeepSOIC wrote:
Thu Aug 23, 2018 1:07 pm
… which is obviously not python-3 compatible.

As for loading my example in Py3-Qt5 Freecad, it works for me, no graphics problems and no error messages (apart from Part-o-magic failing to run, it isn't Py3 compatible yet).
Ah, must be the things are unrelated then. Probably a graphics driver issue on my end.

Looks like more work needs to be done getting App::PropertyStringList ready for python 3. PropertyFloatList works, but I don't know how much trouble it would be for you to use that instead, and obviously that still wouldn't solve the broader issue.

Edit: I submitted to the bug tracker: issue #3569
DeepSOIC
Posts: 7600
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

### Re: Plotting vertex coordinates

TheMarkster wrote:
Thu Aug 23, 2018 8:30 pm
Looks like more work needs to be done getting App::PropertyStringList ready for python 3. ...

Edit: I submitted to the bug tracker: issue #3569
I have already reported it here on forum, and wmayer fixed it super quick!