乐筑天下

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

[编程交流] 我在哪里可以找到#039;c组

[复制链接]

76

主题

312

帖子

254

银币

后起之秀

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

铜币
390
发表于 2022-7-5 16:58:23 | 显示全部楼层 |阅读模式
大家好。
我正在构建一个lisp来生成/更改/复制层。
但我遗漏了几个“代码”。
 
到目前为止,我在这里:
 
  1. <lots of code>
  2. (setq layerinf (tblsearch "LAYER" currentlayer)) ;; get the layer data
  3. (setq layeronoff (cdr (assoc ?? layerinf))) ;; get the layer on/off
  4. (setq layerfreezethaw (cdr (assoc ?? layerinf))) ;; get the layer freeze/thaw
  5. (setq layerunlockedlocked (cdr (assoc ?? layerinf))) ;; get the layer unlocked/locked
  6. (setq layercol (cdr (assoc 70 layerinf))) ;; get the layer colour (woohoo got that one)
  7. (setq layerlinetype (cdr (assoc ?? layerinf))) ;; get the layer linetype
  8. (setq layerlineweight (cdr (assoc ?? layerinf))) ;; get the layer lineweight
  9. (setq layertrans (cdr (assoc ?? layerinf))) ;; get the layer transparency
  10. (setq layerplot (cdr (assoc ?? layerinf))) ;; get the layer plot yes/no
  11. (setq layerNVPF (cdr (assoc ?? layerinf))) ;; get the layer new vieuwport freeze
  12. (setq layerdiscription (cdr (assoc ?? layerinf))) ;; get the layer discription
  13. <lots of code>

 
有什么方法可以让我自己找到任务编号吗???
回复

使用道具 举报

0

主题

61

帖子

62

银币

限制会员

铜币
-1
发表于 2022-7-5 17:03:19 | 显示全部楼层
http://www.autodesk.com/techpubs/autocad/acadr14/dxf/
回复

使用道具 举报

18

主题

1529

帖子

973

银币

中流砥柱

Rank: 25

铜币
649
发表于 2022-7-5 17:09:50 | 显示全部楼层
要在谷歌上查找最新信息:
  1. AutoCAD DXF Reference
回复

使用道具 举报

76

主题

312

帖子

254

银币

后起之秀

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

铜币
390
发表于 2022-7-5 17:16:01 | 显示全部楼层
我发现并不是所有的图层属性都可以通过这种方法复制到setq。如何复制层并为其命名。使用选定对象的层作为参考?
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 17:19:36 | 显示全部楼层
 
考虑以下功能:
  1. ;; Copy Layer  -  Lee Mac
  2. ;; Copies a layer, retaining all properties
  3. ;; src - [str] Layer to copy
  4. ;; new - [str] Layer name for copy
  5. ;; Returns: [ent] Entity name of new layer
  6. (defun LM:copylayer ( src new / lay )
  7.    (if (setq lay (tblobjname "layer" src))
  8.        (entmakex
  9.            (setq lay (entget lay)
  10.                  lay (subst (cons 2 new) (assoc 2 lay) (vl-remove-if '(lambda ( x ) (member (car x) '(102 360))) lay))
  11.            )
  12.        )
  13.    )
  14. )
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

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

铜币
325
发表于 2022-7-5 17:21:51 | 显示全部楼层
我认为OP有学习潜力,下面是一些教程:
  1. [b][color=BLACK]([/color][/b]defun C:test
  2. [b][color=FUCHSIA]([/color][/b] / myLoop NewLayerName e LyrName LyrEname LyrDXF [b][color=FUCHSIA])[/color][/b] [color=#8b4513]; declare our local variables - everything thats used with [b][color=FUCHSIA]([/color][/b]setq[b][color=FUCHSIA])[/color][/b] [ unless we know what we're doing ][/color]
  3. [b][color=FUCHSIA]([/color][/b]setq myLoop T[b][color=FUCHSIA])[/color][/b] [color=#8b4513]; define a flag which is [color=#2f4f4f]"True"[/color][/color]
  4. [b][color=FUCHSIA]([/color][/b]while myLoop [color=#8b4513]; construct a pseudo-loop[/color]
  5.         [b][color=NAVY]([/color][/b]setq NewLayerName [b][color=MAROON]([/color][/b]getstring t [color=#2f4f4f]"\nSpecify new layer name: "[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [color=#8b4513]; prompt user for a layer name[/color]
  6.         [b][color=NAVY]([/color][/b]cond [color=#8b4513]; start analysing whats provided from the user[/color]
  7.                 [b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]not [b][color=BLUE]([/color][/b]snvalid NewLayerName[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]  
  8.                         [b][color=GREEN]([/color][/b]princ [color=#2f4f4f]"\nInvalid layer name is specified."[/color][b][color=GREEN])[/color][/b]
  9.                 [b][color=MAROON])[/color][/b]
  10.                 [b][color=MAROON]([/color][/b][b][color=GREEN]([/color][/b]tblobjname [color=#2f4f4f]"LAYER"[/color] NewLayerName[b][color=GREEN])[/color][/b]  
  11.                         [b][color=GREEN]([/color][/b]princ [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"\n "[/color][color=#2f4f4f]" NewLayerName "[/color]\[color=#2f4f4f]" already exists."[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
  12.                 [b][color=MAROON])[/color][/b]
  13.                 [b][color=MAROON]([/color][/b]NewLayerName [color=#8b4513]; NewLayerName is provided, and the above statements guarantee everything is OK.[/color]
  14.                         [b][color=GREEN]([/color][/b]setq myLoop nil[b][color=GREEN])[/color][/b] [color=#8b4513]; stop the loop and continue[/color]
  15.                 [b][color=MAROON])[/color][/b]
  16.                 [b][color=MAROON]([/color][/b]T nil[b][color=MAROON])[/color][/b] [color=#8b4513]; otherwise do nothing[/color]
  17.         [b][color=NAVY])[/color][/b][color=#8b4513]; cond[/color]
  18. [b][color=FUCHSIA])[/color][/b][color=#8b4513]; while[/color]
  19. [b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]setq e [b][color=MAROON]([/color][/b]car [b][color=GREEN]([/color][/b]entsel [color=#2f4f4f]"\nSelect object on a layer to copy its properties: "[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [color=#8b4513]; prompt user to select an entity[/color]
  20.         [b][color=NAVY]([/color][/b]progn [color=#8b4513]; if entity is selected do the following:[/color]
  21.                 [b][color=MAROON]([/color][/b]setq LyrName [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 8 [b][color=RED]([/color][/b]entget e[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [color=#8b4513]; get the entity's layer name[/color]
  22.                 [b][color=MAROON]([/color][/b]setq LyrEname [b][color=GREEN]([/color][/b]tblobjname [color=#2f4f4f]"LAYER"[/color] LyrName[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [color=#8b4513]; get the layer's ENAME[/color]
  23.                 [b][color=MAROON]([/color][/b]setq LyrDXF [b][color=GREEN]([/color][/b]entget LyrEname[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [color=#8b4513]; get the layer's DXF data[/color]
  24.                 [b][color=MAROON]([/color][/b]entmakex [color=#8b4513]; create the layer, using the modified DXF list[/color]
  25.                         [b][color=GREEN]([/color][/b]subst [b][color=BLUE]([/color][/b]cons 2 NewLayerName[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]assoc 2 LyrDXF[b][color=BLUE])[/color][/b] [color=#8b4513]; change/substitute the Layer's name in the DXF list[/color]
  26.                                 [b][color=BLUE]([/color][/b]vl-remove-if '[b][color=RED]([/color][/b]lambda [b][color=PURPLE]([/color][/b]x[b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]member [b][color=TEAL]([/color][/b]car x[b][color=TEAL])[/color][/b] '[b][color=TEAL]([/color][/b] -1 330 5 [color="red"]102 360[/color] 390 347 348[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b] LyrDXF[b][color=BLUE])[/color][/b] [color=#8b4513]; remove unwanted group codes from the existing the DXF list and keep the rest[/color]
  27.                         [b][color=GREEN])[/color][/b][color=#8b4513]; subst[/color]
  28.                 [b][color=MAROON])[/color][/b][color=#8b4513]; entmakex[/color]
  29.                 [b][color=MAROON]([/color][/b]setvar 'clayer NewLayerName[b][color=MAROON])[/color][/b] [color=#8b4513]; set the newly created layer as current[/color]
  30.         [b][color=NAVY])[/color][/b][color=#8b4513]; progn[/color]
  31. [b][color=FUCHSIA])[/color][/b][color=#8b4513]; if e[/color]
  32. [b][color=FUCHSIA]([/color][/b]princ[b][color=FUCHSIA])[/color][/b][color=#8b4513]; exit cleanly[/color]
  33. [b][color=BLACK])[/color][/b][color=#8b4513]; defun[/color]
  34. [b][color=BLACK]([/color][/b]vl-load-com[b][color=BLACK])[/color][/b][color=#8b4513]; load the visual lisp extensions[/color]
回复

使用道具 举报

18

主题

1529

帖子

973

银币

中流砥柱

Rank: 25

铜币
649
发表于 2022-7-5 17:30:27 | 显示全部楼层
有趣的是,Lee和Grrr正在从源实体列表中删除不同的组码。我将使用李的列表,但添加-1和5(不是因为这是必需的,而是为了清楚起见)。
 
@Grrr:
将层覆盖应用于层,并了解有关gc 102和360的更多信息。
gc 348用于什么?
回复

使用道具 举报

76

主题

312

帖子

254

银币

后起之秀

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

铜币
390
发表于 2022-7-5 17:31:25 | 显示全部楼层
大家好,谢谢你们的密码。
 
上周,我阅读了AfraLisp、CadTutor、Lee Mac和JefferySanders的所有教程。
到目前为止,我学到了很多,现在我正在尝试使用一切
尽管我必须说,我找不到很多使用“vlax”方法的教程???
 
在我发表最初的帖子之前,这就是我所拥有的。
  1. (defun C:WisselStatus()
  2. (setvar "cmdecho" 0)
  3. (command "UNDO" "BEGIN")
  4. (setq objecten (ssget ":L"))
  5. (initget "B V T N R X")
  6. (setq nieuwestatus (getkword "\nWissel status naar: [bestaand/Vervallen/Tijdelijk/Nieuw/Revisie/X(onafhankelijk)]: "))
  7. (if (= nieuwestatus nil)
  8.         (progn
  9.         (princ "\nLagen ongewijzigd...")
  10.         )
  11.         (progn
  12.                 (setq i 0 n 0)
  13.                 (setq userlayer (getvar "CLAYER"))
  14.                 (setq n (sslength objecten))
  15.                 (repeat n
  16.                         (setq e (ssname objecten i)) ;get an ename
  17.                         (setq enx (entget e)) ; get entity's data
  18.                         (setq currentlayer (cdr (assoc 8 enx))) ;get entity's layer
  19.                         (setq newlayer (strcat nieuwestatus (substr currentlayer 2))) ; set the new layer name for entity's
  20.                         (if (tblsearch "LAYER" newlayer)
  21.                                 (progn ;direct verplaatsen
  22.                                 (setq enx (subst (cons 8 newlayer) (assoc 8 enx) enx)) ;change (substitute) the layer association of its data
  23.                                 (entmod enx) ; modify the entity
  24.                                 )
  25.                                 (progn ;eerst laag aanmaken en dan verplaatsen
  26.                                 (setq layerinfo (tblsearch "LAYER" currentlayer)) ;get the layer data
  27.                                          (setq layercolor (cdr (assoc 62 layerinfo))) ;get the layer colour
  28.                                          (setq layerlinetype (cdr (assoc 6 layerinfo))) ;get the layer linetype
  29.                                 (command "-Layer" "M" newlayer "C" layercolor "" "L" layerlinetype "" "")
  30.                                 (setq enx (subst (cons 8 newlayer) (assoc 8 enx) enx)) ;change (substitute) the layer association of its data
  31.                                 (entmod enx) ; modify the entity
  32.                                 (command "-purge" "LA" currentlayer "" "Y")
  33.                                 )
  34.                         )
  35.                 (setq i (1+ i))
  36.                 )
  37.         )
  38. )
  39. (if (tblsearch "LAYER" userlayer)
  40. (setvar "CLAYER" userlayer)
  41. (setvar "CLAYER" newlayer)
  42. )
  43. (command "UNDO" "END")
  44. (setvar "cmdecho" 1)
  45. (princ)
  46. )
  47. (princ)

 
今天晚些时候,我会尝试插入给定的代码,但只是想说明我目前的困境。。。
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

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

铜币
325
发表于 2022-7-5 17:36:49 | 显示全部楼层
 
谢谢你,罗伊,我还没想过要被否决。
这是我检查一些图层时的dxf列表:
175825ixxkqen2ezp5xv5u.jpg
我认为删除带有ename和句柄GC的所有GC是合乎逻辑的。我学习了LM的Entmake函数,因此留下了其他表示层属性和子类标记的GC。
 
关于GC 348,我找不到任何信息,也没有权限检查,因为我在尝试时收到错误:
175826ea9r534rs94symus.jpg
 
但这个名称对我来说很熟悉,所以我发现它指的是(namedobjdict)名称:
175827ydzhii58b451r88k.jpg
 
顺便说一句,当我对同一层应用覆盖时,又出现了一个GC 390:
175830odza3qooimzrpprq.jpg
Inspect工具显示其:(0。“ACDBPLACEHOLDER”)-为什么不也删除它?
回复

使用道具 举报

18

主题

1529

帖子

973

银币

中流砥柱

Rank: 25

铜币
649
发表于 2022-7-5 17:41:07 | 显示全部楼层
具有覆盖(而非可见性覆盖)的图层将具有扩展字典。因此,其实体列表中存在组码102和360。
组码348的存在令人惊讶。尤其是因为它没有引用实际实体。对我来说似乎是个虫子。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 13:10 , Processed in 0.380123 second(s), 74 queries .

© 2020-2025 乐筑天下

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