Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
New Member
peterjolly
Posts: 1
Registered: ‎01-24-2012
Message 1 of 2 (1,012 Views)

vlax Lisp failing in 64bit Autocad 2012 - help

1012 Views, 1 Replies
01-24-2012 02:51 PM

We have a bunch of LISPs that work together in 32bit Autocad 2010 on a 32bit machine no problem. We have 'tried' to upgrade to a Win 7 64bit machine with 64bit Autocad 2012. The LISP files fails in 64bit ACAD with the following error: -

 

"Automation Error. The parameter is incorrect."

 

The code was written quite a long time ago, and has worked up until now. I have little understanding of LISP so I cant seem to trouble shot it much.

 

I have tested our database connection via the DBconnect dialog and also running a test LISP which makes a call to the database and returns values. This all works perfectly in 64bit. 

 

The LISP is using a SQL coonection to connect to a Database and use some text that is selected on screen to trigger a call to the database. By putting in code to print error messages, I can find the line on which it fails.

 

It fails on this line:-

 

(setq linkCur (vlax-invoke-method linkSel "Item" 0))

 

I think it is due to the value of linkSel, which returns seemingly random values such as '7fffff64e560'

 

The code is below up until it fails: -

 

<code> 

 

(defun c:ArchibusTextSelect ()
(vl-load-com)
;(command pause)
(setq acadObj (vlax-get-acad-object))
(setq acadDocs (vlax-get-property acadObj "Documents"))

(if (null caom-GetLinkTemplates) ; Check that CAO type library has not yet been loaded.
(vlax-import-type-library :tlb-filename "cao16enu.tlb" ; Should be in C:\Program Files\Common Files\Autodesk Shared.
:methods-prefix "caom-"
:smileytongue:roperties-prefix "caop-"
:constants-prefix "caok-"
))

(setq dbconnect (vla-getinterfaceobject (vlax-get-acad-object) "CAO.DbConnect.16"))
;(command pause)

;; Make GetLinks() return all linktypes.
(setq linkTypes (+ caok-kEntityLinkType caok-kFSLabelType caok-kAttachedLabelType) )

(setq sset_1 (ssget '((-4 . "<and")
(0 . "MTEXT")
(8 . "80-ROOM_NUM")
(-4 . "and>"))))


(if (/= sset_1 nil)
(progn
(setq ssl_1 (sslength sset_1))
;(setq sset_2 sset_1)
(print ssl_1)
(setq count 0)

;(print (listp alst))


(print (strcat "this is loop: " (rtos count 2 0)))
;(command pause)
(setq selectedEname (ssname sset_1 count))
(print selectedEname)
(setq selectedobj (vlax-ename->vla-object selectedEname))
(princ (vlax-dump-object selectedobj))
(setq selectedObjID (vlax-get-property selectedObj "ObjectID"))
(setq ObjIDs (vlax-make-safearray vlax-vbLong (cons 0 1)))
(vlax-safearray-put-element ObjIDs 0 selectedObjID)
(setq linkSel (vl-catch-all-apply 'caom-GetLinks
(list dbConnect "LOC_CODE" ObjIDs linkTypes )
))
(if (vl-catch-all-error-p linkSel)
(progn
(print (strcat "An ActiveX error occurred: " (vl-catch-all-error-message linkSel) ))
(exit)
)
)
(princ "ok 2")
(setq linkCur (vlax-invoke-method linkSel "Item" 0))
(princ "ok 3")

 

</code>

 

We are not trying to use JET drivers like I have seen is an issue for others. Our connection works, it is just the values it is returning is failing. Does ayone have any leads on this issue?

 

Ideally I would love it if there was a way to make 64bit Autocad treat LISP in some sort of campatibility mode. Is there a work around to get LISPS that for perfectly in 32bit to work in 64bit?

 

Could this be an issue between Autocad 2010 and Autocad 2012?

 

Thanks

Peter

 

 

Valued Mentor
martti.halminen
Posts: 344
Registered: ‎12-31-2009
Message 2 of 2 (975 Views)

Re: vlax Lisp failing in 64bit Autocad 2012 - help

01-25-2012 01:45 AM in reply to: peterjolly

peterjolly wrote:

We have a bunch of LISPs that work together in 32bit Autocad 2010 on a 32bit machine no problem. We have 'tried' to upgrade to a Win 7 64bit machine with 64bit Autocad 2012. The LISP files fails in 64bit ACAD with the following error: -

 

"Automation Error. The parameter is incorrect."

 .......

We are not trying to use JET drivers like I have seen is an issue for others. Our connection works, it is just the values it is returning is failing. Does ayone have any leads on this issue?

 

Ideally I would love it if there was a way to make 64bit Autocad treat LISP in some sort of campatibility mode. Is there a work around to get LISPS that for perfectly in 32bit to work in 64bit?

 

Could this be an issue between Autocad 2010 and Autocad 2012?

  



Generally, Visual Lisp itself works the same in 32 and 64 bit versions, 2010 as well as 2012.

I've only had problems when loading .arx files with it, those need to be separate versions for 64-bit.

There should be no need for any compatibility stuff, except when calling external programs.

 

So my guess would be that the problem is with the CAO library, which necessarily doesn't work the same way.

- I've never used it myself, so I can't help on the details.

 

--

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!