Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writting out info. from a Component to an Array

Status
Not open for further replies.

bluesyd

Mechanical
Aug 13, 2004
6
Hi all,

Is there anyway to write out data from a component into arrays? For example, I've grouped the nodes along the edge of a plate model into a component named BC1 using the following command:

NSEL,S,LOC,Y,0
CM,BC1,Node

I would then like to create a new set of nodes that coincide with the ones in BC1 so that in turn, I can create elements whose properties are defined using COMBIN14. I would like the process to be automated, but in the program, the IDs of the nodes contained in BC1 won't be known until the mesh was generated for the plate model. While the grouping doesn't require the knowledge of the IDs of these nodes to be known (i.e I just specified a general location, y=0), the new nodes created on top of the original ones will need to be known before Spring elements can be correctly created by connecting two nodes at the same location.

So I need to find a way to extract the IDs of these nodes contained in BC1 and store them in an array. Any ideas?

Thanks,

anne
 
Replies continue below

Recommended for you

Hi,

I think you can use this code:

Code:
! Select the nodes
nsel,s,node,,BC1
! get number of selected nodes
*get,ncount,node,,count
! define vector of node numbers
nodes=
*dim,nodes,array,ncount
! fill vector with node numbers
nd=ndnext(0)
*do,i,1,ncount
nodes(i,1)=nd
nd=ndnext(nd)
*enddo

Regards,
Alex
 
Hi,
in addition to the code provided by Mihailup:
if you pre-define the COMBIN14 with the keyoptions and real constants needed, then you can have ANSYS create the additional nodes and the elements inside the "DO/LOOP":
having to use NGEN, you have to determine the minimum node number offset in order not to overwrite existing node tags:

allsel
*GET,maxnum,NODE,0,NUM,MAX
cmsel,s,BC1
*GET,numnodes,NODE,0,COUNT
*GET,startnum,NODE,0,NUM,MIN
offsetnum=maxnum-startnum
xoffst=100
yoffst=100
zoffst=100
NGEN,2,offsetnum,currentnum,,,xoffst,yoffst,zoffst,1
cmsel,u,BC1
cm,BCfix,node
cm,a,BC1
currentnum=startnum
TYPE,<combin14_type>
REAL,<rc_number_for_combin14>
*DO,i,1,numnodes,1
E,currentnum,currentnum+offsetnum
currentnum=ndnext(currentnum)
*ENDDO
allsel

Hope this helps...

Regards
 
Thank you Alex, cbrn! This is all very helpful. I'm tryng them out right now:)

cheers
anne
 
Hi,
I made a mistake in a node-set reselection:
instead of:

cmsel,u,BC1
cm,BCfix,node
cm,a,BC1

you need to read:

cmsel,u,BC1
cm,BCfix,node
cmsel,a,BC1

You probably already noticed the error, sorry.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor