VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get and Set Lisp Variable in AutoCAD 2015 64bit

11 REPLIES 11
Reply
Message 1 of 12
danfall
905 Views, 11 Replies

Get and Set Lisp Variable in AutoCAD 2015 64bit

Dim VL as object

If VL Is Nothing Then
 Set VL = CreateObject("VL.Application.20")
End If

 

I get an error code 429 when " Set VL = CreateObject("VL.Application.20")"  line of code is executed. Anyone else have this problem?

11 REPLIES 11
Message 2 of 12
danfall
in reply to: danfall

Also the Windows registry has listings for "vl.application.16" instead of "vl.application.20"   which may explain why I'm getting an error code 429 "Activex component can't create object" Has anyone else experienced this In AutoCAD 2015 64bit?

Message 3 of 12
owenwengerd
in reply to: danfall

The correct ProgId is VL.Application.16.

--
Owen Wengerd
ManuSoft
Message 4 of 12
danfall
in reply to: owenwengerd

Ok changed back to vl.application.16. Just installed Acad 2015 64 bit. Several sites indicated that it should be Progid - 20. I have a VBA app we've been using since Acad 2004 32 bit.ver. with no problems until now. Acad crashes if either the GetLispsym() or PutLisym() subs are executed to set or retrieve Lisp variables:

 

Sub PutLispSym(symbolName As String, value As String)
    'VL is set as a global obfect variable
    ''Dim VL As Object
    Dim sym As Object
   ON  Error Goto errhandler  

   Set VL = CreateObject("VL.Application.16")
    Set sym = VL.ActiveDocument.Functions.Item("read").funcall(symbolName)
   VL.ActiveDocument.Functions.Item("set").funcall sym, value  <------------------------------ ACAD crashes on this statement
errhandler:

   MsgBox "Error Number " & Err.Number & " " & Err.Description & " in PutLispSym Sub"
 

End sub

 

According to Acad documentation this should work fine in 64bit Acad and VBA 7.1

Upon crashing I've sent an error report to AutoDesk

Any suggesstions will be appreciated. If I can't get this to work I will have to keep an oder ver. of Acad so that we can run these legacy apps. Thanx

 

Message 5 of 12
owenwengerd
in reply to: danfall

I haven't tested your code, but some thoughts:

 

1) You should never use a vague phrase like "ACAD crashes" on a technical forum. If there's an exception, state it precisely and include the exception type (or better yet, copy and paste the complete exception information).

 

2) Your code assumes that VL.ActiveDocument returns an object. I don't think that's a safe assumption.

 

3) It would be much more robust to simply feed your lisp statement through the command throat. Is there some reason why you chose the COM approach over the more traditional approach?

--
Owen Wengerd
ManuSoft
Message 6 of 12
owenwengerd
in reply to: danfall

I just tested your code, and it works fine for me when executed via VBARUN.

--
Owen Wengerd
ManuSoft
Message 7 of 12
danfall
in reply to: owenwengerd

Thanks for the reply.  AutoCAD only reports that it is an "unhandled exception", no other info than that. I sent in the report to Autodesk which contained all my workstation and software configuration.

 

  I've been using that particular code for several years with no problems till now. I inherited  a fairly large app written completly in lisp  and added quite a bit of VBA code about 10 years ago to modernize the app with forms and dialog boxes, more features, etc. 

 

It still works great on several workstations running ACAD 2013. I ran into problems while testing the app on a new workstation with a fresh install of ACAD 2015.

 

I will try a small test with the GetLispsym sub separate from the existing app as you did. I've been testing it as part of the complete app.

Message 8 of 12
lando7189
in reply to: owenwengerd

I was just curious... what happens if you use the  (vl-vbarun) funciton in visual lisp?  I am getting a similar crash, but it only happens using vl-vbarun (the VBARUN command and using the immediate window work fine).

 

Lanny

Message 9 of 12
AdrianSaf
in reply to: danfall

Did you get anywere with this? I have the same issue.

Message 10 of 12
Alfred.NESWADBA
in reply to: AdrianSaf

Hi @AdrianSaf

 

I already answered your question >>>there<<<, Have you tried it (before crossposting)?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 11 of 12
AdrianSaf
in reply to: Alfred.NESWADBA

Yes, that works. I had not seen your reply before posting this question.

I had run into 2 post describing issues similar to mine and posted in both asking if they found any solutions (not sure why that would be wrong).

 

Anyway, thank you for the reply.

Message 12 of 12
lando7189
in reply to: AdrianSaf

I discovered that it was fixed in AutoCAD 2016 when trying the same piece of code.  Glad to see that the did fix it for 2015.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost