Author Topic: ObjectDBX and attributes: Doesn't work?  (Read 8279 times)

0 Members and 1 Guest are viewing this topic.

codered8x

  • Guest
Re: ObjectDBX and attributes: Doesn't work?
« Reply #15 on: February 29, 2012, 05:41:03 AM »
when i get attributes (in block) from unopen drawing, use objectdbx , appear this error :
"error: ActiveX Server returned the error: unknown name: GETATTRIBUTES" ?

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: ObjectDBX and attributes: Doesn't work?
« Reply #16 on: February 29, 2012, 06:21:28 AM »
On what object are you attempting to evaluate the method?

codered8x

  • Guest
Re: ObjectDBX and attributes: Doesn't work?
« Reply #17 on: February 29, 2012, 10:28:16 AM »
This time I encountered this error message:  " ActiveX Server returned the error: unknown name:
HasAttributes. "
Code - Auto/Visual Lisp: [Select]
  1. (defun c:getatt ()
  2.   (setq file   (getfiled "Select DWG file" "" "dwg" 4)
  3.         prid   (strcat "objectDBX.Axdbdocument."
  4.                        (substr (getvar 'acadver) 1 2)
  5.                )
  6.         dbxdoc (vla-getinterfaceobject (vlax-get-acad-object) prid)
  7.   )
  8.   (vlax-invoke-method dbxdoc 'open file)
  9.   (vlax-for blk (vla-get-blocks dbxdoc)
  10.     (if (and (/= (substr (vla-get-name blk) 1 1) "*")
  11.              (= :vlax-true (vla-get-hasattributes blk))
  12.         )
  13.       (setq att    (vlax-invoke blk 'getattributes)
  14.             attlst (cons (vla-get-textstring (nth 0 att)) attlst)
  15.       )
  16.     )
  17.   )
  18.   (reverse attlst)
  19. )
  20.  
Can you tell me the cause and fix it.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: ObjectDBX and attributes: Doesn't work?
« Reply #18 on: February 29, 2012, 11:04:58 AM »
You are operating on a Block Definition object, not a Block Reference - study Example 4 of my ObjectDBX Wrapper program:

http://www.theswamp.org/index.php?topic=31827.0

In fact, this whole thread is discussing the same thing.
« Last Edit: February 29, 2012, 11:08:30 AM by Lee Mac »

codered8x

  • Guest
Re: ObjectDBX and attributes: Doesn't work?
« Reply #19 on: February 29, 2012, 10:21:15 PM »
Many thanks, Lee ! That topic help me so much. Cause is I haven't understood relating between Block and Layout.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: ObjectDBX and attributes: Doesn't work?
« Reply #20 on: March 01, 2012, 07:48:30 AM »
You're welcome  :-)

To help with your understanding, I would suggest that you research the different between a Block Definition Object (BLOCK) and a Block Reference Object (INSERT). There are many explanations to be found on this forum - I must've explained it at least three times  :lol: