Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

Perhaps see here also:

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

Posted

lee mac

 

you make it look easy

 

As always, thanks

Posted

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

Posted

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" :sweat:

 

Thanks for showing me how you might go about it,

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