Export DXFs of 2D (parallel projection) standard views in Ruby

Okay, … here is the next update.

  • This is packaged as a RBZ extension archive. You can install it with the Extension Manager.
    • If you do, remove the old file from “Plugins” or wherever so it does not load.

See updated version 1.1.1 below.

  • This is now packaged as a proper SketchupExtension RBZ.
    • It can be installed via Extension Manager
    • It is not signed
  • You can change the dialog delay via the DIALOG_DELAY constant.
  • I added a working directory selector dialog and a query for perspective / orthographic view.
  • I added a zoom extents before opening the Export dialog.
  • The example adds a command to the bottom of the File menu.
  • You can also fire the command via:
    • Example::BatchExportDXF.go
  • Results are displayed in the console and in a messagebox.
    • It asks if you wish to open the directory location.

A. Sometimes the first view does not want to export. There is sometimes a quirk that changes the underscores to dashes in the filename field (in the dialog) but Ruby doesn’t know this and it’s tests for file existence fail. The extension then thinks that one or more views failed to be written out.

Adding a little more delay might help. It’s set to 1.0 second now.

B. Sometimes there is a duplicate export dialog opening for the last view even though it was already exported.

It is the nature of SketchUp API timers and modal dialogs that weird things happen. For example, opening a modal dialog like a messagebox from within a timer block can lead to an infinite number of messageboxes and the need to force quit SketchUp via the Windows Task Manager.

Suggest always save the model before running a batch export if changes have been made.

2 Likes