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

nwcout

13 REPLIES 13
SOLVED
Reply
Message 1 of 14
Anonymous
2242 Views, 13 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

13 REPLIES 13
Message 2 of 14
philippe.leefsma
in reply to: Anonymous

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 14
Anonymous
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)

 

Message 4 of 14
philippe.leefsma
in reply to: Anonymous

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 14
Anonymous
in reply to: philippe.leefsma

Autocad 2013

Message 6 of 14
Anonymous
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

Message 7 of 14
philippe.leefsma
in reply to: Anonymous

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 14
Anonymous
in reply to: philippe.leefsma

Thanks. This worked like a charmSmiley Happy

Message 9 of 14
Anonymous
in reply to: philippe.leefsma

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 14
philippe.leefsma
in reply to: Anonymous

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

Message 11 of 14
bryan.thatcherPGLDM
in reply to: Anonymous

I'm trying to get this working in 2024. Does the above code need to be in its own class?

Message 12 of 14

You don't need that code in AutoCAD 2024. You can use the Editor's Command() method to do what it does. 

Message 13 of 14

I've tried. Would you mind sharing the syntax? 

 

public string TempOutPath = "c:\\temp\\NWC\\test.nwc";
doc.Editor.Command("_NWCOUT", TempOutPath);
Message 14 of 14

I'm not familiar with that command so I can't tell you anything about its syntax but if you tried what you showed, then what happened?

 

If a file save dialog box appeared, then you may need to set the FILEDIA system variable to zero first. 

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report