How to export an importinstance to DXF file format efficiently

I’m trying to create a dynamo component that batch exports importinstances inside the revit model to .dxf file format. My current approach is to isolate the element (importinstance) by elementID and then export the view using export.(,DXFExportOptions) ect…

With this approach so many issues come up.

  1. Extremely slow
  2. Popup box asking if temporary isolate is okay for export every time.
  3. DXF file does not match the original DWG file that was imported.

I know this has been done in the past, but I just can’t wrap my head around the correct approach using the Revit API. Does anybody have any insight to make this more correct/efficient?

Thanks!

Norm

Hi Norm,

It looks like you have the best solution for this… Here’s a link which discusses handling the popup box. It’s written in C#, let us know if you need more assistance.

Hope that helps,

Mark

1 Like

Appreciate the feedback! After playing around with some Dynamo components I saw that BiMorph nodes performs this dxf export in what seems to be an efficient manner. Any idea if they are following this same approach?

I had a quick look and the method Jeremy is using looks very similar; essentially all BimorphNodes does is isolate the import instance in the view so nothing else is exported, then the Revit API Document.Export method is used to extract the DXF using the following options

    DXFExportOptions exportOptions = new DXFExportOptions()
    {
        SharedCoords = true,
        ExportOfSolids = SolidGeometry.ACIS,
        FileVersion = ACADVersion.R2013,
        TextTreatment = TextTreatment.Exact,
        TargetUnit = ExportUnit.Millimeter
    };
2 Likes

Thank you Thomas! Those settings are extremely helpful! Looks like I can just explode the block that encapsulates the entire dxf file after the file is exported with these settings and it will be correct.

And props to the Revit API dev team for allowing this type of UI control within their program - thank you Mark, this was the missing piece of the puzzle.

uiapp.DialogBoxShowing += new EventHandler<DialogBoxShowingEventArgs>( OnDialogBoxShowing );

Appreciate the help!