alanjt 发表于 2022-7-6 11:27:22

没有愚蠢的问题,只有愚蠢的人。

Lee Mac 发表于 2022-7-6 11:30:44

选择现有块并将其转换为VLA对象,然后根据Alan的示例修改特性。

Lt Dan's l 发表于 2022-7-6 11:32:15

谢谢你为我指明了正确的方向

Lee Mac 发表于 2022-7-6 11:35:39

这些可能也有帮助——它们需要重写一下,但它们应该可以工作:
http://www.cadtutor.net/forum/showpost.php?p=323818&postcount=4

Lt Dan's l 发表于 2022-7-6 11:38:23

其实我在前一段时间保存了这个。。。我不知道为什么我没有回去。我是个白痴!谢谢

Lee Mac 发表于 2022-7-6 11:43:40

不客气

Lord V 发表于 2022-7-6 11:46:58

因为我是个哑巴:
 
我目前正在编写两个lisp例程(理论上)用于为“n”个实体重复相同的命令集。现在两者都有相同的错误。
 
第一次重复很好。然而,第二轮它抛出了错误“参数太少”。
 
无论如何,以下是代码:
 

;============ Noise-RD.LSP ==================
;By Tristan Sly
;============================================
;
(Defun C:NRD ()

(command "layer" "new" "G0-18h-DoMin-F" "")                                                                  ;Create layer for pl
(command "layer" "new" "G0-18h-DoMin-Tag" "")                                                                ;Create layer for tag
(command "layer" "new" "G0-18h-DoMin-Block" "")                                                            ;Create layer for block
(command "change" "all" "" "p" "LA" "G0-18h-DoMin-F" "")                                                          ; move rd plines to layer

(command "layer" "set" "G0-18h-DoMin-Tag" "")                                                                     ; set layer

(command "attdef" "" "tag" "prompt" "defaultvalue" "976.1774,821.7919" "2.500" "0" )                              ; Create attribute 1
(command "attdef" "" "tag2" "prompt2" "defaultvalue2" "976.1774,821.7919" "2.500" "0" )                           ; Create attribute 2
(command "attdef" "" "tag3" "prompt3" "defaultvalue3" "976.1774,821.7919" "2.500" "0" )                           ; Create attribute 3
(command "layer" "set" "G0-18h-DoMin-Block" "")                                                                   ; set layer

(command "block" "populate" "976.1774,821.7919,0.000" (ssget "x" (list (cons 10 (list 976.1774 821.7919 0.00)))) "")   ;create block                                                               
(Command "insert" "populate" "976.1774,821.7919" "" "" "" "" "" "")

(command "layer" "set" "G0-18h-DoMin-Tag" "")                                                                     ; set layer

(command "attdef" "" "tag" "prompt" "defaultvalue" "1463.9181,758.8268" "2.500" "0" )                              ; Create attribute 1
(command "attdef" "" "tag2" "prompt2" "defaultvalue2" "1463.9181,758.8268" "2.500" "0" )                           ; Create attribute 2
(command "attdef" "" "tag3" "prompt3" "defaultvalue3" "1463.9181,758.8268" "2.500" "0" )                           ; Create attribute 3
(command "layer" "set" "G0-18h-DoMin-Block" "")                                                                   ; set layer

(command "block" "populate1" "1463.9181,758.8268,0.000" (ssget "y" (list (cons 10 (list 1463.9181 758.8268 0.00)))) "") ;create block                                                               
(Command "insert" "populate1" "1463.9181,758.8268" "" "" "" "" "" "")

;repeat ad nauseum

(command "attdisp" "off")

(Princ)                                                                        ;clean exit
)
(princ "\n\tc:type NRD to start")

 

 

;============ Noise-RDL.LSP ==================
;By Tristan Sly
;============================================
;
(Defun C:NRDL ()

(command "layer" "new" "me" "")
(command "change" (ssget "x" (list (cons 10 (list 976.1774 821.7919 0.00)))) "" "p" "la" "me" "" "")

(command "layer" "new" "me1" "")
(command "change" (ssget "y" (list (cons 10 (list 1635.2095 560.6183 0.00)))) "" "p" "la" "me1" "" "")

(Princ)                                                                        
)
(princ "\n\tc:type NRDL to start")

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

Lee Mac 发表于 2022-7-6 11:49:30

我认为不存在ssget模式“y”。
 
阅读以下内容:
 

SSGET

the underscore (_) is needed with W, F, WP, :S but not with X, A, C, CP, I, L, P, :E ...

(ssget '(2 2))
Create a selection set of the object passing through (2,2):
                                                                                             
+.The undocumented “+.” mode forces (ssget) to remain in “point” mode, similar to
   setting PickAuto to 0.... the "+." puts (ssget) into "point" mode. It helps the ":S"
   single-mode act just like (entsel) by avoiding implied selection windows.

AAll like "X" but filters frozen out
Selects all objects on thawed layers.

BBox
Selects all objects inside or crossing a rectangle specified by two points. If
the rectangle's points are specified from right to left, Box is equivalent to
Crossing. Otherwise, Box is equivalent to Window.

CCrossingSimular to Window selection
Selects objects within and crossing an area defined by two points. A crossing
selection is displayed as dashed or otherwise highlighted to differentiate it
from window selection. Specifying the corners from right to left creates a
crossing selection. *** (Specifying the corners from left to right creates a window
selection.)(ssget "_C" '(0 0) '(1 1))
Caution: the area must be on the screen for this to work properly - CAB

CP Crossing Polygon
Selects objects within and crossing a polygon defined by specifying points. The
polygon can be any shape but cannot cross or touch itself. AutoCAD draws the
last segment of the polygon so that it is closed at all times. CPolygon is not
affected by the PICKADD system variable.
(ssget "_CP" '((1 1)(3 1)(5 2)(2 4)))
Example with filters (ssget "_CP" '(Point list) '(Filter List))
(setq ss (ssget "_CP" '((0 0)(10 0)(10 10)(0 10)) '((0 . "INSERT") (66 . 1))))
Caution: the area must be on the screen for this to work properly - CAB
(vl-cmdf "._zoom" "_E") ; Extents

Duplicates OK, else duplicates are ignored

:E Everything in aperture
Everything within the cursor's object selection pickbox.

F Fence
Selects all objects crossing a selection fence. The Fence method is similar to
CPolygon except that AutoCAD does not close the fence, and a fence can cross
itself. Fence is not affected by the PICKADD system variable.

G Groups
Selects all objects within a specified group.

I Implied
Implied selection (objects selected while PICKFIRST is in effect).

L Last
Last visible object added to the database

:L Rejects locked layers

MMultiple
Specifies multiple points without highlighting the objects, thus speeding up
the selection process for complex objects. The Multiple method also selects two
intersecting objects if the intersection point is specified twice.

:N Nested
Call ssnamex for additional information on container blocks and transformation
matrices for any entities selected during the ssget operation. This additional
information is available only for entities selected via graphical selection
methods such as Window, Crossing, and point picks.

Unlike the other object selection methods, :N may return multiple entities with
the same entity name in the selection set. For example, if the user selects a
subentity of a complex entity such as a BlockReference, PolygonMesh, or old
style polyline, ssget looks at the subentity that is selected when determining
if it has already been selected. However,ssget actually adds the main entity
(BlockReference, PolygonMesh, etc.) to the selection set. The result could be
multiple entries with the same entity name in the selection set (each will have
different subentity information for ssnamex to report).

PPrevious
Selects the most recent selection set. The Previous selection set is cleared by
operations that delete objects from the drawing. AutoCAD keeps track of whether
each selection set was specified in model space or paper space. The Previous
selection set is ignored if you switch spaces.

Rejects Viewport

:R Allows entities in a long transaction to be selected.

:S Force single object selection only

:U Enables subentity selection - 2006+
Cannot be combined with theduplicate (":D") or nested (":N")selection modes.
In thismode, top-levelentities areselected bydefault, butthe usercan
attempttoselectsubentitiesby pressingtheCTRLkeywhile makingthe
selection. This optionis supported onlywith interactive selections,such as
window, crossing, and polygon. It isnot supported for all, filtered, orgroup
selections.

:V Forces subentity selection - 2006+
Treats all interactive,graphic selections performedby the useras subentity
selections. The returnedselection set containssubentities only. Thisoption
cannot be combined with theduplicate (":D") or nested (":N")selection modes.
This option issupported only withinteractive selections, suchas window and
crossing. It is not supported for all, filtered, or group selections.

WWindow
Selects all objects completely inside a rectangle defined by two points.
Specifying the corners from left to right creates a window selection.
(Specifying the corners from right to left creates a crossing selection.)

WP Window Polygon
Selects objects completely inside a polygon defined by points. The polygon can
be any shape but cannot cross or touch itself. AutoCAD draws the last segment of
the polygon so that it is closed at all times. WPolygon is not affected by the
PICKADD system variable.

XExtended search (search whole database)
Entire database. If you specify the X selection method and do not provide a
filter-list, ssget selects all entities in the database, including entities on
layers that are off, frozen, and out of the visible screen.

Also at the command prompt "Select objects:" you can enter
Add, Remove, Undo,

:U Enables subentity selection. Cannot be combined with the duplicate (":D") or
nested (":N") selection modes. In this mode, top-level entities are selected by
default, but the user can attempt to select subentities by pressing the CTRL key
while making the selection. This option is supported only with interactive
selections, such as window, crossing, and polygon. It is not supported for all,
filtered, or group selections.

:V Forces subentity selection. Treats all interactive, graphic selections
performed by the user as subentity selections. The returned selection set
contains subentities only. This option cannot be combined with the duplicate
(":D") or nested (":N") selection modes. This option is supported only with
interactive selections, such as window and crossing. It is not supported for
all, filtered, or group selections.

Systen Var
PICKADD controls whether subsequent selections replace the current selection set or add to it.

Lord V 发表于 2022-7-6 11:53:16

这是有道理的,但是当我重复“x”模式时,它仍然失败。它没有运行ssget,而是尝试重复defun。
 
但仅在第一层,出于某种原因,第一块正在工作。
 
我从命令行获得以下信息:
 

c:type NRDL to start
Command:
Command: nrdl
layer
Current layer:"0"
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock
/stAte]: new
Enter name list for new layer(s): me Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock
/stAte]:
Command: change
Select objects:   1 found
Select objects: Specify change point or : p
Enter property to change
: la
Enter new layer name <0>: me
Enter property to change
:
Command: NRDL Unknown command "NRDL".Press F1 for help.
Command: layer
Current layer:"0"
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock
/stAte]: new
Enter name list for new layer(s): me1 Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck/Unlock
/stAte]:
Command: change
Select objects:
Command: NRDL Unknown command "NRDL".Press F1 for help.
Command: p Unknown command "P".Press F1 for help.
Command: la Unknown command "LA".Press F1 for help.
Command: me1 Unknown command "ME1".Press F1 for help.
Command: NRDL Unknown command "NRDL".Press F1 for help.
Command: NRDL Unknown command "NRDL".Press F1 for help.
Command:

Lee Mac 发表于 2022-7-6 11:55:49

当使用的“”尝试重复该命令时,您正在接收的未知命令。
 
ssget可能将nil返回到命令行,因此取消了该命令,因此“”试图重复最后一个命令。
页: 1 [2]
查看完整版本: 愚蠢的问题?