Error: Automation Error. Layout does not eixst for renaming; reset after error... and yes "exist" is misspelled :-)
Has anyone figured out how to do this or is it just a limitation? I can see the layout object and all the properties ... but when I try and delete or rename, this error is thrown:same error on 2010QuoteError: Automation Error. Layout does not eixst for renaming; reset after error... and yes "exist" is misspelled :)
Using your supplied code, the first layout in the active drawing was renamed, not that of the saved drawing. :?
Using your supplied code, the first layout in the active drawing was renamed, not that of the saved drawing. :?
no. code rename layout in active dwg.Using your supplied code, the first layout in the active drawing was renamed, not that of the saved drawing. :?
No errors?
(defun 000:GetDbxDocument ()
(vla-getInterfaceObject (vlax-get-acad-object)
(strcat "ObjectDBX.AxDbDocument." (substr (getvar "ACADVER") 1 2) )
)
)
(not
(vl-catch-all-error-p
(vl-catch-all-apply
(quote vla-open)
(list
(setq dbx (000:GetDbxDocument))
"d:\\xxx.dwg"
)
)
)
)
(setq *cd-Layouts* (vla-get-layouts dbx))
(vlax-for % *cd-Layouts*
(vla-delete (vla-item *cd-Layouts* "1-01"))
)
(vlax-release-object Dbx)
dwg xxx.dwg on d: with layout 1-01(and (= (vla-get-taborder l) 1) (vla-put-name l "test"))
Just for my education, why do you use "and" here? I would have used "if". Does the vla-put-name run even if the first half is nil?
Has anyone figured out how to do this or is it just a limitation? I can see the layout object and all the properties ... but when I try and delete or rename, this error is thrown:
(defun ALE_Utl_GetItem (VlaCol KeyNam / VlaObj)
(vl-catch-all-apply
'(lambda ( )
(setq VlaObj (vla-item VlaCol KeyNam))
)
)
VlaObj
)
(setq
DbxDoc (vla-GetInterfaceObject
(vlax-get-Acad-Object) (strcat "ObjectDBX.AxDbDocument." (substr (getvar "ACADVER") 1 2)))
)
(vl-catch-all-error-p (vl-catch-all-apply 'vla-Open (list DbxDoc "test.dwg")))
(vlax-dump-object (setq lllll (vla-get-Layouts DbxDoc)) T)
; IAcadLayout:
...
; Document (RO) = #<VLA-OBJECT IAxDbDocument 000000000cc22fa0>
>>> different >>> Document IAxDb
...
(vlax-dump-object (setq aaaaa (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object)))) T)
; IAcadLayout:
...
on (RO) = #<VLA-OBJECT IAcadApplication 00000001409f6c70>
; Document (RO) = #<VLA-OBJECT IAcadDocument 000000000cae3bc0>
>>> different >>> Document IAcad
...
(setq LayObj (ALE_Utl_GetItem aaaaa "Layout1"))
(setq LayODBX (ALE_Utl_GetItem lllll "Layout1"))
(vla-put-name LayObj "test") or (vla-put-name LayODBX "test")
>>> rename always Layout1 on active DWG
Thanks for checking this. Guess it's just a bug.
The first time I ran this, it worked. The second time it did not. If I change the rename to -test1, it will work one more time.
It ran for me in 2012, renaming Layout1 tab to test in the active drawing.
It ran for me in 2012, renaming Layout1 tab to test in the active drawing.
It worked as above. No error message.
I'm confused what the OP is trying to do. If he's trying to change the name of the layout tab in the saved -test drawing, wouldn't he just use saveas to create the file, and then open the saved drawing with DBX, change the layout name and resave it? Or change the name in the active drawing, and then do a saveas?