Jump to content

Recommended Posts

Posted

Using exit function with cancel tile without handling the concequences should leave your device very lazy very soon.

Posted

@Tharwat: is this code working fine for you?

Posted
34 minutes ago, GLAVCVS said:

@Tharwat: is this code working fine for you?

I don't recommend testing such spaghetti codes copied from here and there and for the sake of increasing the number of posts.

Posted (edited)

Whether it's 'spaghetti' code or 'Made in myself' code, what matters is that, on this forum, there are people who spend part of their time trying to help other people.

And that's worth more than the best code.

🙂

Edited by GLAVCVS
Posted
On 2/9/2025 at 7:21 AM, GLAVCVS said:

If this is so, there is still another possibility....
Does anyone know how to find out the structure of these .ods files?

I posted a few links on LibreOffice and the source code from Sun Microsystems.

 

I still do not believe LISP is the best approach for AutoCAD. Autodesk seems to want only MS Office products accessible, a BricsCAD solution would still be nice.

 

When I can get back to working on programming, I am still going to look at a VBA, Python and/or C# solution. I might give LISP one more try.

 

I may have posted this, but any way. Calc Macros   Calc API overview.

Posted
3 hours ago, SLW210 said:

Publiqué algunos enlaces sobre LibreOffice y el código fuente de Sun Microsystems.

 

Todavía no creo que LISP sea la mejor opción para AutoCAD. Autodesk parece querer que solo los productos de MS Office sean accesibles, pero una solución BricsCAD sería buena.

 

Cuando pueda volver a trabajar en programación, seguiré buscando una solución en VBA, Python o C#. Quizás le dé otra oportunidad a LISP.

 

Es posible que haya publicado esto, pero de todos modos. Macros de Calc    Descripción general de la API de Calc .

 

Thanks

I found out that Libreoffice files are compressed in zip and that the contents of the tables are saved in an xml called 'content.xml'

 

Posted (edited)

@SLW210 the code posted was tested in Bricscad V24.

 

; https://www.cadtutor.net/forum/topic/79565-autocad-use-libreoffice-instead-of-excel/page/3/

; CAD to LIbre Calc subfunctions
; Version 1.0 Feb 2025 By Alan H
; Version 1.1 Feb 2025 By Alan H Blank or new dcl added
; Version 1.x ????

(vlax-invoke-method (vlax-invoke-method (list oController 'setActiveSheet 'name "Sheet1"))

(defun libgetcurrsheet ( / )
(setq oSheet (vl-catch-all-apply 'vlax-invoke-method (list oController 'getActiveSheet)))
(setq shname (vlax-get osheet 'Name))
)

; (vlax-get-property (vlax-get-property ocontroller 'activesheet) 'name)

(defun libsetactivesheet (sheetname / )
(setq mySheet (vl-catch-all-apply 'vlax-get-property (list (vlax-get-property ocontroller "Sheets") "Item" sheetName)))
(vlax-invoke-method mySheet "Activate")

; not working
(defun libsheets ( / osheets cnt)
(setq oSheets (vlax-get-property oCalcdoc 'Sheets))
(setq cnt (vlax-get osheets 'count))

; need a get item here for names of sheets
)

(defun libgetusedrange ( / )
(setq uRange	(if (and (not (vl-catch-all-error-p
		(setq oCursor (vl-catch-all-apply 'vlax-invoke-method
						  (list oSheet 'createCursor)
			      )
		)
	      )
	 )
	 (not (vl-catch-all-error-p
		(vl-catch-all-apply 'vlax-invoke-method
				    (list oCursor 'gotoEndOfUsedArea 0)
		)
	      )
	 )
	 (not (vl-catch-all-error-p (setq oEndOfUsedArea
					   (vl-catch-all-apply 'vlax-invoke-method
							       (list oCursor 'getRangeAddress)
					   )
				    )
	      )
	 )
    )
  (list	0
	0
	(vlax-get oEndOfUsedArea 'EndColumn)
	(vlax-get oEndOfUsedArea 'EndRow)
  )
  )
)
(princ urange)
(princ)
)

; crange column row as list (2 2)
(defun libgetcell (crange / orange)
(setq oRange (vl-catch-all-apply 'vlax-invoke-method (cons oSheet (cons 'getCellByPosition crange))))
(setq cellval (vl-catch-all-apply 'vlax-invoke-method (list oRange 'getvalue)))
(princ cellval)
(princ)
)

; crange column row  column row as list (0 0 2 7)
(defun libgetrange (brange / orange data ar arr arl x)
(setq oRange (vl-catch-all-apply 'vlax-invoke-method (cons oSheet (cons 'getCellrangeByPosition brange))))
(setq Data (vl-catch-all-apply 'vlax-invoke-method (list oRange 'getDataArray)))
(princ "\nBeing worked on now")
)

; crange column row as list (2 2)
(defun libputcell (crange val / orange)
(setq oRange (vl-catch-all-apply 'vlax-invoke-method (cons oSheet (cons 'getCellByPosition crange))))
(vl-catch-all-apply 'vlax-invoke-method (list oRange 'setvalue val))
; (vlax-put-property orange 'value val)
(princ)
)

; defun change borders not working
(defun libborders (brange / )
(setq oRange (vl-catch-all-apply 'vlax-invoke-method (cons oSheet (cons 'getCellrangeByPosition brange))))
(setq brds (vl-catch-all-apply 'vlax-invoke-method (cons 'getBorder orange)))
(vlax-put-property brds 'LineStyle 1)
)

; Thanks to Tim_n for this code via Bricscad forums
; defun get a range of cells to a List
; (setq lst (STARCALCSHEET-GETLISPARRAY osheet 0 0 2 7))

(defun librange2list (calcheet col1 row1 col2 row2)
(defun AxVariant-Value (o) (vlax-variant-value o))
(defun AxSafeArray->List (o) (vlax-SafeArray->list o))
(defun AxVariant->List (o) (vlax-SafeArray->list (vlax-variant-value o)))
(defun starDataArray->LispArray (dataArray / rows lArray)
(setq rows (AxVariant->List dataArray))
(foreach row (mapcar 'AxVariant->List rows)
(setq lArray (cons (mapcar 'AxVariant-value row) lArray))
)
(reverse lArray)
)
(defun starCalcRange-getDataArray (calcRange ) (vlax-invoke-method calcRange "getDataArray"))
(defun starCalcSheet-getCellByPosition (calcSheet col row)
(setq col (if col col 0) row (if row row 0))
(vlax-invoke-method calcSheet "getCellByPosition" (vlax-make-variant col vlax-vbLong) (vlax-make-variant row vlax-vbLong))
)
(defun starCalcSheet-getCellRangeByPosition (calcSheet left top right bottom )
(vlax-invoke-method calcSheet "getCellRangeByPosition" (vlax-make-variant left vlax-vbLong) (vlax-make-variant top vlax-vbLong) (vlax-make-variant right vlax-vbLong) (vlax-make-variant bottom vlax-vbLong))
)
(defun starCalcSheet-getLispArray (calcSheet left top right bottom )
(starDataArray->LispArray (starCalcRange-getDataArray (starCalcSheet-getCellRangeByPosition calcSheet left top right bottom )))
)
(princ)
)

;;;;;;;;;;;;;;;;;;; starts here ;;;;;;;;;;;;;;;;;;;;

(defun openlibre ( / )

(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "AHbutts : dialog 	{" fo)
(write-line "	label =\"Please choose\" ;" fo)
(write-line "	: row	{" fo)
(write-line "	: boxed_radio_column 	{" fo)
(write-line " width = 22 ;" fo)
(write-line "	: radio_button	{" fo)
(write-line "key = \"Rb1\"; " fo)
(write-line "label = \"Blank sheet\";" fo)
(write-line "	}" fo)
(write-line "spacer_1 ;" fo)
(write-line "	: radio_button	{" fo)
(write-line "key = \"Rb2\"; " fo)
(write-line "label = \"File\"; " fo)
(write-line "	}" fo)
(write-line "spacer_1 ;" fo)
(write-line "	}" fo)
(write-line "	}" fo)
(write-line "spacer_1 ;" fo)
(write-line "	ok_cancel;" fo)
(write-line "	}"  fo)
(close fo)
(setq dcl_id (load_dialog fname))
(if (not (new_dialog "AHbutts" dcl_id) )
(exit)
)
(set_tile "Rb1" "1")

(action_tile "accept" "(setq ans (get_tile \"Rb1\" ))(done_dialog)")
(action_tile "cancel" "(done_dialog)(exit)")
(start_dialog)
(unload_dialog dcl_id)
(vl-file-delete fname)

(if (= ans "1")
 (setq FileName "D:\\acadtemp\\blank.ods")
 (setq filename (getfiled "ODS or XLS" "d:\\" "ods,xls" 16))
)

(setq oServiceManager (vlax-get-or-create-object "com.sun.star.ServiceManager"))
(setq oDesktop (vl-catch-all-apply
	     'vlax-invoke-method
	     (list oServiceManager 'createInstance "com.sun.star.frame.Desktop")
	   )
)
(setq oCalcDoc (vl-catch-all-apply
   'vlax-invoke-method
   (list oDesktop
   'loadComponentFromURL
   (strcat "file:///" (vl-string-translate "\\" "/" FileName))
   "_blank"
   0
   (vlax-make-safearray vlax-vbObject (cons 0 0))
   )
 )
)
(setq oController (vl-catch-all-apply 'vlax-invoke-method
    (list oCalcDoc 'getCurrentController)
	)
)
(setq oSheet (vl-catch-all-apply 'vlax-invoke-method (list oController 'getActiveSheet)))

(princ)
)

 

Edited by BIGAL
  • 2 months later...
Posted

Still working on this, I believe my main troubles are trying to use AutoCAD 2000i at home, or at least some of the errors I am getting relate to having an older AutoCAD. Plus I had to convert the supplied sample drawing and the blocks were anonymous blocks which I had to fix. Still get proxy object  warnings.

 

My next step will be to 1. see if  our IT can load up LibreOffice so I can properly test or 2. see what my AutoCAD 2000i is lacking to run this code or 3. get Bricscad at home to get a working Bricscad version.

 

At one point I have it opening Calc file, so maybe it can be solved with LISP?

My latest effort...

 

;;; Export block attributes to CSV, edit in LibreOffice Calc, then reimport.                                                                           |
;;;                                                                                                                                                    |
;;; https://www.cadtutor.net/forum/topic/79565-autocad-use-libreoffice-instead-of-excel/#comment-628512                                                |
;;;                                                                                                                                                    |
;;; By SLW210 (a.k.a. Steve Wilson)                                                                                                                    |
;;;                                                                                                                                                    |
;;; April 1st 2025 (no joke)                                                                                                                           |
;;;****************************************************************************************************************************************************|
;;;                                                                                                                                                    |
;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
;;;                                                                                                                                                    |
;;; Notes:                                                                                                                                             |
;;;                                                                                                                                                    |
;;; Adjust the file path to where LibreOffice is installed on your system and ensure you provide the correct path for the CSV file.                    |
;;;                                                                                                                                                    |
;;; Ensure the CSV file structure is compatible with how you want to parse and update your attributes.                                                 |
;;;                                                                                                                                                    |
;;; This approach assumes a manual process for modifying the attributes in LibreOffice Calc                                                            |
;;;                                                                                                                                                    |
;;; If you want to automate it further, delve into LibreOffice's scripting, which requires additional setup (e.g., using Python or LibreOffice Basic). |
;;;                                                                                                                                                    |
;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||




(defun c:ACAD2Calc (/ csv-file)

  ;;Export attributes to CSV ---
  (defun export-attributes-to-csv (csv-file / file ss i ent blk data)
    (setq file (open csv-file "w"))
    (if file
      (progn
        (setq ss (ssget "X" '((0 . "INSERT"))))
        (if ss
          (repeat (setq i (sslength ss))
            (setq ent (ssname ss (setq i (1- i))))
            (setq blk (entget ent))
            (foreach data blk
              (if (= (car data) 1) ; Attribute Text (DXF code 1)
                (write-line (strcat (cdr (assoc 2 blk)) "," (cdr data)) file)
              )
            )
          )
          (princ "\nNo blocks found.")
        )
        (close file)
        (princ (strcat "\nAttributes exported to: " csv-file))
      )
      (princ "\nFailed to open CSV file for writing.")
    )
  )

  ;;Open LibreOffice Calc ---
  (defun open-libreoffice-calc (csv-file)
    (startapp "C:/Program Files/LibreOffice/program/scalc.exe" csv-file) ; path to LibreOffice Calc (this is the default I think)
    (princ (strcat "\nLibreOffice Calc opened with file: " csv-file))
  )

  ;;Import attributes from CSV ---
  (defun import-attributes-from-csv (csv-file / file line parts blk-name new-attr-value ss i ent blk data new-blk modified)
    (setq file (open csv-file "r"))
    (if file
      (progn
        (while (setq line (read-line file))
          (setq parts (vl-string-split line ","))
          (setq blk-name (nth 0 parts))
          (setq new-attr-value (nth 1 parts))
          (setq ss (ssget "X" (list (cons 2 blk-name))))
          (if ss
            (repeat (setq i (sslength ss))
              (setq ent (ssname ss (setq i (1- i))))
              (setq blk (entget ent))
              (setq modified nil)
              (setq new-blk
                (mapcar
                  (function
                    (lambda (data)
                      (if (= (car data) 1)
                        (progn
                          (setq modified T)
                          (cons 1 new-attr-value)
                        )
                        data
                      )
                    )
                  )
                  blk
                )
              )
              (if modified
                (progn
                  (entmod new-blk)
                  (entupd ent)
                )
              )
            )
          )
        )
        (close file)
        (princ (strcat "\nAttributes imported from: " csv-file))
      )
      (princ "\nFailed to open CSV file for reading.")
    )
  )

  ;;Main process

  ;; Ask for CSV file location
  (setq csv-file (getfiled "Select or Create CSV File" (getvar "DWGPREFIX") "csv" 1))

  (if csv-file
    (progn
      (export-attributes-to-csv csv-file)
      (open-libreoffice-calc csv-file)
      (princ "\nMake changes to the CSV file, save it, then close LibreOffice Calc.")
      (princ "\nPress [Enter] when you're done editing.")
      (getstring)
      (import-attributes-from-csv csv-file)
    )
    (princ "\nNo CSV file selected.")
  )

  (princ)
)

;; End of ACAD2Calc.lsp

 

So for now, if I could get some feedback it may help.

Posted
On 2/10/2025 at 11:54 AM, GLAVCVS said:

 

Thanks

I found out that Libreoffice files are compressed in zip and that the contents of the tables are saved in an xml called 'content.xml'

 

That is correct, I didn't quite get what you were after.

 

I do believe LibreOffice can be made to automatically create csv from .ods and vice versa.

 

Maybe within a LISP?

 

We should be able to use LibreOffice's UNO API (Universal Network Objects) via  macros or a small script?

 

(setq cmd (strcat "soffice --headless --convert-to ods \"" csvfile "\" --outdir \"" tempfolder "\""))
      (startapp "cmd.exe" (strcat "/C " cmd)

 

 Open the .ODS file after a few seconds (give LibreOffice time)
 

      (vl-cmdf "delay" 500) ;; small wait
      (startapp "soffice" (strcat "\"" odsfile "\""))
    )

 

Off and on several years now trying to use AutoCAD and OpenOffice/LibreOffice, unfortunately some of my old links are dead now and some I forgot or lost the links.

 

After researching my errors here lately, seems AutoCAD 2000i could have had me reworking what potentially could be good code.

 

Fortunately, seems there are several asking these questions now, maybe get better answers.

  • Agree 1
Posted

I considered doing something to work directly with the OBS file, but this is like "shooting flies with a cannon."
So I think your option is better: work with a CSV as a bridge file.

PS: I don't think 'vl-string-split' will work in ACAD 2000.

  • Like 1
Posted

By the way: I'm still using AutoCAD 2002. If I have to run code to process thousands of objects, the processing speed is 4/5 times faster.

  • Thanks 1
Posted
1 hour ago, GLAVCVS said:

By the way: I'm still using AutoCAD 2002. If I have to run code to process thousands of objects, the processing speed is 4/5 times faster.

 

9 hours ago, GLAVCVS said:

I considered doing something to work directly with the OBS file, but this is like "shooting flies with a cannon."
So I think your option is better: work with a CSV as a bridge file.

PS: I don't think 'vl-string-split' will work in ACAD 2000.

 

One error I had was for a vlax as well, but not recalling it, at work now, try to find if I saved the exact errors at home.

 

I wish I had kept my AutoCAD 14, I hang on to the 2000i, 1. because it's paid for and still works okay on Windows 10, 2. It seems to work faster as you mention.

 

I think once again I'll go back to fixo's code and see if I can incorporate using Calc.

 

Another option (I started down this path a while back as well) try to use Calc's Basic to interact with AutoCAD.

 

If I can't get LISP to work fully I may also go back to the Python route or some other language eventually.

 

Here is a UNO reference if interested...LibreOffice Developer's Guide: Chapter 5 - Advanced UNO - The Document Foundation Wiki

 

Info on getting at Calc... LibreOffice Developer's Guide: Chapter 8 - Spreadsheet Documents - The Document Foundation Wiki

Posted
36 minutes ago, SLW210 said:

 

 

One error I had was for a vlax as well, but not recalling it, at work now, try to find if I saved the exact errors at home.

 

I wish I had kept my AutoCAD 14, I hang on to the 2000i, 1. because it's paid for and still works okay on Windows 10, 2. It seems to work faster as you mention.

 

I think once again I'll go back to fixo's code and see if I can incorporate using Calc.

 

Another option (I started down this path a while back as well) try to use Calc's Basic to interact with AutoCAD.

 

If I can't get LISP to work fully I may also go back to the Python route or some other language eventually.

 

Here is a UNO reference if interested...LibreOffice Developer's Guide: Chapter 5 - Advanced UNO - The Document Foundation Wiki

 

Info on getting at Calc... LibreOffice Developer's Guide: Chapter 8 - Spreadsheet Documents - The Document Foundation Wiki

 

Thanks for those links.
I'll take a look with great curiosity.

 

This may seem crazy, but my intention was to write something to decompress the ODS from Visual Lisp directly, without calling (startapp "7z.exe") and interact directly with the XML. It's a self-contained, brute-force project, but I ran into an even bigger hurdle: LibreOffice ODS are compressed with 'deflate'.

For this reason, I've shelved this project.

 

As for your code, if you attach a test drawing with some of the blocks you've written the code for, I'll run tests for it as well.

  • Like 1
Posted

UNO might do that, I am already fogging my brain with learning new programming languages, not ready to dig deeper in UNO as of now.

 

I forgot to put my work from home on a thumb drive to bring to work. Maybe I'll have time tonight to sort some issues.

 

I have been looking at what some have been doing for a while now, using Python in Excel and Calc instead of VBA for Macros.

 

I need to go back over all of BIGAL's work as well. My workload should be slack for a couple of month's now and my after wok and weekends should be less busy with the grandkids sports activities coming to and end.

 

I have been using the before and after from the OP Test.7z

 

Posted

I'll try to work more for automated export/import when I have time at home, maybe I can get LibreOffice at work.

 

I decided to fall back to some of my original work, and kill some time today.

 

I also think I figured out the issue with AutoCAD 2000i, I added the (vl-load-com) to the LISP.

 

I just reinstalled it on the new computer and may not have acaddoc path loaded.

 

I may also need to run the lspfix.reg, I have received errors at work on some LISPs that show that as the solution.

 

Probably already a better way, but original request was for .csv from fixo's code....

Part 1.

Making the .csv...

 

;;; batch export title blocks into Calc                                                    |
;;;                                                                                        |
;;; BTCalc.lsp                                                                             |
;;;                                                                                        |
;;; Modified By SLW210 (a.k.a. Steve Wilson)                                               |
;;;                                                                                        |
;;; From Fatty's (a.k.a. fixo) btex.lsp V-original header below-V                          |
;;;                                                                                        |
;;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

;;btex.lsp                                                                                 
;;                                                                                         
;; batch export title blocks into the Excel                                                
;;                                                                                         
;; local defun ;;                                                                          
;; http://discussion.autodesk.com/thread.jspa?messageID=5370521                            
;; by Fatty (fixo)                                                                         

(vl-load-com)

(defun C:BTCalc (/ *error* abks acapp adoc
                  adocs atts att_data blkname blockname
                  block_name cnt col dir display drawings exc_data
                  find fonto headers inter preferences row
                  strvalues tmp x xlpath)

  ;; Error handling function
  (defun *error* (msg)
    (if (vl-position msg '("console break" "Function cancelled" "quit / exit abort"))
      (princ "Error!")
      (princ msg))
    (if (and acapp (not (vlax-object-released-p acapp)))
      (vl-catch-all-apply 'vlax-release-object (list acapp)))
    (vl-exit-with-value "Program bombed, sorry")
  )

  ;; Set the file dialog
  (setvar "filedia" 1)

  ;; Collect Block Name and Directory
  (setq blkname (getstring T "\nEnter block name: "))
  (setq dir (getfiled "* Select any drawing in a directory *" "" "dwg" 4))

  ;; Check if Directory is valid
  (if (and blkname dir)
    (progn
      (setq dir (vl-filename-directory dir))

      (if (setq drawings (directoryfiles dir "*.dwg"))
        (progn
          ;; Initialize variables
          (setq exc_data nil)
          (alert "   Be patient ...\n   Wait, please...")

          ;; Create AutoCAD application object
          (setq acapp (vlax-create-object
                        (strcat "AutoCAD.Application."
                                (itoa (fix (atof (getvar "acadver")))))))


          (vlax-put-property acapp "Visible" :vlax-true)
          (setq preferences (vla-get-preferences acapp))
          (setq display (vla-get-display preferences))
          (vlax-put-property display "MaxAutoCADWindow" :vlax-true)
          (setq adocs (vla-get-documents acapp))
          (setq cnt 0)

          ;; Process Drawings
          (foreach drawing drawings
            (setq adoc (vla-open adocs drawing :vlax-false))
            (vlax-for layout (vla-get-layouts adoc)
              (vlax-for obj (vla-get-block layout)
                (if (and (eq "AcDbBlockReference" (vla-get-objectname obj))
                         (eq (setq block_name
                                   (if (= (vlax-get-property obj 'IsDynamicBlock) :vlax-true)
                                       (vla-get-effectivename obj)
                                       (vla-get-name obj)))
                             blkname)
                         (eq :vlax-true (vla-get-hasattributes obj)))
                    (progn
                      (if (= cnt 0)
                        (setq headers (append (list "Drawing Name"
                                                    "Layout Name"
                                                    "Handle"
                                                    "Block Name") headers)))

                      (setq att_data (append (list drawing
                                                   (vla-get-name layout)
                                                   (vla-get-handle obj)
                                                   blkname)
                                             att_data))

                      (setq atts (vlax-invoke obj 'GetAttributes))
                      (foreach att atts
                        (if (= cnt 0)
                          (setq headers (append headers (list (vla-get-tagstring att)))))
                        (setq att_data (append att_data (list (vla-get-textstring att)))))


                      (setq exc_data (append (list att_data) exc_data))
                      (setq att_data nil)
                      (setq cnt (1+ cnt))))))

            ;; Close drawing
            (vla-close adoc :vlax-false))

          ;; Quit AutoCAD application
          (vlax-invoke-method acapp "Quit")

          ;; Release AutoCAD COM objects
          (mapcar
            (function (lambda (x)
                        (vl-catch-all-apply
                          (function (lambda ()
                                      (if x (vlax-release-object x)))))))
            (list adocs acapp))

          ;;=============================== CSV Export ====================================
          (setq xlpath (strcat (getvar "dwgprefix")
                               (vl-filename-base (getvar "dwgname"))
                               ".csv"))
          (setq file (open xlpath "w"))

          (defun write-csv-line (lst sep)
            (write-line
              (apply 'strcat
                     (mapcar (function (lambda (s) (strcat "\"" s "\"" sep)))
                            lst))
              file))

          ;; Write headers and data
          (write-csv-line headers ",")
          (foreach row-data exc_data
            (write-csv-line row-data ","))

          ;; Close CSV file
          (close file)

          (alert (strcat "Data exported to:\n"
                         xlpath
                         "\nYou can open it with LibreOffice Calc."))

          ;;===============================================================================

        ) ;; End of drawings processing
      ) ;; End of directory checking
    ) ;; End of blkname and dir checking
  ) ;; End of overall if condition

  (gc)
  (gc)
  (*error* nil)
  (prin1)
)

(prompt "\n\t\t>>>\tType BTCalc to batch export title blocks into a CSV for LibreOffice Calc\t<<<")
(prin1)

 

Results...

E1.3.2_DOCE DE OCTUBRE.csv

Posted
7 hours ago, GLAVCVS said:

 

...

This may seem crazy, but my intention was to write something to decompress the ODS from Visual Lisp directly, without calling (startapp "7z.exe") and interact directly with the XML. It's a self-contained, brute-force project, but I ran into an even bigger hurdle: LibreOffice ODS are compressed with 'deflate'.

For this reason, I've shelved this project.

...

 

 

You can manipulate an .ods file using Python with odfpy or pyexcel-ods.

 

I also found this page in my searches...python - How to convert OpenDocument spreadsheets to a pandas DataFrame? - Stack Overflow

 

 

Posted (edited)

"my intention was to write something to decompress the ODS" as the ODS file is a zipped xml have you tried this in lisp. It will unzip the ODS to a directory.

 

You need to copy ODS and rename to zip. Use vl file copy, must be a ZIP file.

 

(vl-mkdir "c:\\CAD-TOOLS")

(setq filename (getfiled "Select the File \"CAD-TOOLS-SEP-2022\"" "" "ZIP" 16))

; unzip
(startapp (strcat "powershell -command Expand-Archive -Path '" filename "' -DestinationPath 'C:/CAD-TOOLS' -FORCE"))
(alert "programs unzipped to C:/CAD-TOOLS")

 

 

Edited by BIGAL
  • Like 1
Posted

@SLW210 An important question: Does your version of AutoCAD 2000 expose axdb15.dll?

Posted
58 minutes ago, GLAVCVS said:

@SLW210 An important question: Does your version of AutoCAD 2000 expose axdb15.dll?

 

I'll have to check when I can, might be a few days before I have time at home.

 

I think there were some fixes around from my quick research. I had the same issue with a LISP at work, Autodesk directed me to the lspfix.reg. I still haven't had IT install it.

 

I think the solution is to check into getting Bricscad or similar, maybe start with a trial of AutoCAD at home. Though I actually would like to run this with AutoCAD 2000i for simplicity.

 

I'll try my old computer, I had Windows 10 stripped and running better on it, do not recall these errors on it, maybe I fixed them a while ago. 

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