乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 93|回复: 5

[编程交流] vlax-put-property

[复制链接]

23

主题

117

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
123
发表于 2022-7-6 10:18:59 | 显示全部楼层 |阅读模式
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
 
 
  1. (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
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 10:32:43 | 显示全部楼层
Here's another way, using the method of your code:
 
  1. (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))
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 10:48:21 | 显示全部楼层
Perhaps see here also:

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

使用道具 举报

23

主题

117

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
123
发表于 2022-7-6 11:05:48 | 显示全部楼层
lee mac
 
you make it look easy
 
As always, thanks
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 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.
 
  1. (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)) ))
回复

使用道具 举报

23

主题

117

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
123
发表于 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,
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-6 21:06 , Processed in 0.855706 second(s), 64 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表