Help with code to export RVM file to the network

Hi all PML Gurus,

What I'm trying to achive is nothing new on PDMS/E3D world. What I want is to extract one RVM file during night using windows scheduler task running one E3D batch file.

I have done/copy/modify this code. Some parts aree from here on the forum others over the Internet:

-----------------------------------------------------------------------------------------------------------------------------------------------------------

-- Date Definition
!date = object DateTime()
!month = !date.Month()

VAR !clock CLOCK
VAR !clockdetail split('$!Clock')
VAR !clocktime replace(!clockdetail[4], ':','-')

!year = !clockdetail[3].string()
!monthnew = !month.string()
!day = !clockdetail[1].string()
!time = vtext(!clocktime)

!fileclock = !year + '-' + !monthnew + '-' + !day + '_' + !time

-- Get project ID
VAR !projID PROJ ID

DESIGN

MAP BUILD MDB
HANDLE (69,97)
ENDHANDLE

!!reviewpath = object FILE('\\MAINsvr1\PROJETS\CLIENT\0270\3D Revue\RVM\' + '$!projID' + '_' + '$!fileclock' + '.rvm')

WRITE ('Building RVM export list for project $!projID ...')

VAR !SITES COLLECT ALL SITE WITH MATCHWILD (NAME OF SITE, '*Zone5*' )

repre lev 6
repre lev pipe 6
repre lev nozz 6
repre lev struc 6
repre tube on
export repr on
export file/$!!reviewpath
export filenote ''
repre snode off
repre pnode off
repre pline pkey off
export encoding UTFEight
export holes on

export autocolour ALL WITH MATCHWI(NAME OF SITE, '*PIPE*') colour 3

DO !UNSITE VALUES !SITES
export $!UNSITE
ENDDO

export finish

FINISH

-----------------------------------------------------------------------------------------------------------------------------------------------------------

Runing this code with the path variable !!reviewpath set to the local computer !!reviewpath = object FILE('C:\TEMP\' + '$!projID' + '_' + '$!fileclock' + '.rvm'), the code works perfect.

The problem is when I try to write the RVM file to the server. I have try different path configuration, direct path to the server. I have Maped the server on windows explorer with a letter M:, but none of them work. If I test this paths on windows explorer and they work and send me to the specific folder. I have also read and write premissions to the folder.

!!reviewpath = object FILE('\\MAINsvr1\PROJETS\CLIENT\0270\3D Revue\RVM\' + '$!projID' + '_' + '$!fileclock' + '.rvm') - Using path with direct access to the server

!!reviewpath = object FILE('M:\MAINsvr1\PROJETS\CLIENT\0270\3D Revue\RVM\' + '$!projID' + '_' + '$!fileclock' + '.rvm') - Using path maped on windows with letter M:

When I run the code with this paths I get always this error:

The error states: "...name must begin with letter", but I think I have done that mapping the server with the letter M:.

I have also try different configurations but none of them have worked.

Any idea what I'm doing wrong?

Thanks for the help.

Regards,

ARamos

 

  • Have you tried getting rid of the Space on the Path, normally I extract the RVM on local PC ( path still have no space ) then copy the extracted file to the desired path after. And I exclude space on all my path involved in my Auto extraction.

    I also did the extraction on Local to prevent any issues in terms of Network interruption.

  • can you try mapping \\MAINsvr1\PROJETS\CLIENT\0270\3D Revue\ to M drive

  • How did you do your mapping of the drive to M?

    This is wrong

    \\MAINsvr1\PROJETS\CLIENT\0270\3D Revue..

    M:\MAINsvr1\PROJETS\CLIENT\0270\3D Revue...

    At least like this of you mappend MAINsvr1 to M:
    M:\PROJETS\CLIENT\0270\3D Revue...

  • -- Date Definition
    !date = object DateTime()
    !month = !date.Month()

    VAR !clock CLOCK
    VAR !clockdetail split('$!Clock')
    VAR !clocktime replace(!clockdetail[4], ':','-')

    !year = !clockdetail[3].string()
    !monthnew = !month.string()
    !day = !clockdetail[1].string()
    !time = vtext(!clocktime)

    !fileclock = !year + '-' + !monthnew + '-' + !day + '_' + !time

    -- Get project ID
    VAR !projID PROJ ID

    DESIGN

    MAP BUILD MDB
    HANDLE (69,97)
    ENDHANDLE


    -- !!!!!!!!!!! CHOOSE ONE OPTION !!!!!!!!!!!
    -- Try put in VAR:
    !Path = '\\MAINsvr1\PROJETS\CLIENT\0270\3D Revue\RVM\' + '$!projID' + '_' + '$!fileclock' + '.rvm'
    !!reviewpath = object FILE(!Path)

    -- Or you can just do it:
    !!reviewpath = object FILE('\\MAINsvr1\PROJETS\CLIENT\0270\3D Revue\RVM\$!projID$n_$!fileclock$n.rvm')


    WRITE ('Building RVM export list for project $!projID ...')

    VAR !SITES COLLECT ALL SITE WITH MATCHWILD (NAME OF SITE, '*Zone5*' )

    repre lev 6
    repre lev pipe 6
    repre lev nozz 6
    repre lev struc 6
    repre tube on
    export repr on
    export file "$!!reviewpath"
    export filenote ''
    repre snode off
    repre pnode off
    repre pline pkey off
    export encoding UTFEight
    export holes on

    export autocolour ALL WITH MATCHWI(NAME OF SITE, '*PIPE*') colour 3

    DO !UNSITE VALUES !SITES
    export $!UNSITE
    ENDDO

    export finish

  • Thanks all for the help, I have manage to extract the rvm file and its working perfectly Slight smile

    Now my next step its to convert the ".rvm" file to ".nwd" automatically. I remember that was a topic on the old AVEVA World forum with the steps/code to achieve this but I don't find it here.

    I don't remember if its pssible to call Navisworks inside the macro file or if you need just to call a new batch file for Navisworks.

    Any ideas/experiences how this is can be done?

    Thanks for the help,

    ARamos

  • you could create a batch file something like

    "C:\Program Files\Autodesk\Navisworks Simulate 2020\FiletoolsTaskRunner.exe" /i "C:\TEMP\BATCH_NWD.txt" /of "C:\TEMP\BATCH_NWD.nwd" /log "C:\TEMP\BATCH_NWD.log" /version 2015

    BATCH_NWD.txt - list of files you wish to include for your NWD (you could also use a NWF)

    BATCH_NWD.nwd - the saved NWD file

    BATCH_NWD.log - log file

    and you just call the batch file from the macro