Jump to content

Need help exporting Dimensions to specific cells and applying formulas on them


Recommended Posts

Posted

Hi Everyone,

I need a bit of help exporting any and all dimensions in a given drawing (not a batch process) into a pre-existing Excel file. The excel file has formulas built in to update other cells and update the OLE object that I have placed in the sample attached file. If this sounds confusing, I've written a bit more in detail in the autocad file.

 

I tried using Lee Mac's Lisp (below) to export dimensions into a .csv file but I need it to go into an excel file preferably into Cells C11 and D11. I am BRAND NEW to lisp so I can't code to save my life but I did some searching and now I'm able to load and run Lisps and I can kind of makeout the procedure but the syntax is going to take some learning.

 


(defun c:DimExport (/ i ss file e d)
 ;; Lee Mac  ~  08.04.10

 (if (and (setq i -1 ss (ssget '((0 . "DIMENSION"))))
          (setq file (getfiled "Output" "" "txt;csv" 1)))
   (progn
     (setq file (open file "w"))
     (while (setq e (ssname ss (setq i (1+ i))))
       (setq d (cdr (assoc 42 (entget e))))

       (write-line
         (if (or (= 2 (logand 2 (cdr (assoc 70 (entget e)))))
                 (= 5 (logand 5 (cdr (assoc 70 (entget e))))))
           (angtos d (getvar 'DIMAUNIT) (if (minusp (getvar 'DIMADEC))
                                          (getvar 'DIMDEC)
                                          (getvar 'DIMADEC)))
           
           (rtos d (getvar 'DIMLUNIT) (getvar 'DIMDEC))) file))
         
     (close file)))

 (princ))

Basically, I want to make this a template were if I have a part of that shape, I can quickly adjust the length and the dimensions export into the OLE excel file which thereby updates all the extra few parts that are based on this file (these variants are .25" longer in each direction).

Sample.dwg

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...