Jump to content

Create drawings from xcel


hsolon

Recommended Posts

I was wondering how to create a drawing based on information from an xcel spread sheet. I already have a spread sheet created that generates the width length and angle of tile, but I was wondering how I could make autocad see this to create my views and dimension them for me.

 

Please point me in the right direction!

Link to comment
Share on other sites

Use a add-on for AutoCAD. EasyTable For AutoCAD

 

 

That looks like it's for importing tables into AutoCAD, like XL2CAD from Dotsoft

 

You might want the reread the original post. I think the OP is looking for something to draw entities based on dimensions in a spreadsheet.

Link to comment
Share on other sites

I was wondering how to create a drawing based on information from an xcel spread sheet. I already have a spread sheet created that generates the width length and angle of tile, but I was wondering how I could make autocad see this to create my views and dimension them for me.

 

Please point me in the right direction!

 

I don't understood what you mean about the width length and angle of tile

Better yet you need to attach the drawing for the better understanding

Maybe I can help you

Another question is on wich language you need this program: Lisp, VBA or so

I think the best way for this case would be VBA

 

Fatty

 

~'J'~

Link to comment
Share on other sites

Sorry it took so long to reply, I have been incredably busy. Unfortunately I cannot post the drawing do to company policy and international trade agreements.

 

I am trying to create a VBA program that will draw rectangles from parameters that are generated in excell.

 

The premise.

 

I want to prompt the user for lets say a length and a diameter of a cylinder. Through VBA I want to enter these values into a pre-existing excell spread sheet.

 

The spread sheet will then determine how many columns and rows of brick I will need to cover the above cylinder.

 

The rules of the spreadsheet would be as follows,

 

The brick can be no longer than 9 inches and no wider than 3-1/2 inches.

It can also range in thickness from 1/2 inch to 2 inch depending on user input.

 

The spread sheet calculates the circumference and determines how to cover the area evenly with brick (using the most of the 9 x 3.5 as possible). Essentionally it determines a polygon that will fit as closley to the diameter as possible and generetes a new length and width to cover the area.

Link to comment
Share on other sites

I am very interested with such task 8)

It is possible let you to do as follows (to not break the policy

of your company):

Prepare sample Excel file as the table how should look

the data in this table, also prepare the simple drawing with full explanatories,

visually it will be easier to me to understand definition of the subsequent actions

I have already made a preliminary part of the program which

defines from the table the sizes of tiles and draws them then in AutoCAD

If this variant is arranges to you, send these files on:

fixo@yandex.ru

 

Fatty

 

~'J'~

Link to comment
Share on other sites

;|
    GET_XL.LSP
    Created by Elpanov Evgeniy
    [email="842@list.ru"]842@list.ru[/email]
    [email="elpanov@gmail.com"]elpanov@gmail.com[/email]

Data reading from Microsoft Excel not using Excel.
This code, can read diverse data from all tables.

ARGUMENTS:
A string containing a complete file name, including the path.
(setq tbl "D:\\7.xls")

USAGE:
(GET_xl tbl)

RETURN VFALUES
The list of all pages in a file with all data
|;
(defun rec-rem-dupl (lst)
(if lst
 (cons (car lst) (rec-rem-dupl (vl-remove (car lst) (cdr lst))))
) ;_  if
) ;_  defun
(defun GET_xl (tbl / ADOCONNECT ADORECORDSET LST)
(setq
 ADOConnect   (vlax-get-or-create-object "ADODB.Connection")
 ADORecordset (vlax-get-or-create-object "ADODB.Recordset")
) ;_  setq
(if (not
     (vl-catch-all-error-p
      (vl-catch-all-apply
       (function vlax-invoke-method)
       (list
        ADOConnect
        "Open"
        (strcat
         "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
         tbl
         ";Extended Properties=;Excel 8.0;HDR=No"
        ) ;_  strcat
        "admin"
        ""
        nil
       ) ;_  list
      ) ;_  vl-catch-all-apply
     ) ;_  vl-catch-all-error-p
    ) ;_  not
 (progn
  (setq
   lst (mapcar
        (function
         (lambda (l / i c)
          (vlax-invoke-method
           ADORecordset
           "Open"
           (strcat "SELECT * FROM [" l "]")
           ADOConnect
           1
           3
           nil
          ) ;_  vlax-invoke-method
          (setq
           i (length
              (car
               (vlax-safearray->list
                (vlax-variant-value
                 (vlax-invoke-method
                  ADORecordset
                  "GetRows"
                  65535
                 ) ;_  vlax-invoke-method
                ) ;_  vlax-variant-value
               ) ;_  vlax-safearray->list
              ) ;_  car
             ) ;_  length
          ) ;_  setq
          (vlax-invoke-method ADORecordset "Close")
          (while (not (zerop i))
           (vlax-invoke-method
            ADORecordset
            "Open"
            (strcat "SELECT * FROM [" l "a" (itoa i) ":IV" (itoa i) "]")
            ADOConnect
            1
            3
            nil
           ) ;_  vlax-invoke-method
           (setq
            c (cons
               (car
                (apply
                 (function mapcar)
                 (cons
                  'list
                  (mapcar
                   (function
                    (lambda (a)
                     (mapcar
                      (function
                       (lambda (b)
                        (vlax-variant-value b)
                       ) ;_  lambda
                      ) ;_  function
                      a
                     ) ;_  mapcar
                    ) ;_  lambda
                   ) ;_  function
                   (vlax-safearray->list
                    (vlax-variant-value
                     (vlax-invoke-method
                      ADORecordset
                      "GetRows"
                      65535
                     ) ;_  vlax-invoke-method
                    ) ;_  vlax-variant-value
                   ) ;_  vlax-safearray->list
                  ) ;_  mapcar
                 ) ;_  cons
                ) ;_  apply
               ) ;_  car
               c
              ) ;_  cons
            i (1- i)
           ) ;_  setq
           (vlax-invoke-method ADORecordset "Close")
          ) ;_  while
          (if (equal c '((nil) (nil)))
           (list l)
           (cons l c)
          ) ;_  if
         ) ;_  lambda
        ) ;_  function
        (rec-rem-dupl
         (caddr
          (mapcar
           (function
            (lambda (a)
             (mapcar
              (function vlax-variant-value)
              a
             ) ;_  mapcar
            ) ;_  lambda
           ) ;_  function
           (vlax-safearray->list
            (vlax-variant-value
             (vlax-invoke-method
              (vlax-invoke-method
               ADOConnect
               "OpenSchema"
               4
              ) ;_  vlax-invoke-method
              "GetRows"
              65535
             ) ;_  vlax-invoke-method
            ) ;_  vlax-variant-value
           ) ;_  vlax-safearray->list
          ) ;_  apply
         ) ;_  caddr
        ) ;_  rec-rem-dupl
       ) ;_  mapcar
  ) ;_  setq
  (vlax-invoke-method ADOConnect "Close")
  (vlax-release-object ADORecordset)
  (vlax-release-object ADOConnect)
  (setq ADORecordset nil
        ADOConnect nil
  ) ;_  setq
  lst
 ) ;_  progn
 (progn
  (vl-catch-all-apply
   'vlax-invoke-method
   (list ADOConnect "Close")
  ) ;_  vl-catch-all-apply
  (vlax-release-object ADORecordset)
  (vlax-release-object ADOConnect)
  (setq ADORecordset nil
        ADOConnect nil
  ) ;_  setq
  nil
 ) ;_  progn
) ;_  if
) ;_  defun

Link to comment
Share on other sites

  • 7 years later...
;|
    GET_XL.LSP
    Created by Elpanov Evgeniy
    [email="842@list.ru"]842@list.ru[/email]
    [email="elpanov@gmail.com"]elpanov@gmail.com[/email]

Data reading from Microsoft Excel not using Excel.
This code, can read diverse data from all tables.

ARGUMENTS:
A string containing a complete file name, including the path.
(setq tbl "D:\\7.xls")

USAGE:
(GET_xl tbl)

RETURN VFALUES
The list of all pages in a file with all data
|;
(defun rec-rem-dupl (lst)
(if lst
 (cons (car lst) (rec-rem-dupl (vl-remove (car lst) (cdr lst))))
) ;_  if
) ;_  defun
(defun GET_xl (tbl / ADOCONNECT ADORECORDSET LST)
(setq
 ADOConnect   (vlax-get-or-create-object "ADODB.Connection")
 ADORecordset (vlax-get-or-create-object "ADODB.Recordset")
) ;_  setq
(if (not
     (vl-catch-all-error-p
      (vl-catch-all-apply
       (function vlax-invoke-method)
       (list
        ADOConnect
        "Open"
        (strcat
         "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
         tbl
         ";Extended Properties=;Excel 8.0;HDR=No"
        ) ;_  strcat
        "admin"
        ""
        nil
       ) ;_  list
      ) ;_  vl-catch-all-apply
     ) ;_  vl-catch-all-error-p
    ) ;_  not
 (progn
  (setq
   lst (mapcar
        (function
         (lambda (l / i c)
          (vlax-invoke-method
           ADORecordset
           "Open"
           (strcat "SELECT * FROM [" l "]")
           ADOConnect
           1
           3
           nil
          ) ;_  vlax-invoke-method
          (setq
           i (length
              (car
               (vlax-safearray->list
                (vlax-variant-value
                 (vlax-invoke-method
                  ADORecordset
                  "GetRows"
                  65535
                 ) ;_  vlax-invoke-method
                ) ;_  vlax-variant-value
               ) ;_  vlax-safearray->list
              ) ;_  car
             ) ;_  length
          ) ;_  setq
          (vlax-invoke-method ADORecordset "Close")
          (while (not (zerop i))
           (vlax-invoke-method
            ADORecordset
            "Open"
            (strcat "SELECT * FROM [" l "a" (itoa i) ":IV" (itoa i) "]")
            ADOConnect
            1
            3
            nil
           ) ;_  vlax-invoke-method
           (setq
            c (cons
               (car
                (apply
                 (function mapcar)
                 (cons
                  'list
                  (mapcar
                   (function
                    (lambda (a)
                     (mapcar
                      (function
                       (lambda (b)
                        (vlax-variant-value b)
                       ) ;_  lambda
                      ) ;_  function
                      a
                     ) ;_  mapcar
                    ) ;_  lambda
                   ) ;_  function
                   (vlax-safearray->list
                    (vlax-variant-value
                     (vlax-invoke-method
                      ADORecordset
                      "GetRows"
                      65535
                     ) ;_  vlax-invoke-method
                    ) ;_  vlax-variant-value
                   ) ;_  vlax-safearray->list
                  ) ;_  mapcar
                 ) ;_  cons
                ) ;_  apply
               ) ;_  car
               c
              ) ;_  cons
            i (1- i)
           ) ;_  setq
           (vlax-invoke-method ADORecordset "Close")
          ) ;_  while
          (if (equal c '((nil) (nil)))
           (list l)
           (cons l c)
          ) ;_  if
         ) ;_  lambda
        ) ;_  function
        (rec-rem-dupl
         (caddr
          (mapcar
           (function
            (lambda (a)
             (mapcar
              (function vlax-variant-value)
              a
             ) ;_  mapcar
            ) ;_  lambda
           ) ;_  function
           (vlax-safearray->list
            (vlax-variant-value
             (vlax-invoke-method
              (vlax-invoke-method
               ADOConnect
               "OpenSchema"
               4
              ) ;_  vlax-invoke-method
              "GetRows"
              65535
             ) ;_  vlax-invoke-method
            ) ;_  vlax-variant-value
           ) ;_  vlax-safearray->list
          ) ;_  apply
         ) ;_  caddr
        ) ;_  rec-rem-dupl
       ) ;_  mapcar
  ) ;_  setq
  (vlax-invoke-method ADOConnect "Close")
  (vlax-release-object ADORecordset)
  (vlax-release-object ADOConnect)
  (setq ADORecordset nil
        ADOConnect nil
  ) ;_  setq
  lst
 ) ;_  progn
 (progn
  (vl-catch-all-apply
   'vlax-invoke-method
   (list ADOConnect "Close")
  ) ;_  vl-catch-all-apply
  (vlax-release-object ADORecordset)
  (vlax-release-object ADOConnect)
  (setq ADORecordset nil
        ADOConnect nil
  ) ;_  setq
  nil
 ) ;_  progn
) ;_  if
) ;_  defun

 

please, correct your code. I think error code.

Thank you.

Link to comment
Share on other sites

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...