乐筑天下

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

[编程交流] 愚蠢的问题?

[复制链接]

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 11:27:22 | 显示全部楼层
没有愚蠢的问题,只有愚蠢的人。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:30:44 | 显示全部楼层
选择现有块并将其转换为VLA对象,然后根据Alan的示例修改特性。
回复

使用道具 举报

62

主题

466

帖子

404

银币

后起之秀

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

铜币
310
发表于 2022-7-6 11:32:15 | 显示全部楼层
谢谢你为我指明了正确的方向
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:35:39 | 显示全部楼层
这些可能也有帮助——它们需要重写一下,但它们应该可以工作:
http://www.cadtutor.net/forum/showpost.php?p=323818&postcount=4
回复

使用道具 举报

62

主题

466

帖子

404

银币

后起之秀

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

铜币
310
发表于 2022-7-6 11:38:23 | 显示全部楼层
其实我在前一段时间保存了这个。。。我不知道为什么我没有回去。我是个白痴!谢谢
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:43:40 | 显示全部楼层
不客气
回复

使用道具 举报

1

主题

7

帖子

6

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 11:46:58 | 显示全部楼层
因为我是个哑巴:
 
我目前正在编写两个lisp例程(理论上)用于为“n”个实体重复相同的命令集。现在两者都有相同的错误。
 
第一次重复很好。然而,第二轮它抛出了错误“参数太少”。
 
无论如何,以下是代码:
 
  1. ;============ Noise-RD.LSP ==================
  2. ;By Tristan Sly
  3. ;============================================
  4. ;
  5. (Defun C:NRD ()
  6. (command "layer" "new" "G0-18h-DoMin-F" "")                                                                  ;Create layer for pl
  7. (command "layer" "new" "G0-18h-DoMin-Tag" "")                                                                ;Create layer for tag
  8. (command "layer" "new" "G0-18h-DoMin-Block" "")                                                              ;Create layer for block
  9. (command "change" "all" "" "p" "LA" "G0-18h-DoMin-F" "")                                                          ; move rd plines to layer
  10. (command "layer" "set" "G0-18h-DoMin-Tag" "")                                                                     ; set layer
  11. (command "attdef" "" "tag" "prompt" "defaultvalue" "976.1774,821.7919" "2.500" "0" )                              ; Create attribute 1
  12. (command "attdef" "" "tag2" "prompt2" "defaultvalue2" "976.1774,821.7919" "2.500" "0" )                           ; Create attribute 2
  13. (command "attdef" "" "tag3" "prompt3" "defaultvalue3" "976.1774,821.7919" "2.500" "0" )                           ; Create attribute 3
  14. (command "layer" "set" "G0-18h-DoMin-Block" "")                                                                   ; set layer
  15. (command "block" "populate" "976.1774,821.7919,0.000" (ssget "x" (list (cons 10 (list 976.1774 821.7919 0.00)))) "")   ;create block                                                               
  16. (Command "insert" "populate" "976.1774,821.7919" "" "" "" "" "" "")
  17. (command "layer" "set" "G0-18h-DoMin-Tag" "")                                                                     ; set layer
  18. (command "attdef" "" "tag" "prompt" "defaultvalue" "1463.9181,758.8268" "2.500" "0" )                              ; Create attribute 1
  19. (command "attdef" "" "tag2" "prompt2" "defaultvalue2" "1463.9181,758.8268" "2.500" "0" )                           ; Create attribute 2
  20. (command "attdef" "" "tag3" "prompt3" "defaultvalue3" "1463.9181,758.8268" "2.500" "0" )                           ; Create attribute 3
  21. (command "layer" "set" "G0-18h-DoMin-Block" "")                                                                   ; set layer
  22. (command "block" "populate1" "1463.9181,758.8268,0.000" (ssget "y" (list (cons 10 (list 1463.9181 758.8268 0.00)))) "") ;create block                                                                 
  23. (Command "insert" "populate1" "1463.9181,758.8268" "" "" "" "" "" "")
  24. ;repeat ad nauseum
  25. (command "attdisp" "off")
  26. (Princ)                                                                        ;clean exit
  27. )
  28. (princ "\n\tc:type NRD to start")

 

 
  1. ;============ Noise-RDL.LSP ==================
  2. ;By Tristan Sly
  3. ;============================================
  4. ;
  5. (Defun C:NRDL ()
  6. (command "layer" "new" "me" "")
  7. (command "change" (ssget "x" (list (cons 10 (list 976.1774 821.7919 0.00)))) "" "p" "la" "me" "" "")
  8. (command "layer" "new" "me1" "")
  9. (command "change" (ssget "y" (list (cons 10 (list 1635.2095 560.6183 0.00)))) "" "p" "la" "me1" "" "")
  10. (Princ)                                                                        
  11. )
  12. (princ "\n\tc:type NRDL to start")

 
我猜测这与第二个ssget有关,因为在这一点上,两个错误都会发生,但我不理解为什么,因为它对第一个实体很好。
 
救命啊!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:49:30 | 显示全部楼层
我认为不存在ssget模式“y”。
 
阅读以下内容:
 
  1. SSGET
  2. the underscore (_) is needed with W, F, WP, :S but not with X, A, C, CP, I, L, P, :E ...
  3. (ssget '(2 2))
  4. Create a selection set of the object passing through (2,2):
  5.                                                                                              
  6. +.  The undocumented “+.” mode forces (ssget) to remain in “point” mode, similar to
  7.    setting PickAuto to 0.... the "+." puts (ssget) into "point" mode. It helps the ":S"
  8.    single-mode act just like (entsel) by avoiding implied selection windows.
  9. A  All like "X" but filters frozen out
  10.   Selects all objects on thawed layers.
  11. B  Box
  12.   Selects all objects inside or crossing a rectangle specified by two points. If
  13.   the rectangle's points are specified from right to left, Box is equivalent to
  14.   Crossing. Otherwise, Box is equivalent to Window.
  15. C  Crossing  Simular to Window selection
  16.   Selects objects within and crossing an area defined by two points. A crossing
  17.   selection is displayed as dashed or otherwise highlighted to differentiate it
  18.   from window selection. Specifying the corners from right to left creates a
  19.   crossing selection. *** (Specifying the corners from left to right creates a window
  20.   selection.)  (ssget "_C" '(0 0) '(1 1))
  21.   Caution: the area must be on the screen for this to work properly - CAB
  22.   
  23. CP Crossing Polygon
  24.   Selects objects within and crossing a polygon defined by specifying points. The
  25.   polygon can be any shape but cannot cross or touch itself. AutoCAD draws the
  26.   last segment of the polygon so that it is closed at all times. CPolygon is not
  27.   affected by the PICKADD system variable.
  28.   (ssget "_CP" '((1 1)(3 1)(5 2)(2 4)))
  29.   Example with filters (ssget "_CP" '(Point list) '(Filter List))
  30.   (setq ss (ssget "_CP" '((0 0)(10 0)(10 10)(0 10)) '((0 . "INSERT") (66 . 1))  ))
  31.   Caution: the area must be on the screen for this to work properly - CAB
  32.   (vl-cmdf "._zoom" "_E") ; Extents
  33.   
  34. Duplicates OK, else duplicates are ignored
  35. :E Everything in aperture
  36.   Everything within the cursor's object selection pickbox.
  37. F Fence
  38. Selects all objects crossing a selection fence. The Fence method is similar to
  39. CPolygon except that AutoCAD does not close the fence, and a fence can cross
  40. itself. Fence is not affected by the PICKADD system variable.
  41. G Groups
  42. Selects all objects within a specified group.
  43. I Implied
  44. Implied selection (objects selected while PICKFIRST is in effect).
  45. L Last
  46. Last visible object added to the database
  47. :L Rejects locked layers
  48. M  Multiple
  49.   Specifies multiple points without highlighting the objects, thus speeding up
  50.   the selection process for complex objects. The Multiple method also selects two
  51.   intersecting objects if the intersection point is specified twice.
  52. :N Nested
  53.   Call ssnamex for additional information on container blocks and transformation
  54.   matrices for any entities selected during the ssget operation. This additional
  55.   information is available only for entities selected via graphical selection
  56.   methods such as Window, Crossing, and point picks.
  57.   
  58.   Unlike the other object selection methods, :N may return multiple entities with
  59.   the same entity name in the selection set. For example, if the user selects a
  60.   subentity of a complex entity such as a BlockReference, PolygonMesh, or old
  61.   style polyline, ssget looks at the subentity that is selected when determining
  62.   if it has already been selected. However,  ssget actually adds the main entity
  63.   (BlockReference, PolygonMesh, etc.) to the selection set. The result could be
  64.   multiple entries with the same entity name in the selection set (each will have
  65.   different subentity information for ssnamex to report).
  66. P  Previous
  67.   Selects the most recent selection set. The Previous selection set is cleared by
  68.   operations that delete objects from the drawing. AutoCAD keeps track of whether
  69.   each selection set was specified in model space or paper space. The Previous
  70.   selection set is ignored if you switch spaces.
  71. Rejects Viewport
  72. :R Allows entities in a long transaction to be selected.
  73. :S Force single object selection only
  74. :U Enables subentity selection - 2006+
  75. Cannot be combined with the  duplicate (":D") or nested (":N")  selection modes.
  76. In this  mode, top-level  entities are  selected by  default, but  the user  can
  77. attempt  to  select  subentities  by pressing  the  CTRL  key  while making  the
  78. selection. This option  is supported only  with interactive selections,  such as
  79. window, crossing, and polygon. It is  not supported for all, filtered, or  group
  80. selections.
  81. :V Forces subentity selection - 2006+
  82. Treats all interactive,  graphic selections performed  by the user  as subentity
  83. selections. The returned  selection set contains  subentities only. This  option
  84. cannot be combined with the  duplicate (":D") or nested (":N")  selection modes.
  85. This option is  supported only with  interactive selections, such  as window and
  86. crossing. It is not supported for all, filtered, or group selections.
  87. W  Window
  88.   Selects all objects completely inside a rectangle defined by two points.
  89.   Specifying the corners from left to right creates a window selection.
  90.   (Specifying the corners from right to left creates a crossing selection.)
  91. WP Window Polygon
  92.   Selects objects completely inside a polygon defined by points. The polygon can
  93.   be any shape but cannot cross or touch itself. AutoCAD draws the last segment of
  94.   the polygon so that it is closed at all times. WPolygon is not affected by the
  95.   PICKADD system variable.
  96. X  Extended search (search whole database)
  97.   Entire database. If you specify the X selection method and do not provide a
  98.   filter-list, ssget selects all entities in the database, including entities on
  99.   layers that are off, frozen, and out of the visible screen.
  100.   
  101.   Also at the command prompt "Select objects:" you can enter
  102.   Add, Remove, Undo,
  103. :U Enables subentity selection. Cannot be combined with the duplicate (":D") or
  104.   nested (":N") selection modes. In this mode, top-level entities are selected by
  105.   default, but the user can attempt to select subentities by pressing the CTRL key
  106.   while making the selection. This option is supported only with interactive
  107.   selections, such as window, crossing, and polygon. It is not supported for all,
  108.   filtered, or group selections.
  109. :V Forces subentity selection. Treats all interactive, graphic selections
  110.   performed by the user as subentity selections. The returned selection set
  111.   contains subentities only. This option cannot be combined with the duplicate
  112.   (":D") or nested (":N") selection modes. This option is supported only with
  113.   interactive selections, such as window and crossing. It is not supported for
  114.   all, filtered, or group selections.
  115. Systen Var
  116. PICKADD controls whether subsequent selections replace the current selection set or add to it.
回复

使用道具 举报

1

主题

7

帖子

6

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 11:53:16 | 显示全部楼层
这是有道理的,但是当我重复“x”模式时,它仍然失败。它没有运行ssget,而是尝试重复defun。
 
但仅在第一层,出于某种原因,第一块正在工作。
 
我从命令行获得以下信息:
 
  1. c:type NRDL to start
  2. Command:
  3. Command: nrdl
  4. layer
  5. Current layer:  "0"
  6. Enter an option
  7. [?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock
  8. /stAte]: new
  9. Enter name list for new layer(s): me Enter an option
  10. [?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock
  11. /stAte]:
  12. Command: change
  13. Select objects:   1 found
  14. Select objects: Specify change point or [Properties]: p
  15. Enter property to change
  16. [Color/Elev/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]: la
  17. Enter new layer name <0>: me
  18. Enter property to change
  19. [Color/Elev/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]:
  20. Command: NRDL Unknown command "NRDL".  Press F1 for help.
  21. Command: layer
  22. Current layer:  "0"
  23. Enter an option
  24. [?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock
  25. /stAte]: new
  26. Enter name list for new layer(s): me1 Enter an option
  27. [?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock
  28. /stAte]:
  29. Command: change
  30. Select objects:
  31. Command: NRDL Unknown command "NRDL".  Press F1 for help.
  32. Command: p Unknown command "P".  Press F1 for help.
  33. Command: la Unknown command "LA".  Press F1 for help.
  34. Command: me1 Unknown command "ME1".  Press F1 for help.
  35. Command: NRDL Unknown command "NRDL".  Press F1 for help.
  36. Command: NRDL Unknown command "NRDL".  Press F1 for help.
  37. Command:
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:55:49 | 显示全部楼层
当使用的“”尝试重复该命令时,您正在接收的未知命令。
 
ssget可能将nil返回到命令行,因此取消了该命令,因此“”试图重复最后一个命令。
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-6 11:58 , Processed in 0.440935 second(s), 70 queries .

© 2020-2025 乐筑天下

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