Page 1 of 1

User defined scheme to select nodes in a node list

PostPosted: Thu Sep 01, 2016 6:25 pm
by rwendner
I would like to create a UD subroutine for selecting nodes following a certain pattern.

Can you please provide the CylindricalSelection as a template / upload a UD version to gitlab?

Re: Selection UD

PostPosted: Fri Sep 02, 2016 8:08 pm
by zhouxinwei
Attached is an example: a bar of 500 mm long, the user defined subroutine is used to select half of its nodes by a threshold z coordinate (250 mm).

CylindricalSelection will be uploaded to GitLab.

Re: Selection UD

PostPosted: Fri Sep 23, 2016 12:59 pm
by rwendner
Can you please also provide the source code for how you can reach the coordinates of a node of a certain list, i.e. the underlying code for

Node `ListName' cl 5 cm 0. cm 8 cm.
Node `ListName' `nodeIndex'

Thank you

Re: Selection UD

PostPosted: Wed Feb 01, 2017 11:46 pm
by zhouxinwei
A new feature (user defined command) is implemented in version 2017.02.11.

A full example is attached, below is a demonstration of the input.
Code: Select all
UserDefinedObject UD NodeSelectionUD {
  cz 249 mm
}
TetSolidList ttL Geometry {
  ReadFile Prism.mrs
  EditNodeList {
    ExecUserDefinedCommand UD
  }
}


More information can be found in the manual (search user defined command).

Re: Selection UD

PostPosted: Wed Feb 01, 2017 11:54 pm
by zhouxinwei
rwendner wrote:Can you please also provide the source code for how you can reach the coordinates of a node of a certain list, i.e. the underlying code for

Node `ListName' cl 5 cm 0. cm 8 cm.
Node `ListName' `nodeIndex'

Thank you


The code to achieve above feature can be done in this way:
Code: Select all
Node *pt = new Node(c0x, c0y, c0z); // node of reference
real dmn = M_BIG, dst;
Node *nm = NULL; // pointer to closest node
for (int i=0; i<num; i++) { // loop over all nodes in a node list
    dst = pt->calcDist(nd[i]);
    if (dst < dmn) {
        dmn = dst;
        nm = nd[i];
    }
}