明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2182|回复: 10

[讨论] 【请问怎么获取图中各图层的状态】

[复制链接]
发表于 2014-10-18 16:41:12 | 显示全部楼层 |阅读模式
请问怎么获取图中各图层的状态。
比如我获取图中各图层的状态,然后把状态保存。再把所有图层全部解锁或打开,然后再执行某个命令后,再把图层恢复到之前的状态。
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2014-10-18 17:15:15 | 显示全部楼层
你这说的都autocad基本功能呀
 楼主| 发表于 2014-10-22 19:34:43 | 显示全部楼层
zzyong00 发表于 2014-10-18 17:15
你这说的都autocad基本功能呀

啥意思?
我是想把状态保存到一个参数里而不只是显示出来哟

点评

你说的不就是图层状态管理器吗?  发表于 2014-10-22 20:44
发表于 2014-10-22 20:11:08 | 显示全部楼层
提供两个图层状态存储和恢复的函数如下:
游客,本帖隐藏的内容需要发帖数高于 50 才可浏览,你当前发帖数只有 0
发表于 2014-10-22 20:49:49 | 显示全部楼层
Saves a layer state in the current drawing

(layerstate-save layerstatename mask viewport)
Arguments

layerstatename
A string specifying the name of the layer state to save.

mask
An integer sum designating which properties in the layer state are to be restored.

1- Restore the saved On or Off value

2- Restore the saved Frozen or Thawed value

4- Restore the saved Lock value

8- Restore the saved Plot or No Plot value

16- Restore the saved VPVSDFLT value

32- Restore the saved Color

64- Restore the saved LineType

128- Restore the saved LineWeight

viewport
An ename (ads_name) of the viewport whose VPLAYER setting is to be captured. If nil, the layer state will be saved without VPLAYER settings.

Return Values

T if the save is successful; otherwise nil

Examples

(layerstate-save “myLayerState“ 21 viewportId)
T
(layerstate-save “myLayerState“ nil nil)
nil


Restores a layer state into the current drawing

(layerstate-restore layerstatename viewport
[restoreflags])
Arguments

layerstatename
A string specifying the name of the layer to restore.

viewport
An ename (ads_name) of the viewport to which layerstatename should be restored. If viewport is nil, the layer state is restored to model space.

restoreflags
Optional integer sum affecting how the layer state is restored.

1- Turn off all layers not in the restored layer state

2- Freeze all layers not in the restored layer state

4- Restore the layer state properties as viewport overrides (requires viewport to be not a nil value).

Return Values

nil if the layer state does not exist or contains no layers; otherwise, returns a list of layer names.

Examples

(layerstate-restore “myLayerState“ viewportId 5)
(“Layername1” “Layername2“)

点评

此函数只在高版本2007及以上版本才有!  发表于 2014-10-23 09:32
 楼主| 发表于 2014-10-25 17:28:37 | 显示全部楼层
Gu_xl 发表于 2014-10-22 20:11
提供两个图层状态存储和恢复的函数如下:
[/post]

膜拜中
发表于 2016-5-4 00:05:28 | 显示全部楼层
想学习下,看不到啊[em0]
发表于 2016-5-5 21:22:57 | 显示全部楼层
手机能看,电脑看不了
发表于 2019-7-12 10:51:19 | 显示全部楼层
好帖子 谢谢i!
发表于 2019-8-25 17:28:09 | 显示全部楼层
好东西。谢谢LZ的分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-18 16:02 , Processed in 0.207645 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表