BricsCAD SMEXPORT2D from API

When working with the .NET API there is no specific Sheet Metal support. I'm trying to create output which is equal to that produced by SMEXPORT2D.
I can not use SMEXPORT2D currently because I'm running these calls in batch, I have not found a way to prevent the save file dialog from popping up. Is there any way to give it a path where to save directly without going through the save dialog?

I tried some of the common variables which which control dialog creation but there doesn't seem to be any which SMEXPORT2D checks.
Application.SetSystemVariable("FILEDIA", 0);
Application.SetSystemVariable("CMDDIA", 0);
Application.SetSystemVariable("ATTDIA", 0);

In the BricsCAD C++ API there is support for Sheet Metal.
In C++ I've built unfolded objects using the BrxSmUnfoldOperation. This is only part of the solution since I need to also create the DXF output files and the schematic view that is produced by SMEXPORT2D normally.


EDIT:
This is harder than I thought it was, even just select a subentity (a face for example) is already impossible via the standard editor API, you can select these items by mouse just fine but you can't set a subentity from code. Someone pointed out to me you could record editor input and capture the parameters SMEXPORT2D takes normally that way.

From this I got an output along the lines of
(command "SMEXPORT2D" "2153.08,-1974.41" "C:\path\YourFile3.dxf" "2018")

This works fine, this also means it's possible to supply your own path but the thing I was getting stuck on was how to select the face.
Currently I'm trying to extract X and Y coordinates from a geometricextents property belonging to a face on the solid3d object. This isn't working yet, maybe it needs some type of viewport transformation. Progress never the less.

Comments

  • Hi

    Its not .net or C++, but I've done something similar using LISP.

    Maybe you can get some inspiration from that.

  • Hey,
    That's a great source of information. Doing a manual smunfold might very well be very best solution here.

  • I've managed to get it working in the end. The LISP API was by far the easiest way to work with these Sheet Metal models.

    The final method for exporting I settled on was using
    ed.Command(new object[] { "_.SMUNFOLD", "#0,0,0", "2D", path, "2018" });
    to create the DXF documents. Face selection was done through the LISP API. When using SmLispGet Selectentities you can relate the output string you get form that function back to a FullSubentityPath item.
    In my application I filter all faces in the 3D model based on colour, I know which faces have which entity path and can then relate the output of SelectEntities back to the right face. This way I know I have the right faces selected for DXF export calls.

    Quite tricky to figure this all out, seems it is a lot easier to either stick in LISP or C++ when working with Sheet Metal than to try and use dotnet.

    /*(SmLispGet "SelectEntities" "Top" "Flange_1")*/

            var args = new ResultBuffer(
                new TypedValue((int)LispDataType.Text, "SmLispGet"),
                new TypedValue((int)LispDataType.Text, "SelectEntities"),
                new TypedValue((int)LispDataType.Text, side),
                new TypedValue((int)LispDataType.Text, feature));