XANSYS Message: 40968 [Go back to message list]
No rating yet
Rate item:

Subject: Re: CDWRIT,CM
Author: Juha Tyllinen
Date: 2002-08-21 08:34:00

Well,

Now that we are trying to speed things up, here is a fully vectorized
version where you can select the entity type you are saving. The saved
component (well, select status) is stored as file with 'cmp' extension and
includes two header lines: entity type and number of selected entities.
CMSave saves the status and CMResu resumes it from the file. Enjoy...

JKT

! Macro CMSave for ANSYS Rev. 6.1 by JKT

! This macro saves selection status

! Arg1 = 'FileName' (=component name)

! Arg2 = Entity type - 'kp'
! - 'line'
! - 'area'
! - 'volu'
! - 'node'
! - 'elem'

*IF,Arg2,eq,'node',then
Ar10=ndinqr(0,14) $Ar11=ndinqr(0,13)
*ELSEIF,Arg2,eq,'elem',then
Ar10=elmiqr(0,14) $Ar11=elmiqr(0,13)
*ELSEIF,Arg2,eq,'kp',then
Ar10=kpinqr(0,14) $Ar11=kpinqr(0,13)
*ELSEIF,Arg2,eq,'line',then
Ar10=lsinqr(0,14) $Ar11=lsinqr(0,13)
*ELSEIF,Arg2,eq,'area',then
Ar10=arinqr(0,14) $Ar11=arinqr(0,13)
*ELSEIF,Arg2,eq,'volu',then
Ar10=vlinqr(0,14) $Ar11=vlinqr(0,13)
*ENDIF

Ar12=strsub(Arg2,1,1)
Ar12=strcat(Ar12,'sel')

*DIM,Apu1_,array,Ar10 $*DIM,Apu2_,array,Ar10
*VGE,Apu1_(1),Arg2,1,Ar12 $*VFI,Apu2_(1),ramp,1,1
*VMA,Apu1_(1) $*VFU,Apu2_(1),comp,Apu2_(1)
Apu1_=
*DIM,Apu1_,array,Ar11 $*VFU,Apu1_(1),copy,Apu2_(1)

*CFO,Arg1,cmp
*VWR,Arg2
%C
*VWR,Ar11
%I
*VWR,Apu1_(1)
%10I
*CFC

Apu1_=
Apu2_=

/eof

! Macro CMResu for ANSYS Rev. 6.1 by JKT

! This macro resumes selection status saved by CMSave

! Arg1 = 'FileName' (=component name)

*DIM,Apu1_,string,4
*VRE,Apu1_(1),Arg1,cmp,,,1,,,0
(A4)

*DIM,Apu2_,array,1
*VRE,Apu2_(1),Arg1,cmp,,,1,,,1
(F10.0)

Arg2=Apu1_(1) $Apu1_=
Ar11=Apu2_(1) $Apu2_=

*IF,Arg2,eq,'node',then
Ar10=ndinqr(0,14)
*ELSEIF,Arg2,eq,'elem',then
Ar10=elmiqr(0,14)
*ELSEIF,Arg2,eq,'kp',then
Ar10=kpinqr(0,14)
*ELSEIF,Arg2,eq,'line',then
Ar10=lsinqr(0,14)
*ELSEIF,Arg2,eq,'area',then
Ar10=arinqr(0,14)
*ELSEIF,Arg2,eq,'volu',then
Ar10=vlinqr(0,14)
*ENDIF

Ar12=strsub(Arg2,1,1)
Ar12=strcat(Ar12,'sel')

*DIM,Apu2_,array,Ar11
*VRE,Apu2_(1),Arg1,cmp,,, ,,,2
(F10.0)

*DIM,Apu1_,array,Ar10
*VOP,Apu1_(1),1,scat,Apu2_(1)
%Ar12%,all ! This should not be necessary, but is!!!!
*VPU,Apu1_(1),Arg2,1,Ar12

Apu1_=
Apu2_=

/eof

> -----Original Message-----
> From: Joe Woodward [mailto:joe.woodward@p...]

> Mark, Dan, John,
> If you want to save time on large models, removing the *do
> loop makes a
> world of difference. I tried John's macro on 26746 nodes and
> it took ~30
> seconds. The vector command's below took 4 seconds. It also
> took only 6
> seconds to run on all 378372 nodes with a maximum node number
> of 892191.


Posts possibly associated with message #40968AuthorDateScore
40933CDWRIT,CMDan Bohlen2002/08/20 
40935Re: CDWRIT,CMSheldon Imaoka2002/08/200
40939Re: CDWRIT,CMDan Bohlen2002/08/20 
40942Re: CDWRIT,CMJohn Crawford2002/08/20 
40943Re: CDWRIT,CMDan Bohlen2002/08/20 
40944Re: CDWRIT,CMJohn Crawford2002/08/20 
40945Re: CDWRIT,CMJohn Swanson2002/08/20 
40948Re: CDWRIT,CMMark Hommel2002/08/20 
40949Re: CDWRIT,CMDan Bohlen2002/08/20 
40950Re: CDWRIT,CMJoe Woodward2002/08/20 
40951Re: CDWRIT,CMMark Hommel2002/08/20 
40968Re: CDWRIT,CMJuha Tyllinen2002/08/21 
40969Re: CDWRIT,CMJohn Crawford2002/08/21