cadman6735 发表于 2022-7-6 10:18:59

vlax-put-property

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

Lee Mac 发表于 2022-7-6 10:32:43

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))

Lee Mac 发表于 2022-7-6 10:48:21

Perhaps see here also:

http://www.cadtutor.net/forum/showpost.php?p=258403&postcount=9

cadman6735 发表于 2022-7-6 11:05:48

lee mac
 
you make it look easy
 
As always, thanks

Lee Mac 发表于 2022-7-6 11:12:12

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)) ))

cadman6735 发表于 2022-7-6 11:28:45

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,
页: [1]
查看完整版本: vlax-put-property