Message 1 of 1
Auto Publish Model From NWF File
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey,
I need Help with some code stuff 🙂
i have to publish models every day and do it menualy take some time haha..
if someone can help me i need to publish nwf files that update every day cuz we working with DWG and i need the models in the NWF To be updated before publish and i need to fill the publish pop up with project information like title,author,publisher,publish for and copyright - date and stuff like that not using.
i have found a VBScript but i can't make it work i will post it here.
'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 "'cscript.exe "P:\Test Auto Publish\nwf2nwd_advanced.vbs" "P:\Test Auto Publish\6820-Transition Racks-X3.nwd" "P:\Test Auto Publish\nwdtest.nwd" "Projeto XXX" "Modelo para acompanhamento de projeto" "Company_Name" "" "" "" "" """ "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 < 0 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
i have tryed to run the script on nwd and nwf files
i have error on line 90 colum 19.