Question about a feqture in STKO
-
youngkyu
- Posts: 52
- Joined: Tue May 04, 2021 3:36 pm
- Location: 2559, Gyeongsang-daero, Sangju-si, Gyeongsangbuk-do, Korea
Question about a feqture in STKO
Dear support team members,
I wonder if SKTO has a feature to identify node ID and Element ID as attached figure below.
This figure shows the feature available from another finite element software.
I looked at the SKTO manual, however, I could not find that information.
The reason why I need this feature is that
I want to only make the output files at specific locations of my interest when using custom recorder
such as
"eval "recorder Element -file Gstress.out -time -ele 20 35 stress 3"
"eval "recorder Node -file acceleration.out -time -node 6 3 4 -dof 1 accel"
Best,
Youngkyu
I wonder if SKTO has a feature to identify node ID and Element ID as attached figure below.
This figure shows the feature available from another finite element software.
I looked at the SKTO manual, however, I could not find that information.
The reason why I need this feature is that
I want to only make the output files at specific locations of my interest when using custom recorder
such as
"eval "recorder Element -file Gstress.out -time -ele 20 35 stress 3"
"eval "recorder Node -file acceleration.out -time -node 6 3 4 -dof 1 accel"
Best,
Youngkyu
- Attachments
-
- Question_Youngkyu.JPG (77.86 KiB) Viewed 4920 times
-
marafini.f
- Posts: 363
- Joined: Fri Nov 13, 2020 1:52 pm
Re: Question about a feqture in STKO
Dear youngkyu,
I wish there was, it has been on my wish list since I started here in Asdea 6 months ago. We will develop something similar soon, and will keep you posted.
What you can do for now is use a combination of hide/show and display label commands from the quick toolbar. If you isolate the elements you want to ID then you can display the labels only on them. I know it's not a solution to your problem.
Be sure I'll advocate for this tool to come out soon
Enjoy your modeling
Francesca =)
I wish there was, it has been on my wish list since I started here in Asdea 6 months ago. We will develop something similar soon, and will keep you posted.
What you can do for now is use a combination of hide/show and display label commands from the quick toolbar. If you isolate the elements you want to ID then you can display the labels only on them. I know it's not a solution to your problem.
Be sure I'll advocate for this tool to come out soon
Enjoy your modeling
Francesca =)
-
marafini.f
- Posts: 363
- Joined: Fri Nov 13, 2020 1:52 pm
Re: Question about a feqture in STKO
Given that we don't like problems to go unsolved. Dr. Petracca developed this super quick script you can use to find the node or element closer in reference to a given position. You can use this script in the Python interface of STKO, and change it, extend it at will. For example, you could decide to search in an area to obtain the id of a larger number of nodes.
Imagine you have this meshed geometry: This is what you see when you turn on the labels: You want to find the closes node or element to the red dot position, know to be 2000,2000,0: Import your script and run it: Here is the script:
You will obtain a print of this in the terminal:
Try to play with the script to obtain what you wanted and let us know if you need help.
Enjoy your modeling.
Francesca =)
Imagine you have this meshed geometry: This is what you see when you turn on the labels: You want to find the closes node or element to the red dot position, know to be 2000,2000,0: Import your script and run it: Here is the script:
Code: Select all
#Import the PyMpc package to interact with STKO
from PyMpc import *
#Call the open .scd document
doc = App.caeDocument()
#Call the mesh
mesh = doc.mesh
"""Function to find the nearest node given a specific position."""
def findNearestNode(pos):
'''
pos is a Math.vec3, a vector with 3 coordinates
'''
#define a minimum distant for your search
min_dist = 1.0e16
#initialize a variable to store your nearest element
nearest = None
#iterate over the nodes if they are positioned within the defined minimum distance
for _, node in mesh.nodes.items():
#position of the nodes
d = (pos - node.position).norm()
#condition to be within the min_dist
if d < min_dist:
min_dist = d
#save the node
nearest = node
#return the node and it's distance from the reference position
return (nearest, min_dist)
"""Function to find the nearest element given a specific position. The search is operated in reference to the element barycenter position.
You can specify if the element is of a specific topology, for example[attachment=0]4.png[/attachment] to exclude edges or faces from the search."""
def findNearestElement(pos, only_topology = None):
'''
pos is a Math.vec3, a vector with 3 coordinates
'''
#define a minimum distant for your search
min_dist = 1.0e16
#initialize a variable to store your nearest element
nearest = None
#iterate over the elements if they are positioned within the defined minimum distance
for _, elem in mesh.elements.items():
#if you did define the topology
if only_topology is not None:
#skip over the elements with topologies different from the one specified
if elem.topologyType() != only_topology:
continue
#position of the barycenter of the element
d = (pos - elem.computeCenter()).norm()
#condition to be within the min_dist
if d < min_dist:
min_dist = d
#save the element
nearest = elem
#return the node and it's distance from the reference position
return (nearest, min_dist)
#Let's search for the id and position of Node 3
N,D = findNearestNode(Math.vec3(2000,2000,0))
print('Node = ', N.id)
print('Distance = ', D)
#Let's search for the id and position of element 47
E,D = findNearestElement(Math.vec3(2000,2000,0), only_topology=MpcElementTopologyType.Face)
print('Element = ', E.id, E.geometryFamilyType(), E.topologyType())
print('Distance = ', D)
Code: Select all
Node = 3
Distance = 141.4213562373095
Element = 47 Triangle Face
Distance = 100.0
Node = 25
Distance = 141.4213562373095
Element = 47 Triangle Face
Distance = 100.0Enjoy your modeling.
Francesca =)
- Attachments
-
- findID.zip
- (974 Bytes) Downloaded 316 times
-
youngkyu
- Posts: 52
- Joined: Tue May 04, 2021 3:36 pm
- Location: 2559, Gyeongsang-daero, Sangju-si, Gyeongsangbuk-do, Korea
Re: Question about a feqture in STKO
Dear support members,
I really appreciate your quick response and solution.
That really helps my preference and I will actively use that.
Best,
Youngkyu
I really appreciate your quick response and solution.
That really helps my preference and I will actively use that.
Best,
Youngkyu
Re: Question about a feqture in STKO
Dear Youngkyu,
Glad we could help!
Enjoy your modelling.
Francesca =)
Glad we could help!
Enjoy your modelling.
Francesca =)
-
youngkyu
- Posts: 52
- Joined: Tue May 04, 2021 3:36 pm
- Location: 2559, Gyeongsang-daero, Sangju-si, Gyeongsangbuk-do, Korea
Re: Question about a feqture in STKO
Hello team member,
I forgot to ask a quick question.
I wonder how I can turn on the labels as you showed the figure above.
I also wanted to look up the numbers of all the nodes and elements like you displayed.
(all numbers corresponding to nodes and elements show up in the rectangular geometry)
Best,
Youngkyu
I forgot to ask a quick question.
I wonder how I can turn on the labels as you showed the figure above.
I also wanted to look up the numbers of all the nodes and elements like you displayed.
(all numbers corresponding to nodes and elements show up in the rectangular geometry)
Best,
Youngkyu
-
Clarabella
- Posts: 131
- Joined: Wed Jul 08, 2020 3:50 pm
Re: Question about a feqture in STKO
Here the explanation. Please check also the manual
Regards
Regards