Jump to content

Table


Recommended Posts

Posted

Dears

 

Thanks all.

How it can be possible to save data generated by DIMCONTINUE in to the table?

 

Regards,

MJ

Posted

What data does DIMCONTINUE collect and what table are you trying to save it to?

Posted

My Guess is that for every dimension you assign using DIMCONTINUE, you want the measurement to be possibly exported to Excel?

 

Would I be somewhere near the mark?

Posted

Dears

 

Thanks

Data generated by DIMCONTINUE are figures (number in mm or other units) and need to be save in to the table in order?

 

Regards,

MJ

Posted

Dear ReMark

 

Thanks

Data generated by DIMCONTINUE are figures (number in mm or other units) and need to be save in to the table in order?

 

Regards,

MJ

Posted

What table might this be then? An Excel sheet, or some table you have drawn in ACAD?

 

Also, this is probably better accomplished using either VBA or LISP, so you might be better asking a moderator to move this thread to the AutoLISP forum.

 

In saying that - DO NOT create another thread in that forum, ask to get this one moved - it gets confusing if you have two identical threads in different forums.

 

Cheers

 

Lee

Posted

Dear Lee Mac

 

Thanks. I prefer to save data in an Excel sheet, but it would be OK in any other form of table!

 

Regards,

MJ

Posted

This should work:

 

(defun c:exdim (/ *error* oldvars varlist entLst file ofile)
 (vl-load-com)
 (defun *error* (msg)
   (if oldvars (mapcar 'setvar varlist oldvars))
   (if (= msg "")
     (princ "\n< Function Complete >")
     (princ (strcat "\nError: " (strcase msg))))
   (princ))
 (setq varlist (list "CMDECHO")
   oldvars (mapcar 'getvar varlist))
 (setvar "cmdecho" 0)
 (prompt "\nSelect Base Dimension > ")
 (command "_dimcontinue" "S")
 (while (> (getvar "CMDACTIVE") 0) (command pause)
   (setq entLst (cons (entlast) entLst)))
 (setq entLst (reverse (cddr entLst)))
 (if (setq file (getfiled "Create or Select an Excel File" "C:\\" "csv" 9))
   (progn
     (setq ofile (open file "w"))
     (foreach e entLst
   (write-line (rtos (cdr (assoc 42 (entget e))) 2 2) ofile))
     (close ofile))
   (princ "\nNo File Selected"))
 (*error* "")
 (princ))
 

Posted

Dear Lee Mac

 

Thanks!

 

I tried the "program", but I couldn't get the results. It may comes from my improperly use!

If you possibly could give instruction of use its great help to me.

 

Regards,

MJ

Posted

The program should work if used correctly - I have tested it myself. :)

 

To be used as follows:

 

  • Copy the contents of the code frame into an empty notepad doc, and save as something.lsp (make sure the option is set to "all files").
  • Go to Load application in ACAD (or type _appload into command prompt) and find the saved lisp file.
  • Type exdim into command prompt
  • Select a Dimension on which to use dim-continue.
  • Once dimensioning is completed, create/select an excel file (.csv) to write to.
  • Open csv file to view results.

Posted

Dear Lee

 

Hi, I am happy to hear your laughing!

Just one point, data created in DIMCONTINUE are in 4 decimal digits but transferred figures in Excel are in 2 decimal digits!

 

Cheers,

MJ

Posted

Data created is now printed to 4 dp:

 

(defun c:exdim (/ *error* oldvars varlist entLst file ofile)
 (vl-load-com)
 (defun *error* (msg)
   (if oldvars (mapcar 'setvar varlist oldvars))
   (if (= msg "")
     (princ "\n< Function Complete >")
     (princ (strcat "\nError: " (strcase msg))))
   (princ))
 (setq varlist (list "CMDECHO")
   oldvars (mapcar 'getvar varlist))
 (setvar "cmdecho" 0)
 (prompt "\nSelect Base Dimension > ")
 (command "_dimcontinue" "S")
 (while (> (getvar "CMDACTIVE") 0) (command pause)
   (setq entLst (cons (entlast) entLst)))
 (setq entLst (reverse (cddr entLst)))
 (if (setq file (getfiled "Create or Select an Excel File" "C:\\" "csv" 9))
   (progn
     (setq ofile (open file "w"))
     (foreach e entLst
   (write-line (rtos (cdr (assoc 42 (entget e))) 2 4) ofile))
     (close ofile))
   (princ "\nNo File Selected"))
 (*error* "")
 (princ))

Posted

Thanks Lee

 

There is sometimes "zero" value in figures generated in DIMCONTINUE! (Perhaps because when line dimension is smaller than a certain amount?). We need figures, even in very small unit.

 

Regards,

MJ

Posted

OK then:

 

(defun c:exdim (/ *error* oldvars varlist entLst file ofile)
 (vl-load-com)
 (defun *error* (msg)
   (if oldvars (mapcar 'setvar varlist oldvars))
   (if (= msg "")
     (princ "\n< Function Complete >")
     (princ (strcat "\nError: " (strcase msg))))
   (princ))
 (setq varlist (list "CMDECHO")
   oldvars (mapcar 'getvar varlist))
 (setvar "cmdecho" 0)
 (prompt "\nSelect Base Dimension > ")
 (command "_dimcontinue" "S")
 (while (> (getvar "CMDACTIVE") 0) (command pause)
   (setq entLst (cons (entlast) entLst)))
 (setq entLst (reverse (cddr entLst)))
 (if (setq file (getfiled "Create or Select an Excel File" "C:\\" "csv" 9))
   (progn
     (setq ofile (open file "w"))
     (foreach e entLst
   (write-line (rtos (cdr (assoc 42 (entget e)))) ofile))
     (close ofile))
   (princ "\nNo File Selected"))
 (*error* "")
 (princ))

Posted
OK then:

 

(defun c:exdim (/ *error* oldvars varlist entLst file ofile)
 (vl-load-com)
 (defun *error* (msg)
   (if oldvars (mapcar 'setvar varlist oldvars))
   (if (= msg "")
     (princ "\n< Function Complete >")
     (princ (strcat "\nError: " (strcase msg))))
   (princ))
 (setq varlist (list "CMDECHO")
   oldvars (mapcar 'getvar varlist))
 (setvar "cmdecho" 0)
 (prompt "\nSelect Base Dimension > ")
 (command "_dimcontinue" "S")
 (while (> (getvar "CMDACTIVE") 0) (command pause)
   (setq entLst (cons (entlast) entLst)))
 (setq entLst (reverse (cddr entLst)))
 (if (setq file (getfiled "Create or Select an Excel File" "C:\\" "csv" 9))
   (progn
     (setq ofile (open file "w"))
     (foreach e entLst
   (write-line (rtos (cdr (assoc 42 (entget e)))) ofile))
     (close ofile))
   (princ "\nNo File Selected"))
 (*error* "")
 (princ))

Thanks Lee Mac, but can you add an option to save dim text in Rows or Columns please.

Posted

This provides the option for Column Delimited:

 

(defun c:exdim    (/ *error* oldvars varlist entLst file ans ofile)
 (vl-load-com)
 (defun *error*  (msg)
   (if    oldvars
     (mapcar 'setvar varlist oldvars))
   (if    (= msg "")
     (princ "\n< Function Complete >")
     (princ (strcat "\nError: " (strcase msg))))
   (princ))
 (setq    varlist    (list "CMDECHO")
   oldvars    (mapcar 'getvar varlist))
 (setvar "cmdecho" 0)
 (prompt "\nSelect Base Dimension > ")
 (command "_dimcontinue" "S")
 (while (> (getvar "CMDACTIVE") 0)
   (command pause)
   (setq entLst (cons (entlast) entLst)))
 (setq entLst (reverse (cddr entLst)))
 (if (setq file (getfiled "Create or Select an Excel File" "C:\\" "csv" 9))
   (progn
     (setq ofile (open file "w"))
     (initget 1 "Rows Columns")
     (setq ans (getkword "\nRow or Column Delimited? "))
     (cond ((= ans "Rows")
        (foreach e     entLst
          (write-line (rtos (cdr (assoc 42 (entget e)))) ofile)))
       ((= ans "Columns")
        (setq entLst
           (apply 'strcat
              (mapcar '(lambda (d)
                     (strcat
                   (rtos (cdr (assoc 42 (entget d))))
                   (chr 44)))
                  entLst)))
        (write-line entLst ofile)))
     (close ofile))
   (princ "\nNo File Selected"))
 (*error* "")
 (princ))

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