# Can I get the distance between two displaced nodes?

 Yes, use the UPCOORD command to update the coordinates to their displaced locations, then use a get function.The Macro shown here can be used to calculate the distance between the nodes before and after deformation.A *ASK command prompts the user to input the node number of the first and second nodes to be queried.The UPCOORD command modifies the coordinates of the nodes based on the current displacements.A get function is used to determine the distance between the nodes.The UPCOORD command is then used again to modify the coordinates of the nodes back to their undeformed position.It is recommended that the user save the database before performing this operation, then revert to the saveddatabase once the distance is determined.Another use for this technique is that a user might want to monitor the deformed distance while in solutionto make a decision whether to continue.!*************************************************************************!*** START OF MACRO/solu*ask,node1,Enter node number of first node,1 !Prompts user to input node1*ask,node2,Enter node number of second node,2 !Prompts user to input node2distance_before=distnd(node1,node2) !Use get function disnd() to get the distance between two nodesupcoord,1 !Modifies the coordinates based on the current displacementsdistance_after=distnd(node1,node2) !Again using get function get deformed distanceupcoord,-1 !Modifies the coordinates back to the undeformed position/out,myout,out !Redirect output to a file and print parameters/com,*********************************************************************/com,Distance between node %node1% and node %node2% BEFORE defomation = %distance_before%/com,Distance between node %node1% and node %node2% AFTER defomation = %distance_after%/com,*********************************************************************/out*uilist,myout.out!*** END OF MACRO!*************************************************************************An example is also provided below, with the node1 and node2 parameters defined:/prep7 !Creating a simple modelmp,ex,1,30e6mp,nuxy,1,0.3et,1,plane42blc4,0,0,20,10amesh,allnsel,s,loc,x,0d,all,allallsnode1=node(20,10,0) !Assign parameter "node1" as the node number at (20,10,0)node2=node(20,0,0) !Assign parameter "node2" as the node number at (20,0,0)distance_before=distnd(node1,node2) !Use get function distnd() to get the distance between two nodesd,node1,uy,1 !For demonstration, given displacements are used hered,node2,uy,-1/solusolveupcoord,1 !Modifies the coordinates based on the current displacementsdistance_after=distnd(node1,node2) !Again using get function get deformed distanceupcoord,-1 !Modifies the coordinates back to the undeformed position/out,myout,out !Redirect output to a file and print parameters/com,*********************************************************************/com,Distance between node %node1% and node %node2% BEFORE defomation = %distance_before%/com,Distance between node %node1% and node %node2% AFTER defomation = %distance_after%/com,*********************************************************************/out*uilist,myout.out