乐筑天下

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

[编程交流] 层状态通过lisp应用?

[复制链接]

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 23:30:26 | 显示全部楼层 |阅读模式
好的,我想做的是一个lisp文件,可以运行它来加载保存的。las(图层状态)文件,并将其设置为当前。有人对此有什么想法吗?我知道我可以手动一次处理一个文件,但是我有170多个文件,这会花费很长时间,我只是不知道命令行会是什么样子。如果有人能帮我写这篇文章,我想它真的会让layerstate自动化对每个人来说都很棒。将其设置为在夜间或空的工作站上运行,然后在早上进入,您的操作对我来说似乎很有用。
 
任何帮助都将不胜感激
 
JTK公司
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-5 23:35:10 | 显示全部楼层
尝试layerstate-*命令。
 
直接从帮助:
  1. [list]
  2. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ffd9a7a610ecb0483d5-67f2.htm"]layerstate-addlayers[/url]  
  3. Adds or updates a  series of layers to a layer state
  4. [*][url="http://www.cadtutor.net/forum/WS73099cc142f487551ec84dc1111af5a7b7-7c9c.htm"]layerstate-compare[/url]  
  5. Compares a layerstate  to the layers in the current drawing
  6. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ffd9a7a610ecb0483d5-67df.htm"]layerstate-delete[/url]  
  7. Deletes a layer  state
  8. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ffd9a7a610ecb0483d5-67bd.htm"]layerstate-export[/url]  
  9. Exports a layer state  to a specified file
  10. [*][url="http://www.cadtutor.net/forum/WS73099cc142f487551ec84dc1111af5a7b7-7c8f.htm"]layerstate-getlastrestored[/url]  
  11. Returns the  name of the last restored layer state in the current drawing
  12. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ffd9a7a610ecb0483d5-67ca.htm"]layerstate-getlayers[/url]  
  13. Returns the layers  saved in a layer state
  14. [*][url="http://www.cadtutor.net/forum/WS73099cc142f487551ec84dc1111af5a7b7-7c8a.htm"]layerstate-getnames[/url]  
  15. Returns a list of the  layer state names
  16. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ffd9a7a610ecb0483d5-67e5.htm"]layerstate-has[/url]  
  17. Checks if a layer state is  present
  18. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ffd9a7a610ecb0483d5-67c3.htm"]layerstate-import[/url]  
  19. Imports a layer state  from a specified file
  20. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ff1b508da11142adfd67-7f9c.htm"]layerstate-importfromdb[/url]  
  21. Imports a layer  state from a specified drawing file
  22. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ff1b508da11142adfd67-7f94.htm"]layerstate-removelayers[/url]  
  23. Removes a list of  layers from a layer state
  24. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ffd9a7a610ecb0483d5-67d9.htm"]layerstate-rename[/url]  
  25. Renames a layer  state
  26. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ffd9a7a610ecb0483d5-67b6.htm"]layerstate-restore[/url]  
  27. Restores a layer state  into the current drawing
  28. [*][url="http://www.cadtutor.net/forum/WS1a9193826455f5ffd9a7a610ecb0483d5-67d2.htm"]layerstate-save[/url]  
  29. Saves a layer state in  the current drawing
  30. [/list]
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 23:37:35 | 显示全部楼层
这就是我得到并将继续得到的
“命令:layerstate importfromdb
未知命令“LAYERSTATE-IMPORTFROMDB”。按F1键获取帮助。"
 
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 23:43:09 | 显示全部楼层
 
这是一个AutoLISP函数,不是命令-请阅读VLIDE帮助文档。
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 23:44:50 | 显示全部楼层
我太迷路了哈哈!对不起大家,我确实收到了一条非常有趣的消息。我想和大家分享一下,也许会朝着这个方向发展。
 
  1. No need to run this on another machine - ObjectDBX only needs +/-20 seconds to open, change the layer state, and save all 170 drawings.
  2. THAT is why I suggested it... it's lightning fast!!!
  3. However, there are some restrictions....
  4. For example, you cannot issue normal AutoCAD commands like ._qsave, and ._close. You MUST use Visual LISP syntax functions like vla-open, and vla-close found within the ActiveX COM API.
  5. You can read more about ObjectDBX here, as well as learn some basics for good programming:
  6. Good Habits for Coding in Visual LISP
  7. Here's an excerpt:
  8.                                                         Efficiently Opening Files, or “Warp Speed, Captain!”
  9. ObjectDBX allows you to access drawings without loading them in the  drawing editor. This results in a huge improvement in processing speed  at the expense of not having the user interface. The lack of a user  interface means that you cannot use selection sets. There may also be  issues when modifying objects such as attributes. It is also useful for  decomposing complex objects without the risk of modifying the original  object or its host drawing.
  10. The performance gains make ObjectDBX an excellent tool for querying  multiple drawings. For example, many firms have developed applications  that allow them to create and maintain sheet indexes across hundreds of  drawings in seconds rather than hours.
  11. ObjectDBX cannot directly work on drawings that are read-only or  templates. Therefore, a simple wrapper function that detects those  conditions and provides a temporary drawing file to use in such a case  is useful.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 23:47:55 | 显示全部楼层
如果您希望使用ObjectDBX,这可能会对您有所帮助。
 
http://lee-mac.com/odbxbase.html
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-5 23:51:38 | 显示全部楼层
这是一个函数,不是命令。
呼叫方式:
  1. (layerstate-import <FileNamehere>)

 
003029jdikfux6a5dkagdu.png
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 23:53:44 | 显示全部楼层
是的,我理解,现在的问题是如何将其应用于lisp或objectDBX?代码是什么?请记住,我正在尝试从导入的las文件恢复layerstate
 
 
当你转到autocad 2011时,我再也看不到帮助屏幕了。你使用的在线帮助更像是没有答案的在线循环。
 
回复

使用道具 举报

11

主题

968

帖子

919

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
99
发表于 2022-7-5 23:57:25 | 显示全部楼层
假设您的LAS文件是c:\Test。LAS中的状态称为StateTest。您可以将其输入到当前图形,因此:
现在设置模型空间的状态测试:
如果只想将状态恢复到视口,则需要首先获取VP的ename。E、 g.如果要将状态恢复到当前DWG中的所有视口,并使用视口覆盖,而不是为所有图层设置颜色和线型:
  1. (setq ss (ssget "_X" '((0 . "VIEWPORT"))) n (sslength ss))
  2. (while (>= (setq n (1- n)) 0)
  3. (layerstate-restore "StateTest" (ssname ss n) 4)
  4. )
回复

使用道具 举报

4

主题

22

帖子

18

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 00:00:10 | 显示全部楼层
irneb,我非常感谢你的帮助。
 
首先,我将把这些更改应用于图纸文件,而不是按视口,因此我假设它是与模型空间相同的方法。
 
我需要(命令)或(defun)什么吗?或者Lisp程序需要这样吗?
 
  1. ;
  2. (defun c:test)
  3. (if (layerstate-import "I:\DRAWINGS\090-0056 LFMP\Common\ME_Layer_State.las")
  4. (princ "ME_Layer_State.las has been imported.")
  5. (princ "There was an error importing ME_Layer_State.las")
  6. )
  7. (if (layerstate-restore "ME_Layer_State" nil)
  8. (princ "ME_Layer_State has been restored.")
  9. (princ "There's an error restoring ME_Layer_State")
  10. )
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 01:29 , Processed in 0.628053 second(s), 74 queries .

© 2020-2025 乐筑天下

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