Showing the coordinates of points

Post Reply
BuuNguyen
Posts: 134
Joined: Fri Oct 29, 2021 3:28 am
Location: Paraguay
Contact:

Showing the coordinates of points

Post by BuuNguyen » Thu Dec 16, 2021 7:44 am

Dear STKO team,

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

Thanks

STKO Team
Posts: 3066
Joined: Tue Oct 29, 2019 8:45 am

Re: Showing the coordinates of points

Post by STKO Team » Thu Dec 16, 2021 2:10 pm

In pre or post processor?
ID of vertices (geometry) or nodes (mesh)?

marafini.f
Posts: 363
Joined: Fri Nov 13, 2020 1:52 pm

Re: Showing the coordinates of points

Post by marafini.f » Thu Dec 16, 2021 2:25 pm

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:

BuuNguyen
Posts: 134
Joined: Fri Oct 29, 2021 3:28 am
Location: Paraguay
Contact:

Re: Showing the coordinates of points

Post by BuuNguyen » Fri Dec 17, 2021 1:21 am

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.

HC2020
Posts: 48
Joined: Tue Aug 18, 2020 8:25 am

Re: Showing the coordinates of points

Post by HC2020 » Mon Dec 20, 2021 11:25 am

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:

Post Reply