Embed Material Textures in published .nwd from the Batch Utility

Embed Material Textures in published .nwd from the Batch Utility

jhamilton
Advocate Advocate
948 Views
3 Replies
Message 1 of 4

Embed Material Textures in published .nwd from the Batch Utility

jhamilton
Advocate
Advocate

Does anyone know if it is possible to set the batch utility to embed the material textures when the batch utility publishes .nwd's.  This is an available option for a manual publish but I do not see anything for it when a save as method is used or in the batch utility.  I also have not seen anything on being able to add a script in the API do do it either.

0 Likes
949 Views
3 Replies
Replies (3)
Message 2 of 4

michael.coviello
Autodesk Support
Autodesk Support

Hello @jhamilton,   

This script was last available in Navisworks 2012.   It was renamed/modified and is included in the Navisworks SDK

The new name is: AutoPublishScriptExample.vbs

 

Please download and install the Navisworks 2018 SDK from the Autodesk Developer Network
The default location for this particular script is:
C:\Program Files\Autodesk\Navisworks Manage 2018\api\COM\examples\Auto\AutoPublishScriptExample

 

 

If you find the script does not do what you want, you may be able modify it to Embed Textures.   

 

NET API.chm help documentation may help (Default location)

C:\Program Files\Autodesk\Navisworks Manage 2018\api\NET\documentation

Searching for "EmbedTextures"

 

I've created a knowledge base article for this as well.

Navisworks- Cannot find older script files such as Auto_08.vbs script

 

If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!



Michael C
Technical Support Specialist
What's New in Revit 2023 | Autodesk University | Revit Blog
0 Likes
Message 3 of 4

jhamilton
Advocate
Advocate

I did get the script mentioned from the API.  However that does not cover embedding the materials.  Hopefully I can did up the VB code for that part and add to it to get what I need.

0 Likes
Message 4 of 4

Anonymous
Not applicable

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

Pick 

0 Likes