.NET

Reply
Valued Contributor
sanjaymann
Posts: 100
Registered: ‎05-22-2013
Message 1 of 8 (334 Views)
Accepted Solution

nwcout

334 Views, 7 Replies
10-06-2013 09:14 PM

Hi,

 

I know we can create navis file[.nwc] by using nwcout command but how do we create navis file [.nwc ] programatically.

 

Thanks & Regards

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);
}

 

ADN Support Specialist
philippe.leefsma
Posts: 631
Registered: ‎06-02-2009
Message 2 of 8 (294 Views)

Re: nwcout

10-08-2013 02:43 AM in reply to: sanjaymann

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.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Valued Contributor
sanjaymann
Posts: 100
Registered: ‎05-22-2013
Message 3 of 8 (289 Views)

Re: nwcout

10-08-2013 02:57 AM in reply to: philippe.leefsma

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)

 

ADN Support Specialist
philippe.leefsma
Posts: 631
Registered: ‎06-02-2009
Message 4 of 8 (287 Views)

Re: nwcout

10-08-2013 03:05 AM in reply to: sanjaymann

Which version of AutoCAD are you using? Because in plain AutoCAD I can't see a NWCOUT command...



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Valued Contributor
sanjaymann
Posts: 100
Registered: ‎05-22-2013
Message 5 of 8 (280 Views)

Re: nwcout

10-08-2013 03:15 AM in reply to: philippe.leefsma

Autocad 2013

Valued Contributor
sanjaymann
Posts: 100
Registered: ‎05-22-2013
Message 6 of 8 (277 Views)

Re: nwcout

10-08-2013 03:24 AM in reply to: philippe.leefsma

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

ADN Support Specialist
philippe.leefsma
Posts: 631
Registered: ‎06-02-2009
Message 7 of 8 (271 Views)

Re: nwcout

10-08-2013 04:10 AM in reply to: sanjaymann

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);

}

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Valued Contributor
sanjaymann
Posts: 100
Registered: ‎05-22-2013
Message 8 of 8 (233 Views)

Re: nwcout

10-09-2013 01:22 AM in reply to: philippe.leefsma

Thanks. This worked like a charm:smileyhappy:

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.