TCL: how to translate coordinates from a system to another?
Answers
-
Hello again @Stéphane Combet,
Do you want to apply translation of a node selection along the axis of a user-defined system?
If so, *translatemark request a vector. You can retrieve the command to create this vector from command.tcl.
Then for getting the direction of the system, you may query for system attributes through hm_getvalue
The attributes for a given entity can be retrieved in online help (search for data name) or from Matrix Browser, see below an exemple (for materials) from 6:30:
https://youtu.be/OGRMJLunkrs?si=lW8srqNsmJUlRhBB
Does it help?
Michael
0 -
Michael Herve_21439 said:
Hello again @Stéphane Combet,
Do you want to apply translation of a node selection along the axis of a user-defined system?
If so, *translatemark request a vector. You can retrieve the command to create this vector from command.tcl.
Then for getting the direction of the system, you may query for system attributes through hm_getvalue
The attributes for a given entity can be retrieved in online help (search for data name) or from Matrix Browser, see below an exemple (for materials) from 6:30:
https://youtu.be/OGRMJLunkrs?si=lW8srqNsmJUlRhBB
Does it help?
Michael
Thank you Michael,
Not sure this helps. What I want is not to move the node. But a given node being placed at (0,0,0) in global coordinate system, if I have another rectangular system placed at (1,1,1) parallel to the global one, the coordinates of the very same node are (-1,-1,-1).
I wonder if there is a function to get those coordinates of a node in such another system (my case being obviously more complex with systems not parallel to global one).
If not, I will have to code myself the formulas. Feasable, but so boring...
0 -
Stéphane Combet said:
Thank you Michael,
Not sure this helps. What I want is not to move the node. But a given node being placed at (0,0,0) in global coordinate system, if I have another rectangular system placed at (1,1,1) parallel to the global one, the coordinates of the very same node are (-1,-1,-1).
I wonder if there is a function to get those coordinates of a node in such another system (my case being obviously more complex with systems not parallel to global one).
If not, I will have to code myself the formulas. Feasable, but so boring...
Hello again @Stéphane Combet ,
if you want node coordinates in a user defined system, first you need this user system to be assigned to your nodes. This way, you can use the following command:
set localX [hm_getvalue node id=$NodeId dataname=localx]
set localY [hm_getvalue node id=$NodeId dataname=localy]
set localZ [hm_getvalue node id=$NodeId dataname=localz]
Is it what you are looking for?
Best Regards,
Michael Herve
1 -
Michael Herve_21439 said:
Hello again @Stéphane Combet ,
if you want node coordinates in a user defined system, first you need this user system to be assigned to your nodes. This way, you can use the following command:
set localX [hm_getvalue node id=$NodeId dataname=localx]
set localY [hm_getvalue node id=$NodeId dataname=localy]
set localZ [hm_getvalue node id=$NodeId dataname=localz]
Is it what you are looking for?
Best Regards,
Michael Herve
Thank you! Ok so I could:
- assign the user defined system to the node
- use the command you gave me to obtain coordinates in user defined system
- re-assign previous system to the node
I will look for a command to assign a system to a node.
0 -
Stéphane Combet said:
Thank you! Ok so I could:
- assign the user defined system to the node
- use the command you gave me to obtain coordinates in user defined system
- re-assign previous system to the node
I will look for a command to assign a system to a node.
Hello @Stéphane Combet ,
your process is correct.
You should be able to use these commands:
*createmark nodes 1 selection_method
*systemsetanalysis nodes 1 $systemid
Then to reset you can use:
*createmark nodes 1 selection_method
*systemsetanalysis nodes 1 0
Regarding the attributes to query for local coordinates, I need to apologize, here are the correct syntax (I just tested it back this morning):
set localX [hm_getvalue node id=$NodeId dataname=x]
set localY [hm_getvalue node id=$NodeId dataname=y]
set localZ [hm_getvalue node id=$NodeId dataname=z]
or
set LocalCoords [hm_getvalue node id=$NodeId dataname=localcoordinates]
In this second case you get a list with x y and z coordinates.
Best Regards,
Michael
0