Community
Navisworks Forum
Welcome to Autodesk’s Navisworks Forums. Share your knowledge, ask questions, and explore popular Navisworks topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Publish using the Batch Utility (Simulate 2012)

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
StephenHenshall1260xx
2284 Views, 15 Replies

Publish using the Batch Utility (Simulate 2012)

Is it possible to publish an nwd file via the Batch Utility?

I currently generate a new model via the Batch Utility Scheduler but for security reasons, I need the file to be locked after 24hrs.

I can manually publish the file with these settings but I need to automate the file creation.

15 REPLIES 15
Message 2 of 16

In the VB examples there is an example that does just that:

C:\Program Files\Autodesk\Navisworks Simulate 2011\api\COM\examples\AUTO_08\Auto_08.vbs

(I suppose it is also included in the 2012 version)

 

Just open with Notepad and read it.
This can be launced from a command line

and thus by a scheduled CMD-file.

 

I had to modify it to get rid of the password and expirying date...

 

Message 3 of 16

Patrick,

 

Works a dream, many thanks.

Message 4 of 16

Is there a way to set the date to increment automatically?

eg todays date + 1

Message 5 of 16

Within the VB code, surly, but I don't know how.

 

Message 6 of 16

Try the Navisworks API forum

 

http://forums.autodesk.com/t5/Autodesk-Navisworks-API/bd-p/600


Lee Mullin
Construction Technical Specialist
Autodesk Ltd.

Message 7 of 16

Solution found,

 

If you replace the expiry argument with the following code, the published file has a onw week lifespan.

 

arg_expiry = dateadd("d", 7, Now() )

Message 8 of 16

Do you know if there is a way of creating a batch that uses the publish option "embed database properties" instead of expiration date?

Message 9 of 16

Spoiler
Ollie. I looked at trying to change some of the settings at the bottom of the publish dialogue but had no success. I think it was the spces in the attribute names that caused the problem (together with my lack of vb knowledge). I tried with single and double quotes but couldn't get it to work.

 

Message 10 of 16

Ollie. I looked at trying to change some of the settings at the bottom of the publish dialogue but had no success. I think it was the spces in the attribute names that caused the problem (together with my lack of vb knowledge). I tried with single and double quotes but couldn't get it to work.
 
Sorry, not sure what happened to my last reply
Message 11 of 16

Does Anyone got solution for customizing sample AUTO_08.vbs to publish option "embed database properties".

Also wanted to know with this script publishing time is faster?

Message 12 of 16

Patrick - can you post the modifications you made to remove the expiration date and password?

Message 13 of 16
derickr
in reply to: craig.caillet

Craig,

 

Here is one of the files I use. Hope it works for you.

 

Note: You will have to change the txt suffix to .vbs

Message 14 of 16
det047
in reply to: derickr

Hi,

I need to activate may be re-saved option. What is the parameter? Would you help me? Tks

Message 15 of 16
jhamilton
in reply to: det047

Is there an option that can be added to the script to embed the textures like you would if you were doing a manual publish?

Message 16 of 16
Hugo.MMata
in reply to: jhamilton

Just follow the steps:

1 - Pick the code below and create the file nwd2nwd_publish.vbs;

2 - rename the file attached Publish_nwd.txt to Publish_nwd.bat;

3 - Put both in the same folder / directory in computer;

4 - Edit the Publish_nwd.bat in Notepad to edit the arguments, such as the full path of the nwd2nwd_publish.vbs file, and the full path of the .nwf file to publish and the destination folder;

5 - Open nwd2nwd_publish.vbs to edit aditional arguments, there's an explanation in the top of the vbscript;

6 - Open the prompt and run the script that is inside the Publish_nwd.bat file or use Task Scheduler in windows to to schedule to  run this automation daily for exemple;

'Usage:
'cscript.exe nwf2nwd_advanced.vbs <f_in> <f_out> <title> <subject> <author> <publisher> <publishedfor>
'<copyright> <keywords> <comments> <password> <expirydate>

'Example of the command in .bat (batch file command, just create a test.txt in yout desktop and rename to test.bat) 
'using cscript.exe in the beginning to run the vbscript, you can run by prompt or task scheduler:
'cscript.exe "P:\teste_smartplant\nwf2nwd_advanced.vbs" "P:\teste_smartplant\112-60-45-Mecanica.nwf" "P:\teste_smartplant\112-60-45-Mecanica.nwd" "Projeto XXX" "Modelo para acompanhamento de projeto" "Company_Name" "" "" "" "" ""

' input argument 
dim roamer
dim attrib
dim ndx
dim arg_in
dim arg_out
dim arg_title
dim arg_password 
dim arg_author 
dim arg_subject
dim arg_copyright
dim arg_keywords
dim arg_comments
dim arg_publisher
dim arg_publishedfor
dim flags
dim arg_expiry
dim expiry
dim count
dim datenow

''prepare arguments
if WScript.Arguments.Count < 10 then
    WScript.Echo "Missing parameters"
Else
    count=WScript.Arguments.Count
    arg_in=WScript.Arguments(0)
    arg_out=WScript.Arguments(1)
    arg_title=WScript.Arguments(2)
    arg_subject=WScript.Arguments(3)
    arg_author=WScript.Arguments(4)
    arg_publisher=WScript.Arguments(5)
    arg_publishedfor=WScript.Arguments(6)
    arg_copyright=WScript.Arguments(7)
    arg_keywords=WScript.Arguments(8)
    'arg_comments=WScript.Arguments(9)
    arg_comments="Data de publicação: " & dateadd("d", 0, Now())
    arg_password=WScript.Arguments(9)
    'arg_expiry=WScript.Arguments(11)
    'arg_expiry = dateadd("d", 21, Now())
    'expiry=CDate(arg_expiry)

End if

''create roamer via automation
set roamer=createobject("navisWorks.document") 
roamer.visible = false

''open input file
roamer.openfile arg_in

''create publishing attribute
ndx=roamer.state.getenum("eObjectType_nwOaPublishAttribute")
set attrib=roamer.state.objectFactory(ndx)

''set publishing properties
attrib.title=arg_title
attrib.password=arg_password
attrib.author=arg_author
'attrib.expirydate=expiry
attrib.subject=arg_subject
attrib.copyright=arg_copyright
attrib.keywords=arg_keywords
attrib.comments=arg_comments
attrib.publisher=arg_publisher
attrib.publishedfor=arg_publishedfor

flags=attrib.flags
''show properties when open Navisworks
ndx=roamer.state.getenum("ePublishFlag_DISPLAY_ON_OPEN")
''embed recap and textures
ndx1=roamer.state.getenum("ePublishFlag_EMBED_TEXTURES")
''embed database properties such as datatools linked to excel table
'ndx2=roamer.state.getenum("ePublishFlag_EMBED_DATABASE")
''allow nwd output file be saved in other model or naviswork file
'ndx3=roamer.state.getenum("ePublishFlag_ALLOW_RESAVE")

flags=flags or ndx or ndx2 or ndx1 or ndx3
attrib.flags=flags

'write output file
roamer.publishfile arg_out,attrib

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report