Constructing an AutoCAD Electrical project "Zip" utility

  • Oh no! An error has occurred!
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • You need to be logged in to do that.
  • Coinciding with the acquisition of VIA Development, Nate joined Autodesk in March of 2003 after a decade stint as an entrepreneur following a two-decade stint as a controls engineer and software applications developer at Owens-Corning. Nate is now the lead product architect for AutoCAD Electrical. He loves this stuff.

    About Nate

Latest Post

  • Constructing an AutoCAD Electrical project "Zip" utility
    September 14, 2007, 05:50 AM Nate Holt

    There is already facility in the product to do this but it requires some dialog picks to select and execute. Let's say what you really want is a totally command-line-driven function - absolutely no prompts. Maybe you want to add it to a toolbar button or call it from some automated script program or equivalent. You want to just pass 1) the name of the AutoCAD Electrical project to archive/zip and 2) the full filename of the zip (or .rar) file to create.

    Both the "zip" and "rar" utilities have command-line versions. They seem to be similar in that the key is to construct a small ascii text file listing the full filenames of what to include in the archive. This temp file is passed as one of the archive utility's command-line parameters.

    Using the AutoCAD Electrical API, it's pretty simple to get a list of all the drawings in either the active project or some other named project. Write these out to an ascii text file along with the project's ".wdp" filename itself, and then pass it over to the zip utility.

    Here is the AutoLISP version of just such a utility. It is set up to use a handful of the published AutoCAD Electrical API calls. About half-way down is where the API is called to read in the project “.wdp” file and collect the full drawing file path names. These are then dumped to a temp file called “wdzip.tmp”. The project’s “.wdp” filename is added to this list. Then the “startapp” function is called. This invokes the command-line version of the archive utility and passes the temp file name. It seems to work.

    zip01.png


    Testing

    If you want to try this, download the file here. With AutoCAD Electrcial running, type APPLOAD at your command line and browse to the downloaded file. Load it.

    Now you're ready. Here is the command syntax:

    For active project, it's this: (ace_zip_project nil zipfilename)
    For non-active project, it's this: (ace_zip_project wdpfname zipfilename)

    Use single forward slashes or double backslashes. Note that the zip utility may have issues if one of the drawings you want to include in the archive is active on your screen.

    Example - zip the active project: (ace_zip_project nil "c:/customer/1234.zip")
    Example - zip nonactive project: (ace_zip_project "c:/projects/cust/5678.wdp" "c:/customer/5678.zip")




    0 Comment | Add Comment Controlling the Machine > All

Comments



You must be logged in to post a comment.

Subscribe to Blog

Want to keep up with the latest? Subscribe to the RSS feed today.

RSS

Tags

You must be logged in to add a tag.

Send to a Peer

You must login to share pages.

Feedback

Tell us what you think of the site.

Send Feedback