C# how to save the layer as DXF?

Hi,
I have a problem,I have let the selected object(mesh) into my new layer,how can I save it as .dxf file ,dxf file name is the layer name?

Hi @NehoLyg,

Make a script runner command, and then call RhinoApp().RunScript("_-Export ...") .

– Dale

Hi,
thank you very much,Please forgive me for replying you so late,

,I use this method save SelectedObject in rhino,but the dxf file cannot open by autocad, use rhino can open that dxf file,Do you know why?
te100.dxf (181 KB)

Hi @NehoLyg,

Have you tried scripting the Export command?

– Dale

No, because I must write in c#

Hi @NehoLyg,

Let me know if this sample helps.

SampleCsExportDXF.cs

– Dale

Hi,dale,
Thank you very much,You helped me very much,I am watching your GitHub to study,you are a good man,

blessing

Hi,
What I want to achieve is to select multiple modules at a time. Each module is put into a new layer, and the module in each layer is stored separately in the DXF file.

The following is my writing,But it puts multiple modules in the same DXF.
Can you tell me what’s wrong?
Hello.cs (4.1 KB)