BIGAL Posted February 27 Share Posted February 27 (edited) Getting somewhere, thanks to Virgil at Bricscad forum. There seems not to be much information on this topic. I could find a few articles (not all in english) with some references about how to connect from Calc to Autocad, using StarBasic. https://forums.autodesk.com/t5/vba/interconnection-between-autocad-and-libreoffice-calc-via-vba/td-p/9734036 https://cadxp.com/topic/43274-connection-libre-office-calc-et-autocad/ https://www.redchar.net/pages/?x=libreoffice-scrivere-dwg Regarding the reverse connection, I could only find this old forum post, but there is nothing specific. https://forum.bricsys.com/discussion/21458/libreoffice-calc-link-to-bricscad Lots of good code to look at can run VBA code from Lisp, but will probably look at convert the VBA to lisp. I guess may have to bite the bullet and down load Libreoffice calc if to go any further. Bit busy at moment, may just do some try to open code. definitely look at Creating DWG files with LibreOffice and progeCAD - Roberto Rossi (redchar.net) try the sample file, let me know how it goes. Edited February 27 by BIGAL Quote Link to comment Share on other sites More sharing options...
SLW210 Posted February 28 Share Posted February 28 I really don't see doing this at the LISP level. Really need to just use LISPs for generic text files and bypass Calc, IMHO. I looked at all of this a while ago, seems no major changes since then. LibreOffice also is not compatible with Microsoft VBA, it has it's own language, a version of BASIC. LibreOffice BASIC Programming Guide - The Document Foundation Wiki Quote Note: VBA : Compatibility between LibreOffice Basic and VBA relates to the LibreOffice Basic language as well as the runtime library. The LibreOffice API and the Dialog Editor are not compatible with VBA (standardizing these interfaces would have made many of the concepts provided in LibreOffice impossible). Import MS-Word Macros - English - Ask LibreOffice Quote Link to comment Share on other sites More sharing options...
Truski Posted February 28 Author Share Posted February 28 I don't want to waste any more of your time with this Thank you very much for everything... Quote Link to comment Share on other sites More sharing options...
SLW210 Posted February 28 Share Posted February 28 I wish I had more time to play with this. I do know Python can access Libre Office Calc and AutoCAD, not sure if you can do what you want with it. Python Scripts (libreoffice.org) Python : Programming with Python (libreoffice.org) Creating Python Scripts with ScriptForge (libreoffice.org) Quote Link to comment Share on other sites More sharing options...
SLW210 Posted February 28 Share Posted February 28 I did find a resource on LibreOffice macros and there is a lot for using Python. I think I need to download PyCharm, I'll have to see, I might have it. If interested in going with non-LISP solutions. OpenOffice.org Macro Information By Andrew Pitonyak Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 29 Share Posted February 29 (edited) Well this works for put cells try this using VBA in Acad or Bricscad. Opens a blank document and puts some values so a big success. Sub Main() 'VARIABLES: Dim obL_Service_Manager As Object Dim obL_Core_Reflection As Object Dim obL_Desktop As Object Dim srL_Url As String Dim obL_Calc_Document As Object Dim obL_Sheet As Object Dim obL_Range_First_Column As Object Dim obL_Range_ToSort As Object Dim a1L_Arguments() Dim lnL_iLast_Row As Long Dim lnL_iLast_Column As Long 'PROCESS: Set obL_Service_Manager = CreateObject("com.sun.star.ServiceManager") Set obL_Core_Reflection = obL_Service_Manager.createInstance("com.sun.star.reflection.CoreReflection") Set obL_Desktop = obL_Service_Manager.createInstance("com.sun.star.frame.Desktop") srL_Url = "private:factory/scalc" Set obL_Calc_Document = obL_Desktop.loadComponentFromURL(srL_Url, "_blank", 0, a1L_Arguments) Set obL_Sheet = obL_Calc_Document.Sheets.getByIndex(0) obL_Sheet.getCellRangeByName("A1").String = "PAPERINO" obL_Sheet.getCellRangeByName("C6").Value = 200 obL_Sheet.getCellRangeByName("C7").Value = 100 End Sub I did down load Libre office only way to work out anything. Next step is open a known Ods file. See srl = Edited February 29 by BIGAL Quote Link to comment Share on other sites More sharing options...
SLW210 Posted February 29 Share Posted February 29 No LibreOffice at work, maybe tonight I will have time at home. I am still reading through all of the information I have linked here. One of those sites has a link to a Sun Microsystems StarOffice programming guide which OpenOffice and LibreOffice is from the source code that was released, that's why all of (com.sun.star.) references. From what I have found on StarOffice, they had a Macro Converter for converting Microsoft Office VBA macros to StarOffice Basic. I am not sure if it was ever open sourced. There is an online converter, not sure how well it works... Excel VBA to OpenOffice Basic Converter Here is a PDF on converting VBA to StarBasic from OpenOffice VbaStarBasicXref.pdf I also found that adding option vbasupport 1 to the top of VBA code will work in some cases (newer releases). Quote Link to comment Share on other sites More sharing options...
SLW210 Posted February 29 Share Posted February 29 I would still like to see a before and after example of what exactly is being modified. There still may be a better method to get this done. Quote Link to comment Share on other sites More sharing options...
Truski Posted February 29 Author Share Posted February 29 Here I sent a sample of what it looks like before and after On 2/9/2024 at 9:34 AM, Truski said: Hi SLW210, I am familiar with the Batch Attribute Editor application from LEE MAC. It works very well but in my case not all attributes are the same, so I can't use that application. TEST.7z 1.98 MB · 3 downloads Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 29 Share Posted February 29 (edited) I amended the test code, removed the call to last row etc. If you go into VBAMAN and make a DVB can load it. Or do this, it should open a Calc sheet. The paperino is a string and the numbers are just that. (vl-vbaload "D:\\Acadtemp\\Libre\\test1.dvb") (vl-vbarun "Test1") Test1.dvb Edited February 29 by BIGAL Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 29 Share Posted February 29 Truski, next step is to work out how to do for multiple dwgs but only maintain 1 Libreoffice calc. Even with lisp this is not an easy task, simplest way is to use a script and make a csv file. Just google and you will find many examples. I will continue to play with Libreoffice calc and try to convert to VL. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.