Page 1 of 1

Showing the coordinates of points

Posted: Thu Dec 16, 2021 7:44 am
by BuuNguyen
Dear STKO team,

can I show the coordiates of existing points? and how can I see them?

Thanks

Re: Showing the coordinates of points

Posted: Thu Dec 16, 2021 2:10 pm
by STKO Team
In pre or post processor?
ID of vertices (geometry) or nodes (mesh)?

Re: Showing the coordinates of points

Posted: Thu Dec 16, 2021 2:25 pm
by marafini.f
Hi BuuNguyen,

if you want to just see them, you can just hover on one of the points you can see its coordinates in the bottom left corner of the preprocessor.
If you want to extract them, you can use the python API. For example, you can use the following code to extract the coordinates of points in a specific selection set, in a specific direction.

Code: Select all

from PyMpc import *

doc = App.caeDocument()
doc.scene.unselectAll()


def printCoordVertInSS (sid,dir):
	#take the selection Set
	sset = doc.getSelectionSet(sid)
	#if there is no selection set with that ID, raise an exception
	if sset is None:
		raise Exception("Cannot find selection set {}".format(sid))
	#create an empty dictionary to save all the positions or the positions
	positions = {}
	dirpos = {}
	for geom_id, sset_item in sset.geometries.items():
		if sset_item.wholeGeometry:
			continue
		geom = doc.getGeometry(geom_id)
		if geom:
			for i in sset_item.vertices:
				positions[i] = geom.shape.vertexPosition(i)
				for _,pos in positions.items():
					dirpos[i] =pos[dir]
	return print(dirpos)

printCoordVertInSS(2,1)
Let me know if you need something else.
Enjoy your mdoeling
Francesca :geek:

Re: Showing the coordinates of points

Posted: Fri Dec 17, 2021 1:21 am
by BuuNguyen
thank you for your quick reply.
Do you have a link that gives information about PyMpc library?
As Numpy, mathplotlib have some websites to show syntaxes in their library.

Re: Showing the coordinates of points

Posted: Mon Dec 20, 2021 11:25 am
by HC2020
Dear BuuNguyen,

Here is a link to the PyMpc documentation Wiki: https://asdeasoft.net/stko-wiki/
It is still a work in progress but it contains helpful information. :) :geek: