Jump to content

Turn off annotative property for a block


handasa

Recommended Posts

GREETINGS EVERYONE ;

i am looking for a method to set the annotative block property to "NO"

 

annotation.jpg

 

without using the bedit command

 

i tried :

(vla-put-Annotative (vlax-ename->vla-object (car (entsel))) :vlax-false)

 

but it gave this error :

error: ActiveX Server returned the error: unknown name: Annotative

 

 

there is a routine to change block properties written by Ian_Bryant

 

(defun set-block-prop (blkname property value)
(vl-load-com)
(not
(vl-catch-all-apply
'vlax-put-property
(list
(vl-catch-all-apply
'vla-item
(list
(vla-get-blocks
(vla-get-activedocument 
(vlax-get-acad-object)
)
)
blkname
)
)
property value
)
)
)
)

 

i tried

("my-block-name" 'annotative 0)

and

("my-block-name" 'annotation 0)

and

("my-block-name" "annotation" 0)

 

and all the above variations gave me "nil" and did nothing ...

 

any help will be appreciated

 

thanks and best regards

Link to comment
Share on other sites

Consider the following function:

;; Annotative Block  -  Lee Mac
;; Sets the annotative property for a block definition
;; blk - [str] Block name
;; flg - [bol] Boolean flag (T=Annotative, nil=Not Annotative)
;; Returns: T if successful, else nil

(defun LM:annotativeblock ( blk flg )
   (and (setq blk (tblobjname "block" blk))
       (progn
           (regapp "AcadAnnotative")
           (entmod
               (append (entget (cdr (assoc 330 (entget blk))))
                   (list
                       (list -3
                           (list
                               "AcadAnnotative"
                              '(1000 . "AnnotativeData")
                              '(1002 . "{")
                              '(1070 . 1)
                               (cons 1070 (if flg 1 0))
                              '(1002 . "}")
                           )
                       )
                   )
               )
           )
       )
   )
)

Example:

(LM:annotativeblock "F1" nil)

Link to comment
Share on other sites

Hi Lee,

I have one question:

If you had to use activex to achieve the same result, does that mean that you'd have to invoke the GetExtensionDictionary method and dig into there?

In other words, anything that has to do with XDATA / GroupCode -3, shall be accessed with the above method, correct?

:unsure:

Link to comment
Share on other sites

worked like a charm ... thanks lee

 

Excellent - you're welcome handasa.

 

If you had to use activex to achieve the same result, does that mean that you'd have to invoke the GetExtensionDictionary method and dig into there?

In other words, anything that has to do with XDATA / GroupCode -3, shall be accessed with the above method, correct?

 

Some tasks lend themselves to the use of Vanilla AutoLISP, but if I were forced to tackle this using ActiveX, I would modify the block definition xdata in the same way using the ActiveX getxdata & setxdata methods.

Link to comment
Share on other sites

using manual turn off through block editor and then check block is annotative by this routine

;; by Ian Bryant
;; Return T if ename is annotative, otherwise nil.
(defun IsAnnotative (e)
(and e
(setq e (cdr (assoc 360 (entget e))))
(setq e (dictsearch e "AcDbContextDataManager"))
(setq e (dictsearch (cdr (assoc -1 e)) "ACDB_ANNOTATIONSCALES"))
(assoc 350 e)
)
) ;end

 

give nil

 

while after using your routine , lee to turn off annotative property ... the routine above still read the block as annotative

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...