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.
Solved! Go to Solution.
Solved by Patrick_Aps_9121. Go to Solution.
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...
Is there a way to set the date to increment automatically?
eg todays date + 1
Try the Navisworks API forum
http://forums.autodesk.com/t5/Autodesk-Navisworks-API/bd-p/600
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() )
Do you know if there is a way of creating a batch that uses the publish option "embed database properties" instead of expiration date?
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?
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
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?
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.