View Full Version : Script to export DWG to NWD path issue
I need help writing a script to export DWG to NWD (NavisWorks). I need to set a path, the NWD is going all over the place when it saves. So far I got:
;prevent dialog box
filedia
0
;nwdout
nwdout
;allow dialog box
filedia
1
;end
I don't know how to predefine the path or add the path to the file name at the prompt (would like to use DWG's path):
Command: nwdout
File name <filename.nwd>:
RobertB
2009-04-06, 08:00 PM
It depends on if the ARX command will accept AutoLISP statements:
(strcat (getvar 'DwgPrefix) (vl-filename-base (getvar 'DwgName)))
I couldn't get that to work, I think I am doing it wrong.
I was able to take the text the code generated "C:\\Temp\\Test" and past it at
Command: nwdout -- File name <test.nwd>:C:\\Temp\\Test
and the define path worked. Just need to know a way to take "<test.nwd>" part and added it to the path so it will work as a script for multiple files. I have tried using <>, but that doesn't work.
RobertB
2009-04-07, 02:02 AM
If the ".nwd" is required this provides it:
(strcat (getvar 'DwgPrefix) (vl-filename-base (getvar 'DwgName)) ".nwd")
howardjosh
2009-04-07, 06:56 AM
Robert was right on the money with that lisp string, but as a side note you could even tell autocad to automatically open the file in navis as well using the "Start" command. How it would work from a script I don't know, but this is how I currently do it in lisp.
(command "start" File_Path_as_String)
an additional bit of info would be that the start command seems to work just like start->run does on windows.... meaning you can open the windows calculator just by typing start and then calc from within autocad
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.