乐筑天下

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

[编程交流] LISP:Obtain Coordinates of a p

[复制链接]

48

主题

304

帖子

256

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
240
发表于 2022-7-5 19:02:07 | 显示全部楼层
 
Hi. The reason why i needed to "export" this values is I need to zoom to the same location for multiple drawings.
回复

使用道具 举报

95

主题

477

帖子

383

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
475
发表于 2022-7-5 19:03:11 | 显示全部楼层
If your variables are global, they will be remembered between drawings. That way, you can zoom to the same location in as many drawings as you want.
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 19:07:14 | 显示全部楼层
 
Having a problem with this do you know a secret ?
 
Global variables as per help is about running within one dwg not across multiples outside of say multiple defuns running in a session, the code by Lee hints at this by writing to file. Another alternative is to write say a string to the registery. vl-registry-write  vl-registry-read
回复

使用道具 举报

48

主题

304

帖子

256

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
240
发表于 2022-7-5 19:12:43 | 显示全部楼层
 

 
Could you elobrate?
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 19:13:23 | 显示全部楼层
 
Not true I'm afraid: all symbols in AutoLISP are defined within the document namespace by default and therefore cannot be accessed outside of this namespace (unless you use vl-bb-set/vl-bb-ref to define symbols within the blackboard namespace which is a document-independent namespace and may therefore be accessed from any drawing).
 
Another alternative is to use vl-propagate to propagate a variable across all document namespaces.
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 19:18:59 | 显示全部楼层
Thanks Lee
回复

使用道具 举报

95

主题

477

帖子

383

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
475
发表于 2022-7-5 19:21:17 | 显示全部楼层
Lee, I thought setenv and getenv could be used to store variables in the registry (just need to be careful to not use the same variables and to not overuse it because it can bloat it). I haven't used them yet (haven't seen the need) but I remember reading about it when I was first learning lisp, did I misunderstand it? Also can't vl-propagate be used to "store" the variable so that it can be used for all open drawings in the current session?
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 19:26:08 | 显示全部楼层
 
Indeed, getenv & setenv can be used to read & write a string value (REG_SZ / REG_EXPAND_SZ) to a specific branch of the registry [specifically the location given by: (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\FixedProfile\\General") ], however, these are not global variables as you stated in your post.
 
Writing such values to the registry is essentially the same as reading & writing data to a text file (which may in fact be a preferred option due to the ease of removal - this is the route I follow with the majority of my larger applications).
 
As noted in my post above, vl-propagate is also an option, however, this will cause a global variable to persist only during the current instance of the application.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 20:32 , Processed in 0.497475 second(s), 66 queries .

© 2020-2025 乐筑天下

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