Hi,
I know we can create navis file[.nwc] by using nwcout command but how do we create navis file [.nwc ] programatically.
Thanks & Regards
Solved! Go to Solution.
Solved by philippe.leefsma. Go to Solution.
There is no API to export to .nwc format. You would need to programmatically send the nwcout command using Document.SendStringToExecute for example.
Regards,
Philippe.
Ok. Got the point.I have used Document.SendStringToExecute with attsync :
Dim blname as String="Test"
Dim command As String = "_ATTSYNC Name " + blname + vbCr
doc.SendStringToExecute(command, True, False, False)
But I am unable to call NWCOUT I tried:
Dim path as String="c:\Test"
Dim command As String = "_NWCOUT Path " + path+ vbCr
doc.SendStringToExecute(command, True, False, False)
Which version of AutoCAD are you using? Because in plain AutoCAD I can't see a NWCOUT command...
The following code prompts me for the path:
Dim dbt AsDatabase = Application.DocumentManager.MdiActiveDocument.Database
Dim doc2 AsDocument = Application.DocumentManager.MdiActiveDocument
Dim command AsString = "_NWCOUT " + "d:\w.nwc" + vbCr
doc2.SendStringToExecute(command,True, False, False)
How do I manage to pass the file path to the command
This needs to be done as follow:
[DllImport("accore.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "acedCommandS")] private static extern int acedCommandS( int type1, string str1, int type2, string str2, int end); [CommandMethod("NwcOutNet")] public void NwcOutNet() { Document doc = Application.DocumentManager.MdiActiveDocument; object filedia = Application.GetSystemVariable("FILEDIA"); Application.SetSystemVariable("FILEDIA", 0); acedCommandS(5005, "_NWCOUT", 5005, "c:\\Temp\\test.nwc", 5000); Application.SetSystemVariable("FILEDIA", filedia); }
Hi, Philippe. It was really helpful.
It works fine with AutoCAD 2015, but I need to use this command for AutoCAD 2011.
How can I change values for AutoCAD 2011?
For 2011 use acedCommand instead and it is exported directly by acad.exe I believe.
Try the following:
[DllImport("acad.exe", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl, EntryPoint = "acedCommand")] private static extern int acedCommand( int type1, string str1, int type2, string str2, int end);
Philippe.