Jump to content

Recommended Posts

Posted

I have tried what you have passed in LibreOffice and it gives error (attached images).

 

Alan1.png.0b9a552fa0b99d933213e42bc258ccd3.png

 

Alan2.png.823eaba75f78e475d772ef8fca7888ba.png

 

Alan3.png.be3552853cc5693655fffdccee51de38.png

 

Posted

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?

Posted

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.

 

 

Posted (edited)

Opendwg is running with problems.

AutoCAD opens but this error appears in LibreOffice 

 

image.png.9ddb97220c1d20688e773dffdc14779f.png

 

I will try to get some response from LibreOffice, I will keep you posted.

Edited by Truski
Posted

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.

Posted

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.

Posted (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 by BIGAL
  • Like 1
Posted
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

Posted
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

 

Posted

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

Posted

I just tested your modified file and I still get the errors when creating line, circle and pline.

 

image.png.4de107809216a303a4cb0b2aca4374d5.png

 

image.png.b7eb542999a91ff3ad851a05b79ad772.png

 

image.png.f7a756444c2056f0b7f53e6f58c1955b.png

Posted

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.

  • Like 1
Posted

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.

  • Like 1
Posted (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 by BIGAL
Posted

I'll try to have a look at home sometime. Not tonight though, it's Valentine's Day.

  • 2 weeks later...
Posted (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 by BIGAL
Posted

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

Posted

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.

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