User defined scheme to select nodes in a node list

Anything else

User defined scheme to select nodes in a node list

Postby rwendner » Thu Sep 01, 2016 6:25 pm

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?
rwendner
 
Posts: 154
Joined: Wed Jul 15, 2015 4:35 pm

Re: Selection UD

Postby zhouxinwei » Fri Sep 02, 2016 8:08 pm

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.
Attachments
Archive.zip
(16.15 KiB) Downloaded 969 times
zhouxinwei
 
Posts: 208
Joined: Thu Jul 09, 2015 7:12 pm

Re: Selection UD

Postby rwendner » Fri Sep 23, 2016 12:59 pm

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
rwendner
 
Posts: 154
Joined: Wed Jul 15, 2015 4:35 pm

Re: Selection UD

Postby zhouxinwei » Wed Feb 01, 2017 11:46 pm

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).
Attachments
Archive2.zip
Example showing how to use user defined command
(16.22 KiB) Downloaded 1001 times
zhouxinwei
 
Posts: 208
Joined: Thu Jul 09, 2015 7:12 pm

Re: Selection UD

Postby zhouxinwei » Wed Feb 01, 2017 11:54 pm

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];
    }
}
zhouxinwei
 
Posts: 208
Joined: Thu Jul 09, 2015 7:12 pm


Return to Other

Who is online

Users browsing this forum: No registered users and 0 guests

cron