Modify multiple node positions in PyMAPDL

Options

Hi,
I need to modify multiple node positions for a particular model. For this currently, I'm using the command mapdl.n() (also tried mapdl.ngen()) in a loop. This works fine but takes a longer time appx. 70 seconds (since the number of nodes to be modified is large). Whereas when I perform the same task through corresponding commands directly in the APDL, it takes only 6-8 seconds. I don't understand why this time discrepancy arises. Also, is there any way to perform this task in an effective way?

P.S: I'm performing the task in a way similar to the following script:

PyMAPDL:
for id in range(1,10000):
mapdl.ngen(itime=2,inc=0,node1=id,node2=0,ninc=0,dx=0,dy=0,dz=0.001)

APDL Script:
*get,ndcnt,node,,count
/prep7
shpp,off
inode=0
*do,mod,1,ndcnt
inode=ndnext(inode)
adjust=0.001
ngen,2,0,inode,0,0,0,0,adjust
*enddo

Answers