Truski Posted February 7 Author Posted February 7 I have tried what you have passed in LibreOffice and it gives error (attached images). Quote
Steven P Posted February 7 Posted February 7 I am not up to speed with that but in the (, "AutoCAD. Application") line the ',' looks odd and out of place as if there is something missing before it or it shouldn't be there? Quote
BIGAL Posted February 8 Posted February 8 It looks like Librecad calc does not support "get Application". Remove all the Line arc pline code and only leave the open dwg macro and try again. Similar problem with LT 2024 does not support Get Application. I googled "Contact Libreoffice" and got some where quickly, but needed to make an account, so stopped, as your a user you can ask about Libreoffice and Autocad interactivity if possible, or post the get application line asking can this be done. Then let us know. Quote
Truski Posted February 8 Author Posted February 8 (edited) Opendwg is running with problems. AutoCAD opens but this error appears in LibreOffice I will try to get some response from LibreOffice, I will keep you posted. Edited February 8 by Truski Quote
SLW210 Posted February 8 Posted February 8 I have created a new thread. Please read what I have previously posted in regards to using AutoCAD and LibreOffice. Did you even try using ATTOUT and ATTIN? AFAIK, it shouldn't matter what editor you are using. On 2/2/2024 at 6:59 AM, Truski said: Hi SLW210, what I want to do is exactly what fixo LISPs do: 1- I have many DWG files with a block with attributes. 2 - I want to export all the attributes of that block to a CSV or TXT file so I can modify their values. 3 - I want to be able to import this CSV or TXT file to change the attributes I have previously modified. I don't know if I have explained myself well, sorry for my English Thank you very much You never mention what exactly you are try to do with LibreOffice. You should be able create the .txt file from AutoCAD with ATTOUT and then import the .txt file to LibreCalc and export it after modification and ATTIN to AutoCAD. Quote
Truski Posted February 8 Author Posted February 8 Hi SLW210, I read what you posted about AutoCAD and LibreOffice, they don't get along well.... That's why I said if it could be exported to a CSV or TXT file, so as not to depend on Excel (I don't have it). The ATTOUT and ATTIN commands I know and use them, but in this particular case I would have to go file by file executing those commands and it would take a long time since there are 200 or 300 DWG that I have to modify, that's why I wanted something a little more automatic... I intended that the two fixo files could be used in some free software, such as LibreOffice, and not depend on Excel. Quote
SLW210 Posted February 8 Posted February 8 See if LEE MAC Batch Attribute Editor | AutoCAD | Autodesk App Store can work for you. AutoCAD does not interface with LibreOffice at all AFAIK. Please post some before and after .dwg and .txt files. there might be another way. Quote
BIGAL Posted February 8 Posted February 8 (edited) I posted an extra line above but not there it was a get application for libreoffice not on pc at moment will resend. Found it after googling a bit. Maybe another forum ? Need it tested in ACAD (setq libre (vlax-get-or-create-object "com.sun.star.ServiceManager")) Also in the Excel macro, 'Check if the active space is paper space and change it to model space. If acadDoc.ActiveSpace = 0 Then Set acadDoc.ActiveSpace = 1 '0 = acPaperSpace in early binding '1 = acModelSpace in early binding End If I am thinking maybe go to Librecad calc as Excel and Word have become expensive for a casual user. Edited February 9 by BIGAL 1 Quote
Truski Posted February 9 Author Posted February 9 13 hours ago, SLW210 said: See if LEE MAC Batch Attribute Editor | AutoCAD | Autodesk App Store can work for you. AutoCAD does not interface with LibreOffice at all AFAIK. Please post some before and after .dwg and .txt files. there might be another way. 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 Quote
Truski Posted February 9 Author Posted February 9 9 hours ago, BIGAL said: I posted an extra line above but not there it was a get application for libreoffice not on pc at moment will resend. Found it after googling a bit. Maybe another forum ? Need it tested in ACAD (setq libre (vlax-get-or-create-object "com.sun.star.ServiceManager")) Also in the Excel macro, 'Check if the active space is paper space and change it to model space. If acadDoc.ActiveSpace = 0 Then Set acadDoc.ActiveSpace = 1 '0 = acPaperSpace in early binding '1 = acModelSpace in early binding End If I am thinking maybe go to Librecad calc as Excel and Word have become expensive for a casual user. Hi BIGAL, yesterday I was passed a link about LibreOffice, it can be interesting but you have to know programming.... https://wiki.documentfoundation.org/Documentation/DevGuide/Professional_UNO#Automation_Bridge Quote
BIGAL Posted February 9 Posted February 9 I am trying to not install Libreoffice for testing, so please try this line in your Cad. Let me know what it returns, it is similar in link you posted. (setq libre (vlax-get-or-create-object "com.sun.star.ServiceManager")) Should return something like this #<VLA-OBJECT _Application 000000003EBA7658> I have updated the xl please give it a try again it should draw a line etc. draw object xl acad.xlsm Quote
Truski Posted February 12 Author Posted February 12 I just tested your modified file and I still get the errors when creating line, circle and pline. Quote
BIGAL Posted February 12 Posted February 12 The messages are not in English but looks like no Definition Getobject, I relied on help and googling to get to where it worked with Bricscad and Autocad. What did this return when copied to command line in Autocad, (setq libre (vlax-get-or-create-object "com.sun.star.ServiceManager")) Send me a Private mail with your email then we can chat with out clogging up Cadtutor. I will look at downloading Libreoffice calc. 1 Quote
SLW210 Posted February 13 Posted February 13 I didn't get anything on my home computer with LibreOffice. No lines and no errors, but I have AutoCAD 2000i at home. I still have doubts that anything will work, at least lower level programming. It's been a few years since I looked into this, though. I'll check more into at home when I can free up some time. Maybe something new has popped up in the last few years. 1 Quote
SLW210 Posted February 13 Posted February 13 I haven't had a chance to check this out, but poster marked as solved. Where can I find example for controlling AutoCAD? - English - Ask LibreOffice 1 Quote
BIGAL Posted February 13 Posted February 13 (edited) This is latest check, I dont have Libreoffice installed but may have to if I want to continue looking into it. This opens a link and appears to work. (setq libre (vlax-get-or-create-object "com.sun.star.ServiceManager")) Next step is what does these 3 lines return, paste to command line 1 at a time if 1st line fails then still not working. (vla-put-visible libre :vlax-true) (vlax-put-property libre 'ScreenUpdating :vlax-true) (vlax-put-property libre 'DisplayAlerts :vlax-true) Should have realised in VBA macro get application is wrong. So maybe, set acadapp = (getobject, "com.sun.star.ServiceManager") Will have chance next week to download libreoffice. Edited February 13 by BIGAL Quote
SLW210 Posted February 14 Posted February 14 I'll try to have a look at home sometime. Not tonight though, it's Valentine's Day. Quote
BIGAL Posted February 27 Posted February 27 (edited) I joined the libreoffice site to ask questions and put this together but not tested, the application link is of interest. Sub DrawRectangle() Dim AutocadApp As Object Dim AutocadDoc As Object Dim RectArray(0 To 9) As Double Dim Rectangle As Object '****** Launch Autocad application**** Set AutocadApp = createUnoService("com.sun.star.bridge.OleObjectFactory").createInstance("Autocad.application") 'If there is no active drawing create a new one. On Error Resume Next Set acadDoc = acadApp.ActiveDocument If acadDoc Is Nothing Then Set acadDoc = acadApp.Documents.Add End If On Error GoTo 0 ''****Point 1**** RectArray(0) = 0 RectArray(1) = 0 ''****Point 2**** RectArray(2) = ActiveSheet.Range("C6") RectArray(3) = 0 ''****Point 3**** RectArray(4) = ActiveSheet.Range("C6") RectArray(5) = ActiveSheet.Range("C7") ''****Point 4**** RectArray(6) = 0 RectArray(7) = ActiveSheet.Range("C7") ''****Point 5**** RectArray(8) = 0 RectArray(9) = 0 ''****Draw rectangle**** On Error Resume Next Set AutocadDoc = AutocadApp.ActiveDocument On Error GoTo 0 If AutocadApp Is Nothing Then Set AutocadDoc = AutocadApp.Document.App End If Set Rectangle = AutocadDoc.modelspace.addlightweightpolyline(RectArray) AutocadApp.ZoomExtents Set Rectangle = Nothing Set AutocadApp = Nothing Set AutocadDoc = Nothing End Sub Maybe this Set AutocadApp = createUnoService(“com.sun.star.bridge.OleObjectFactory”).createInstance(“Autocad.Application”) Not sure what this may do in lisp (setq myxl (vlax-get-or-create-object "com.sun.star.bridge.OleObjectFactory")) Hopefully gives #<VLA-OBJECT _Application 000000003DEC4758> Edited February 27 by BIGAL Quote
Truski Posted February 27 Author Posted February 27 Hi BIGAL, I don't know how to use this code you have put.... 6 hours ago, BIGAL said: Sub DrawRectangle() Dim AutocadApp As Object Dim AutocadDoc As Object Dim RectArray(0 To 9) As Double Dim Rectangle As Object '****** Launch Autocad application**** Set AutocadApp = createUnoService("com.sun.star.bridge.OleObjectFactory").createInstance("Autocad.application") 'If there is no active drawing create a new one. On Error Resume Next Set acadDoc = acadApp.ActiveDocument If acadDoc Is Nothing Then Set acadDoc = acadApp.Documents.Add End If On Error GoTo 0 ''****Point 1**** RectArray(0) = 0 RectArray(1) = 0 ''****Point 2**** RectArray(2) = ActiveSheet.Range("C6") RectArray(3) = 0 ''****Point 3**** RectArray(4) = ActiveSheet.Range("C6") RectArray(5) = ActiveSheet.Range("C7") ''****Point 4**** RectArray(6) = 0 RectArray(7) = ActiveSheet.Range("C7") ''****Point 5**** RectArray(8) = 0 RectArray(9) = 0 ''****Draw rectangle**** On Error Resume Next Set AutocadDoc = AutocadApp.ActiveDocument On Error GoTo 0 If AutocadApp Is Nothing Then Set AutocadDoc = AutocadApp.Document.App End If Set Rectangle = AutocadDoc.modelspace.addlightweightpolyline(RectArray) AutocadApp.ZoomExtents Set Rectangle = Nothing Set AutocadApp = Nothing Set AutocadDoc = Nothing End Sub I tried this line: 6 hours ago, BIGAL said: (setq myxl (vlax-get-or-create-object "com.sun.star.bridge.OleObjectFactory")) and it returns nil Quote
BIGAL Posted February 27 Posted February 27 The 1st code is a Libreoffice macro, if you don't know how to make VBA macro's we have problems. The idea is to see if Calc will control Autocad, Bricscad may work also but has a different application name. The second MYXL line is Autocad trying to open Libreoffice should get a application value displayed. I have left messages at Bricscad, Tech staff do respond by to this type of question. I have left a message at Libreoffice also. Quote
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.