handasa Posted September 8, 2017 Share Posted September 8, 2017 GREETINGS EVERYONE ; i am looking for a method to set the annotative block property to "NO" 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 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 8, 2017 Share Posted September 8, 2017 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) Quote Link to comment Share on other sites More sharing options...
handasa Posted September 8, 2017 Author Share Posted September 8, 2017 worked like a charm ... thanks lee Quote Link to comment Share on other sites More sharing options...
Grrr Posted September 8, 2017 Share Posted September 8, 2017 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? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 8, 2017 Share Posted September 8, 2017 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. Quote Link to comment Share on other sites More sharing options...
handasa Posted September 8, 2017 Author Share Posted September 8, 2017 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 Quote Link to comment Share on other sites More sharing options...
Grrr Posted September 9, 2017 Share Posted September 9, 2017 I would modify the block definition xdata in the same way using the ActiveX getxdata & setxdata methods. Thanks Lee, I've forgot that these methods exist. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.