Results 1 to 5 of 5

Thread: AutoCAD dimensions to Excel

  1. #1
    Member
    Join Date
    2005-08
    Posts
    6
    Login to Give a bone
    0

    Default AutoCAD dimensions to Excel

    Is it possible to convert AutoCAD dimensions into excel? Can anybody help me please?
    Thanks Bart

  2. #2
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: AutoCAD dimensions to Excel

    Hi Bart

    Please note I have *moved* this thread from the Software forum to this one as I believe it would be better served here.

    Thanks, Mike

    Forum Moderator

  3. #3
    Moderator arcadia_x27's Avatar
    Join Date
    2015-10
    Location
    The 'Mill,Moncton, NB, Canada
    Posts
    516
    Login to Give a bone
    0

    Default Re: AutoCAD dimensions to Excel

    How or what aspects of the dimensions do you want/need sent into excel? Could you please be more specific as to what you are trying to accomplish

  4. #4
    Member
    Join Date
    2005-08
    Posts
    6
    Login to Give a bone
    0

    Default Re: AutoCAD dimensions to Excel

    Quote Originally Posted by arcadia_x27
    How or what aspects of the dimensions do you want/need sent into excel? Could you please be more specific as to what you are trying to accomplish
    We want AutoCAD to control Excel. What we mean is: if we draw a rectangle in AutoCAD and we give it dimensions for example length 100, width 50. With a simple action we want those 2 dimensions to appear in excel.

    Thanks Bart

  5. #5
    100 Club
    Join Date
    2005-09
    Posts
    111
    Login to Give a bone
    0

    Default Re: AutoCAD dimensions to Excel

    Quote Originally Posted by bartstienaers
    We want AutoCAD to control Excel. What we mean is: if we draw a rectangle in AutoCAD and we give it dimensions for example length 100, width 50. With a simple action we want those 2 dimensions to appear in excel.

    Thanks Bart

    ------------- ~\\|//~ ------------
    ------------- [o]-[o] -------------
    -------ooO---(_)---Ooo--------


    Dear Bart,

    Please try my program.
    But first notice de variable DirExcel, you must change it (to let AutoCAD find Excel).

    Email hofcad@yahoo.com

    Groetjes HofCAD CSI



    Code:
    (setq DirExcel "C:\\progra~1\\micros~1\\office\\")
     ;;;
     ;;; HofREC
     ;;;
     (Defun C:HofRec	()
       (setq ~CMD (getvar "CMDECHO"))
       (setvar "CMDECHO" 0)
       (setq ~OSM (getvar "OSMODE"))
       (setvar "OSMODE" 0)
       (setq naam "REC1")
       (setq lop (getpoint "\nLeft lower corner.: "))
       (setq rbp (getcorner lop "\nRight upper corner.: "))
       (command "_PLINE"
     	   lop
     	   "W"
     	   "0"
     	   "0"
     	   (list (car rbp) (cadr lop))
     	   rbp
     	   (list (car lop) (cadr rbp))
     	   "C"
       )
       (setq e1 (entlast))
       (setq b (- (car rbp) (car lop)))
       (setq h (- (cadr rbp) (cadr lop)))
       (regapp "HOFREC")
       (setq	xd (list -3
     		 (list "HOFREC"
     			   (cons 1000 naam)
     			   (cons 1002 "{")
     			   (cons 1010 lop)
     			   (cons 1040 b)
     			   (cons 1041 h)
     			   (cons 1042 1.0)
     			   (cons 1002 "}")
     		 )
     	   )
       )
       (setq	ed1  (entget e1)
     	edx1 (append ed1 (list xd))
       )
       (entmod edx1)
     
       (princ)
       (setvar "OSMODE" ~OSM)
       (setvar "CMDECHO" ~CMD)
     )
     ;;;
     ;;;REC2XL
     ;;;
     (defun c:REC2XL	()
       (defun dxf (code elist)
     	(cdr (assoc code elist))
       )
       (setq naam nil)
       (if (setq ss (ssget "X" '((-3 ("HOFREC")))))
     	(progn
     	  (setq $acv (atoi (substr (getvar "ACADVER") 1 2)))
     	  (setq teknaam (getvar "dwgname"))
     	  (if (> $acv 13)
     	(setq teknaam (substr teknaam 1 (- (strlen teknaam) 4)))
     	  )
     	  (setq OutFile (strcat "c:\\temp\\" teknaam ".xls"))
     	  (setq filedes (open OutFile "w"))
     	  (mapcar '(lambda (x) (princ X filedes))
     		  '("\t"		  "\t"
     		"Rectangle to Excel by HofCAD CSI"	  "\n"
     		"\n"    	  "\t"    	"Lower left"  "\n"
     		"Rectang"	 "\t"		"X"    	  "\t"
     		"Y"    	  "\t"    	"Z"		  "\t"
     		"Width"    	  "\t"    	"Height"	  "\t"
     		"Area"    	  "\t"    	"Changed"	  "\n"
     		   )
     	  )
     	  (setq ssmax (sslength ss)
     		i	  0
     	  )
     	  (while (< i ssmax)
     	(setq en (ssname ss i)
     		  ed (entget en '("HOFREC"))
     		  xd (dxf -3 ed)
     	)
     	(setq b (- (cadr (nth 18 ed)) (cadr (nth 14 ed))))
     	(setq h (- (caddr (nth 22 ed)) (caddr (nth 18 ed))))
     	(setq lop (nth 14 ed))
     	(print lop)
     	(setq px (car lop)
     		  px (cadr lop)
     		  py (caddr lop)
     	)
     	(print px)
     	(print py)
     	(setq pz (cdr (nth 12 ed)))
     	(print pz)
     	(setq lop_org (dxf 1010 (cdar xd)))
     	(setq px_org (car lop_org)
     		  py_org (cadr lop_org)
     		  pz_org (caddr lop_org)
     	)
     	(setq naam (dxf 1000 (cdar xd)))
     	(setq b_org (dxf 1040 (cdar xd)))
     	(setq h_org (dxf 1041 (cdar xd)))
     	(setq opp (strcat "=E" (itoa (+ i 5)) "*F" (itoa (+ i 5))))
     	(if (or	(/= px px_org)
     		(/= py py_org)
     		(/= pz pz_org)
     		(/= b B_org)
     		(/= h h_org)
     		)
     	  (setq chg "Yes")
     	  (setq chg "No")
     	)
     	(mapcar	'(lambda (x) (princ X filedes))
     		(list naam  "\t"  px	"\t"  py	"\t"  pz	"\t"
     			  b		"\t"  h    "\t"  opp   "\t"  chg	"\n"
     			 )
     	)
     	(setq i (1+ i))
     	  )
     	)
       )
       (close filedes)
       (if (= naam nil)
     	(print "Geen Excel rechthoeken.")
     	(progn
     	  (princ (strcat "\n " OutFile " is aangemaakt.")
     		 (Startapp (strcat DirExcel "EXCEL") OutFile)
     	  )
     	)
       )
       (princ)
     )
     (Print "HofREC loaded")
     (textscr)
     (princ
       "\n********************IMPORTANT*******************  ***********\n"
     )
     (princ "Draw rectangles with HofRec")
     (princ "Export to EXCEL with Rec2XL")
     (princ)
    Last edited by Mike.Perry; 2005-11-09 at 11:26 PM. Reason: Placed code in code tags ( Glenn ) / Code formatted ie Indented ( Mike Perry ).

Similar Threads

  1. Polylines dimensions export to excel
    By milivojekrstanovic in forum AutoLISP
    Replies: 46
    Last Post: 2017-08-02, 11:07 PM
  2. Replies: 5
    Last Post: 2013-10-16, 05:39 PM
  3. dimensions controlled by excel values
    By labadiena in forum AutoCAD General
    Replies: 1
    Last Post: 2012-12-24, 03:57 PM
  4. Replies: 1
    Last Post: 2012-08-08, 05:50 PM
  5. Replies: 1
    Last Post: 2009-04-29, 11:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •