×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Writting out info. from a Component to an Array

Writting out info. from a Component to an Array

Writting out info. from a Component to an Array

(OP)
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

RE: Writting out info. from a Component to an Array

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

RE: Writting out info. from a Component to an Array

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

RE: Writting out info. from a Component to an Array

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

cheers
anne

RE: Writting out info. from a Component to an Array

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources