Author Topic: strange error when using vlax-invoke-method 'GetObjectIdString  (Read 8087 times)

0 Members and 1 Guest are viewing this topic.

nivuahc

  • Guest
strange error when using vlax-invoke-method 'GetObjectIdString
« on: December 28, 2010, 04:50:28 PM »
Okay, so I keep getting this strange error that pops up whenever I use the following

Code: [Select]
(vlax-invoke-method
(vla-get-Utility
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
'GetObjectIdString
(vlax-ename->vla-object
(car
(entsel)
)
)
:vlax-false
)

When I close MEP (2011, 64bit, Windows 7) I have the attached screen-shot pop-up on my screen. Click the "OK" button and it pops up again. Click the "OK" button again and it's gone.

Is this something I'm doing wrong or is this just another example of MEP being fickle?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #1 on: December 28, 2010, 04:57:54 PM »
Do you get the same result using:

Code: [Select]
(vlax-invoke
  (vla-get-Utility
    (vla-get-ActiveDocument
      (vlax-get-acad-object)
    )
  )
  'GetObjectIDString
  (vlax-ename->vla-object (car (entsel)))
  :vlax-false
)

nivuahc

  • Guest
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #2 on: December 28, 2010, 05:57:12 PM »
Nope.  


Weird. :?



ETA:

vlax-invoke-method result: "8796084415712"

vlax-invoke result: "000007FFFF7CACE0"
« Last Edit: December 28, 2010, 06:02:20 PM by nivuahc »

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #3 on: December 28, 2010, 06:05:58 PM »
looks like one is hex, the other a long ; truly weird
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #4 on: December 28, 2010, 06:55:49 PM »
looks like one is hex, the other a long

Spot on my friend  :-)

Code: [Select]
_$ (rtos (LM:Hex->Dec "000007FFFF7CACE0") 2 0)
"8796084415712"

Code: [Select]
(defun LM:Hex->Dec ( h / l )
   (if (zerop (setq l (strlen h))) 0
      (+
         (* (expt 16. (1- l))
            (
               (lambda ( a ) (- a (if (< a 58) 48 55))) (ascii h)
            )
         )
         (LM:Hex->Dec (substr h 2))
      )
   )
)

Any excuse to write code...

Code: [Select]
_$ (LM:Dec->Hex 8796084415712.)
"7FFFF7CACE0"

Code: [Select]
(defun LM:Dec->Hex ( d )
   (cond
      (  (< d 10)

         (chr (fix (+ d 48)))
      )
      (  (< d 17)

         (chr (fix (+ d 55)))
      )
      (  (strcat (LM:Dec->Hex (/ d 16)) (LM:Dec->Hex (rem d 16)))
      )
   )
)
« Last Edit: December 28, 2010, 07:02:15 PM by Lee Mac »

m4rdy

  • Newt
  • Posts: 62
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #5 on: December 29, 2010, 01:46:17 AM »
Quote
Having read your post for all of about 5 seconds, try switching
(vlax-invoke-method) to just (vlax-invoke) and try switching methods/properties
from strings to quoted symbols, eg. 'ElevationAt (that's a Tony T
recommendation). ActiveX within AECC is a little touchy so you sometimes have
to revert to the (vla-xxx) syntax. Localizing variables helps a lot too.

Let us know how you make out.

--
John Uhden, Cadlantic/formerly CADvantage
http://www.cadlantic.com
Sea Girt, NJ
http://forums.autodesk.com/t5/AutoCAD-Land-Desktop/odd-crashes-when-using-Land-Object-model-in-lisp/m-p/626525/highlight/true#M5393
Autocad 2007, Windows XP

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #6 on: December 29, 2010, 03:27:45 AM »
Hi,

Using vlax-invoke-method (or vla-GetObjectIdString) the returned value type depends on the last argument:

(vlax-invoke-method *Util* 'GetObjectIdString   obj :vlax-false) returns the result as a long.
(vlax-invoke-method *Util* 'GetObjectIdString   obj :vlax-true) returns the result as an hexa.
Speaking English as a French Frog

nivuahc

  • Guest
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #7 on: December 29, 2010, 07:48:50 AM »
Which is funny considering the following:  :?

Code: [Select]
Command: (vlax-invoke
(_>   (vla-get-Utility
((_>     (vla-get-ActiveDocument
(((_>       (vlax-get-acad-object)
(((_>     )
((_>   )
(_>   'GetObjectIDString
(_>   (vlax-ename->vla-object (car (entsel)))
(_>   :vlax-true
(_> )

Select object: "000007FFFF7CAC00"

Command: (vlax-invoke
(_>   (vla-get-Utility
((_>     (vla-get-ActiveDocument
(((_>       (vlax-get-acad-object)
(((_>     )
((_>   )
(_>   'GetObjectIDString
(_>   (vlax-ename->vla-object (car (entsel)))
(_>   :vlax-false
(_> )

Select object: "000007FFFF7CAC00"

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #8 on: December 29, 2010, 07:57:59 AM »
Try:

Code: [Select]
(vlax-invoke
  (vla-get-Utility
    (vla-get-ActiveDocument
      (vlax-get-acad-object)
    )
  )
  'GetObjectIDString
  (vlax-ename->vla-object (car (entsel)))
  acfalse
)

Code: [Select]
(vlax-invoke
  (vla-get-Utility
    (vla-get-ActiveDocument
      (vlax-get-acad-object)
    )
  )
  'GetObjectIDString
  (vlax-ename->vla-object (car (entsel)))
  actrue
)

nivuahc

  • Guest
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #9 on: December 29, 2010, 08:02:47 AM »
Hah!  :-D

Code: [Select]
Command: (vlax-invoke
(_>   (vla-get-Utility
((_>     (vla-get-ActiveDocument
(((_>       (vlax-get-acad-object)
(((_>     )
((_>   )
(_>   'GetObjectIDString
(_>   (vlax-ename->vla-object (car (entsel)))
(_>   acfalse
(_> )

Select object: "8796084415488"

Command: (vlax-invoke
(_>   (vla-get-Utility
((_>     (vla-get-ActiveDocument
(((_>       (vlax-get-acad-object)
(((_>     )
((_>   )
(_>   'GetObjectIDString
(_>   (vlax-ename->vla-object (car (entsel)))
(_>   actrue
(_> )

Select object: "000007FFFF7CAC00"

nivuahc

  • Guest
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #10 on: December 29, 2010, 08:05:50 AM »
Also, no more error on exit.

I wonder what the heck that was all about...  :roll:

Thanks, Lee!

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #11 on: December 29, 2010, 08:09:21 AM »
I wonder what the heck that was all about...  :roll:

Thanks, Lee!

Beats me! Glad we got it sorted though  :-)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #12 on: December 29, 2010, 08:51:46 AM »

I can't test here at the moment, but do you get the same result on 32 bit and 64 bit machines.

I recall there was an issue with ObjectID extraction for fields with 32 bit and 64 bit machines.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

nivuahc

  • Guest
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #13 on: December 29, 2010, 09:41:34 AM »
All of the following is on 32bit MEP 2011

Test 1:
Code: [Select]
Command: (vlax-invoke-method (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIdString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-false[/color])

Select object: "2130071024"

Command: (vlax-invoke-method (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIdString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-true[/color])

Select object: "7EF64DF0"

FYI: No error on exit

Test 2:
Code: [Select]
Command: (vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-true[/color])

Select object: "7EF64DF0"

Command: (vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-false[/color])

Select object: "7EF64DF0"


Test 3:
Code: [Select]
Command: (vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]acFalse[/color])

Select object: "2130071024"

Command: (vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]acTrue[/color])

Select object: "7EF64DF0"

nivuahc

  • Guest
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #14 on: December 29, 2010, 09:45:47 AM »
All of the following is on 64bit MEP 2011 (not the exact same object, I'm running both systems on separate machines with a random piece of conduit drawn in space on each)

Test 1:
Code: [Select]
Command: (vlax-invoke-method (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIdString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-false[/color])

Select object: "8796084415488"

Command: (vlax-invoke-method (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIdString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-true[/color])

Select object: "000007FFFF7CAC00"

FYI: Mysterious error on exit

Test 2:
Code: [Select]
Command: (vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-true[/color])

Select object: "000007FFFF7CAC00"

Command: (vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-false[/color])

Select object: "000007FFFF7CAC00"


Test 3:
Code: [Select]
Command: (vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]acFalse[/color])

Select object: "8796084415488"

Command: (vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]acTrue[/color])

Select object: "000007FFFF7CAC00"

nivuahc

  • Guest
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #15 on: December 29, 2010, 09:48:09 AM »
Hang on a sec...

One of the tests on the 32bit system DID cause the mysterious error, but it wasn't the first one  :?

nivuahc

  • Guest
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #16 on: December 29, 2010, 09:58:14 AM »
All of the following is on 64bit MEP 2011 using the same drawing/object that I used in the 32bit tests above

Test 1:
Code: [Select]
(vlax-invoke-method (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIdString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-false[/color])

32bit: "2130071024"
64bit: "8796083987552"


Code: [Select]
(vlax-invoke-method (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIdString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-true[/color])

32bit: "7EF64DF0"
64bit: "000007FFFF762460"


Test 2:
Code: [Select]
(vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-true[/color])

32bit: "7EF64DF0"
64bit: "000007FFFF762460"

Code: [Select]
(vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]:vlax-false[/color])

32bit: "7EF64DF0"
64bit: "000007FFFF762460"



Test 3:
Code: [Select]
(vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]acFalse[/color])

32bit: "2130071024"
64bit: "8796083987552"

Code: [Select]
(vlax-invoke (vla-get-Utility (vla-get-ActiveDocument
(vlax-get-acad-object))) 'GetObjectIDString (vlax-ename->vla-object (car
(entsel))) [color=red]acTrue[/color])

32bit: "7EF64DF0"
64bit: "000007FFFF762460"

nivuahc

  • Guest
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #17 on: December 29, 2010, 10:04:21 AM »
Hang on a sec...

One of the tests on the 32bit system DID cause the mysterious error, but it wasn't the first one  :?

Alright this is nuts...

I tried the first test twice in different sessions of 32bit MEP with no error. Now when I test it, I get that error every time.

Vaidas

  • Newt
  • Posts: 66
Re: strange error when using vlax-invoke-method 'GetObjectIdString
« Reply #18 on: April 26, 2012, 02:59:51 AM »
Thanks for pointing on doubts between 32/64 bit systems.
(mapcar 'chr '(107 105 116 111 120 46 99 111 109))