.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

nwcout

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
sanjaymann
1601 Views, 9 Replies

nwcout

Hi,

 

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

 

Thanks & Regards

9 REPLIES 9
Message 2 of 10

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

Message 3 of 10

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)

 

Message 4 of 10

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

Message 5 of 10

Autocad 2013

Message 6 of 10

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

Message 7 of 10

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

Message 8 of 10

Thanks. This worked like a charmSmiley Happy

Message 9 of 10

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?

Message 10 of 10

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.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost