cadman6735 Posted October 8, 2010 Share Posted October 8, 2010 how do I assign the property of one to anouther? I want to take my file name and assign it to my layout tab. This is my code so far: How do I use the vlax-put-property? I am not looking for code, just an example (defun C:test () (vl-load-com) (setq acadObject (vlax-get-acad-object)) (setq acadDocument (vlax-get-property acadObject 'ActiveDocument)) (setq acadName (vlax-get-property acadDocument 'Name)) (setq PaperSpace (vlax-get-property acadDocument 'PaperSpace)) (setq PaperSpaceLayout (vlax-get-property PaperSpace 'Layout)) (setq LayoutName (vlax-get-property PaperSpaceLayout 'Name)) (vlax-put-property (vla-get-Layout PaperSpace) acadName) (princ) ) The (vlax-put-property (vla-get-Layout PaperSpace) acadName) part I pulled from the net and it seemed promising, but... Thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 8, 2010 Share Posted October 8, 2010 Here's another way, using the method of your code: (defun c:test ( / doc ) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-put-name (vla-get-Layout (vla-get-Paperspace doc) ) (vla-get-name doc) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 8, 2010 Share Posted October 8, 2010 Perhaps see here also: http://www.cadtutor.net/forum/showpost.php?p=258403&postcount=9 Quote Link to comment Share on other sites More sharing options...
cadman6735 Posted October 8, 2010 Author Share Posted October 8, 2010 lee mac you make it look easy As always, thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 8, 2010 Share Posted October 8, 2010 Thanks Cadman, This is how I might approach the task of renaming layouts, using the vl-catch-all-apply allows for duplicate layout names and layout names that contain invalid symbols. (defun _PutLayoutName ( layout name / _CatchApply ) (vl-load-com) (defun _CatchApply ( _function _arguments ) (if (not (vl-catch-all-error-p (setq result (vl-catch-all-apply (function _function) _arguments) ) ) ) result ) ) (if (setq layout (_CatchApply vla-item (list (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object) ) ) layout ) ) ) (_CatchApply vla-put-name (list layout name)) ) ) Quote Link to comment Share on other sites More sharing options...
cadman6735 Posted October 13, 2010 Author Share Posted October 13, 2010 it will take me time to digest the code you provide above. I will be back with questions but not any time soon, swamped with "work" Thanks for showing me how you might go about it, 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.