TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: KuoTze on April 01, 2014, 08:32:17 AM

Title: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: KuoTze on April 01, 2014, 08:32:17 AM
i work in AutoCad 2015 and run "LeeMAC's CountV1-3.lsp" but it error and msg is ** Error: no function definition: VLA-GET-OBJECTID32 **

How can Fix it ......

Sorry i English is not good to say ~~ please forgive ~~  :embarrassed:
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Kerry on April 01, 2014, 08:49:40 AM
The function is obsolete.
I'm not sure how or why it is being used.

Can you test/try the code using VLA-GET-OBJECTID
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: KuoTze on April 01, 2014, 09:04:13 AM
 :embarrassed:

i try to fix "vla-get-objetcid32 to vla-get-objetcid"

but can't work and Msg ** Error: ActiveX Server returned the error: unknown name: "SETBLOCKTABLERECORDID32" **

So .... i can't fix it ........
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 01, 2014, 09:18:06 AM
Change the function to this:


Code: [Select]
(defun _getobjectid (doc obj)
    (if   (and (_is64bit) (= (type vla-get-objectid32) 'subr))
      (vla-get-objectid32 obj)
      (vla-get-objectid obj)
    )
  )

And change this portion of the code:
Code: [Select]
                (if (and (_is64bit)
                    (= (type vla-setblocktablerecordid32) 'subr)
                    )
                  'setblocktablerecordid32
                  'setblocktablerecordid
                )
Welcome to TheSwamp :)
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: KuoTze on April 01, 2014, 09:27:26 AM
 :-) thank ...

i paste your code to lisp it can't work and msg ** Error: ActiveX Server returned the error: unknown name: "SETBLOCKTABLERECORDID32" **

so ......................

Change the function to this:


Code: [Select]
(defun _getobjectid (doc obj)
    (if (and (_is64bit) (= (type vla-get-objectid32) 'subr))
      (vla-get-objectid32 obj)
      (vla-get-objectid obj)
    )
  )


Welcome to TheSwamp :)
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: KuoTze on April 01, 2014, 10:00:55 AM
thank your code

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(if (and (_is64bit)
                    (= (type vla-setblocktablerecordid32) 'subr)
                    )
                  'setblocktablerecordid32
                  'setblocktablerecordid
                )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



but ......

now error msg is :

Output [Table/File/Settings] <Exit>:

Specify Point for Table: ; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on exception
; error: Exception occurred: 0xC0000005 (Access Violation)

it can't work   :embarrassed:
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 01, 2014, 11:42:35 AM
Give this version a try .. seems to be working on my computer. I noted the change in the header.



Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: KuoTze on April 01, 2014, 12:32:32 PM
Thank you so much  ...........

Count1.31-RJP can work

Thank you so much  ...........

 :lmao: :lmao: :lmao:
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 01, 2014, 12:34:31 PM
Glad to help  :)
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Lee Mac on April 01, 2014, 06:05:26 PM
Many thanks Ron -
I don't have a 64-bit system on which to test the program, so I am incredibly grateful for your assistance.

Lee
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Lee Mac on April 01, 2014, 06:10:34 PM
The function is obsolete.

Hi Kerry,

I wasn't aware that this function had become obsolete in 2015.
Thank you for the information.

Lee
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Kerry on April 01, 2014, 09:04:40 PM
It was marked Obsolete in the 2014 Help. I can't confirm 2015 yet.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 01, 2014, 09:29:57 PM
Many thanks Ron -
I don't have a 64-bit system on which to test the program, so I am incredibly grateful for your assistance.

Lee


Anytime Lee :) .. you've helped me a ton.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 01, 2014, 09:31:18 PM
It was marked Obsolete in the 2014 Help. I can't confirm 2015 yet.


Installed 2015 a week ago and that function is gone.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Hugo on April 02, 2014, 12:38:02 AM
Hallo Lee

Here I have ever asked is that no longer work in 2015.  :-D

Hier habe ich schon mal gefragt das das nicht mehr funktionieren wird in 2015.


http://www.theswamp.org/index.php?topic=33654.msg513336#msg513336
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Lee Mac on April 10, 2014, 01:43:49 PM
Give this version a try .. seems to be working on my computer. I noted the change in the header.

Ron -

As noted, I unfortunately don't have access to a 64-bit system to test, so I was curious: based on your modifications to the code, does the setblocktablerecordid32 accept a string representation of the 64-bit object ID (as returned by the getobjectidstring method)?

Also, why is the (= (type vla-get-objectid32) 'subr) test not sufficient to cater for 2014 onwards?

Many thanks,

Lee
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 10, 2014, 03:02:23 PM
Lee,


From my testing, the setblocktablerecordid32 chucks a wobbly with the x64 objectID string.

Quote
_$
_1$
'(vlax-invoke #<VLA-OBJECT IAcadTable 000000002e0bd7f8> SETBLOCKTABLERECORDID32 2 0 "140700197868736" :vlax-true)
_1$
** Error: Out of present range **; reset after error


This test is fine (= (type vla-get-objectid32) 'subr) ... perhaps the function below will suffice :)

Code: [Select]

(defun _getobjectid (doc obj)
  (if (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE"))
    (if (= (type vla-get-objectid32) 'subr)
      (vla-get-objectid32 obj)
      (vlax-invoke-method (vla-get-utility doc) 'getobjectidstring obj :vlax-false)
    )
    (vla-get-objectid obj)
  )
)


HTH.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Lee Mac on April 12, 2014, 08:37:46 AM
Many thanks Ron  :-)
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Rabbit on April 24, 2014, 06:12:41 PM
So will adding Ron's routine and using (_getobjectid docblocks a) instead of (vla-get-objectid32 a) in my routine below work?

Code: [Select]
(defun _getobjectid (doc obj)
    (if (and (_is64bit) (= (type vla-get-objectid32) 'subr))
      (vla-get-objectid32 obj)
      (vla-get-objectid obj)
    )
  )

Code: [Select]
(setq My_block (cdr (assoc 2 (entget FreshInsertedBlock))))
      (setq docblocks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
      (setq a (vla-item docblocks My_block))
      (setq BlockObjectID (vla-get-objectid32 a))
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 24, 2014, 06:44:59 PM
Been a long week so I may be overlooking something, but this is the way my brain's working today:

Code: [Select]
(defun _GetObjectID ( object )
    (if vla-get-objectid32
        (defun _GetObjectID ( object ) (vla-get-objectid32 object))
        (defun _GetObjectID ( object ) (vla-get-objectid object))
    )
    (_GetObjectID object)
)

tl;dr: Test once, and only as much as is req'd.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 24, 2014, 07:21:30 PM
If one prefers the obfuscated:

Code: [Select]
(defun _GetObjectID ( object )
    (eval
        (cons 'defun
            (cons '_GetObjectID
                (list '(object)
                    (list
                        (if vla-get-objectid32 'vla-get-objectid32 'vla-get-objectid)
                        'object
                    )
                )
            )       
        )
    )
    (_GetObjectID object)   
)
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Kerry on April 24, 2014, 07:36:56 PM
If one prefers the obfuscated:

< .. >

I'm sure there is one.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 24, 2014, 07:45:07 PM
lolz
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Rabbit on April 25, 2014, 09:05:47 AM
The "obfuscated" version worked great in 2012.  Since I don't have 2015, and I'm helping someone who does, I'll get back with you on if it works there.  Many thanks.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 25, 2014, 09:14:02 AM
You're welcome and thanks for letting me know -- I wrote it under 2010 -- conceptually it should work for 2015 -- but it's merely a guess.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 25, 2014, 09:16:17 AM
An aside -- is Rabbit the same person that used to post in the Take 5 forum with David Doane and crew a million years ago?
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 25, 2014, 09:49:08 AM
Another variant for fun (penned under 2011, appears to work fine):

Code: [Select]
(defun _GetObjectID ( object )
    (eval
        (list 'defun '_GetObjectID '(object)
            (list
                (if vla-get-objectid32 'vla-get-objectid32 'vla-get-objectid)
                'object
            )
        )
    )
    (_GetObjectID object)   
)
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: owenwengerd on April 25, 2014, 10:21:56 AM
An aside -- is Rabbit the same person that used to post in the Take 5 forum with David Doane and crew a million years ago?

Yes, and both are still posting. You should stop by and say "hello".
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 25, 2014, 10:27:24 AM
Wow. Didn't know it was still active. Can you pm me the link Owen? Thanks so much for letting me know. tl;dr: I feelz old now.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 25, 2014, 11:19:28 AM
FWIW .. Michael's version breaks Lee's code in AutoCAD 2015 x64. Don't have an x86 computer to test on.


(setq o (vlax-ename->vla-object (car (entsel))))
#<VLA-OBJECT IAcadLWPolyline 000000f2812dbb28>


MP_GETOBJECTID
1055


RJP_GETOBJECTID
"140694991308416"


Apparently vla-setblocktablerecordid will accept an integer or string.



Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 25, 2014, 11:26:02 AM
Damn. I have to get AutoCAD 2015 installed. :police:

Thanks for letting me know Ron.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 25, 2014, 11:32:42 AM
Glad to help  8)
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 25, 2014, 11:36:41 AM
Regardless that vla-setblocktablerecordid will accept a string ... given that vla-get-objectid returns an int aren't you tempted to return same from your alt?
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 25, 2014, 02:13:07 PM
Regardless that vla-setblocktablerecordid will accept a string ... given that vla-get-objectid returns an int aren't you tempted to return same from your alt?


That would probably be a good idea.


Would you know why (atoi "140694991308416") returns 2147483647 ?
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: LE3 on April 25, 2014, 02:33:16 PM
^
http://docs.autodesk.com/ACD/2013/ENU/index.html?url=files/GUID-EF6114FC-F1E4-4C71-91CC-07D01E6C8ABB.htm,topicNumber=d30e573784
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ribarm on April 25, 2014, 02:33:36 PM
Would you know why (atoi "140694991308416") returns 2147483647 ?

Probably, because there are 16^8 integers...

Code: [Select]
Command: (fix (atof (rtos (/ (- (expt 16. 8) 1) 2))))
2147483647
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 25, 2014, 04:31:59 PM
I'm not at my computer (road trip ftw) but my inclination would be to use read, anyone try that?
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 25, 2014, 11:07:22 PM
Read does not work either.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 26, 2014, 12:15:14 AM
How about distof?
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 26, 2014, 08:47:45 AM
Distof returns the same value as read  :(
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 26, 2014, 09:17:43 AM
Thanks for trying Ron.
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Lee Mac on April 26, 2014, 11:16:50 AM
As discussed previously (http://www.theswamp.org/index.php?topic=37312.msg423177#msg423177), I believe the atoi method won't work as the integer conversion functions in AutoLISP are only compatible with 32-bit signed integers and the 64-bit method requires a Long rather than an Int.

This link seems to describe the changes made to the ActiveX API in 2015:

http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-6FEDBCCA-91D0-4782-AE5A-49BD4384FD8C

Though, its odd that the setblocktablerecordid method now accepts either a 32-bit integer or a string for 64-bit systems - certainly, this behaviour is not detailed in the documentation (http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-8A78F69E-EACF-4985-B9E1-6DA662240AF0).

With these changes in mind, and to retain compatibility with earlier 64-bit systems, I would suggest perhaps:
Code: [Select]
(defun LM:objectid ( obj )
    (eval
        (list 'defun 'LM:objectid '( obj )
            (cond
                (   (not (wcmatch (getenv "PROCESSOR_ARCHITECTURE") "*64*"))
                   '(vla-get-objectid obj)
                )
                (   (= 'subr (type vla-get-objectid32))
                   '(vla-get-objectid32 obj)
                )
                (   (list 'vla-getobjectidstring (vla-get-utility (LM:acdoc)) 'obj ':vlax-false))
            )
        )
    )
    (LM:objectid obj)
)

(defun LM:acdoc nil
    (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
    (LM:acdoc)
)

But unfortunately I don't have access to a 64-bit system for testing. :(
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: chlh_jd on April 26, 2014, 03:37:20 PM
Nice solution , Lee :-)
In my case : In Acad2011 64bit system , Object has two property about ID <ObjectID32> <ObjectID>
                   In Acad2015 64bit system , Object has only one ID <ObjectID>
Code: [Select]
(vl-load-com)
(defun _ObjectID  (OBJ / ID)
  (vl-catch-all-apply
    (function
      (lambda nil
(setq ID
       (vlax-get
obj
(quote objectid)))))) id)
;;For test
(_ObjectID (vlax-ename->vla-object (car (entsel))))
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Lee Mac on April 26, 2014, 03:47:06 PM
Nice solution , Lee :-)

Thanks chlh_jd  :-)

In my case : In Acad2011 64bit system , Object has two property about ID <ObjectID32> <ObjectID>
                   In Acad2015 64bit system , Object has only one ID <ObjectID>

If I've understood the API change correctly, the objectid property in 64-bit versions < 2015 (maybe 2014 also?) will return an incorrect object ID, and the objectid32 property must be used instead for these systems.

Could anyone confirm whether the value returned by the objectid property in 64-bit 2015 can be used with the setblocktablerecordid method?

Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: chlh_jd on April 26, 2014, 03:53:37 PM
If I've understood the API change correctly, the objectid property in 64-bit versions < 2015 (maybe 2014 also?) will return an incorrect object ID, and the objectid32 property must be used instead for these systems.
Could anyone confirm whether the value returned by the objectid property in 64-bit 2015 can be used with the setblocktablerecordid method?

I has catch this case sometime in AutoCAD2011 , but didn't know when it come in correct , perhaps I'v update it or .Net Frame .

Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: ronjonp on April 28, 2014, 01:01:44 PM
Nice solution , Lee :)

Thanks chlh_jd  :)

....

Could anyone confirm whether the value returned by the objectid property in 64-bit 2015 can be used with the setblocktablerecordid method?

Lee,
From my tests, you can feed setblocktablerecordid the INT value generated from (vla-get-objectid obj) but it does not generate the block preview in the table. The STRING value returned from (vlax-invoke-method (vla-get-utility doc) 'getobjectidstring obj :vlax-false) works ... strange.   :o 
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: Lee Mac on April 28, 2014, 06:27:58 PM
From my tests, you can feed setblocktablerecordid the INT value generated from (vla-get-objectid obj) but it does not generate the block preview in the table. The STRING value returned from (vlax-invoke-method (vla-get-utility doc) 'getobjectidstring obj :vlax-false) works ... strange.   :o

Cheers Ron - strange indeed.  :|
Title: Re: ** Error: no function definition: VLA-GET-OBJECTID32 **
Post by: MP on April 28, 2014, 06:46:35 PM
Thank you all for your respective work and the resulting informative thread, good read.

An aside and for the curious, the value returned by GetObjectIDString is not the same as the ObjectID but it is the same as an entity's ename converted from hex to decimal. Sorry if this is mentioned elsewhere -- if it was I've not seen it so I thought I'd mention it.