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!

Loop over component members 2

Status
Not open for further replies.

andreamordini

Structural
Jun 2, 2006
34
Hallo everybody,
Is it possible to perform a loop over the nodes or the elements of a selected component?

Thanks,

andrea

-------------------------------------------
Andrea Mordini, Civil Engineer, Ph.D.
-------------------------------------------
 
Replies continue below

Recommended for you

Absolutely. Just make sure those nodes are not part of the selected component or set when looping through your *do loop. You may have to define a special component for this particular operation.

-Brian
 
Hi,

Of course it is possible. I'm not sure if I understand wright what you mean but I'll give it a try:

Code:
nd=ndnext(0)
*dowhile,nd
 ! do something
 nd=ndnext(nd)
*enddo

Regards,
Alex
 
I am sorry, I did not get it. I have one component and I want to loop over its nodes. How can I do it?

andrea

-------------------------------------------
Andrea Mordini, Civil Engineer, Ph.D.
-------------------------------------------
 
Okay I misunderstood you initial question. Here is another snippit of code that is a little more indepth to help emphasize the point Alex is trying to make.

asel,,,,temp1
nsla,,1
*get,_nnode,node,,count
*get,_nmin,node,,num,min

*do,ii,1,_nnode
nsel,,,,_nmin
asel,,,,temp2
nsla,,1
_nslave=nnear(_nmin)
nsel,none
nsel,,,,_nmin
nsel,a,,,_nslave
cp,next,all,all
asel,,,,temp1
nsla,,1
_nmin=ndnext(_nmin)
*enddo

_nnode=
_nmin=
_nslav=

This is a macro I use for coupling two adjacent regions by definining area components, temp1 and temp2.

-Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor