The Buzzard 发表于 2022-7-6 09:40:50

使用Entmake插入对象

大家好,
 
Lee Mac给了我一个关于块插入代码的建议,我用entmake而不是insert命令插入块。
我尽了最大努力,几乎做到了。
 
附加的程序是一个对象的简单代码,该对象具有一个属性,在选择插入点后将暂停旋转角度。
 
由于这只是一个演示,因此默认值是在中编程的。
除了一个例外,该程序的插入功能良好。
该属性不是块的一部分。如果在运行此程序后执行插入操作,则块将与属性一起显示。
 
不确定出了什么问题,但希望能给点建议。
 
谢谢
秃鹰
 
 
(defun C:LD ()                                                          ;Define Function
(command "_.STYLE" "Romans" "romans.shx" "0.0" "1.0" "0" "N" "N" "N") ;Style command
(setq ASTY"Romans")                                                 ;Attribute Style
(setq AWID    1.0)                                                    ;Attribute Width Factor
(setq ASIZ    4.5)                                                    ;Attribute Height
(setq ALNAM "A-DOOR-IDEN")                                          ;Attribut Layer Name
(setq BNAM"LDR")                                                    ;Block Name
(setq WID    36.0)                                                    ;Door Width
(setq THK   2.0)                                                    ;Door Thickness
(setq BRPT (list 0.0 0.0 0.0))                                        ;Base Reference Point
(setq EXDR (list 0.0 0.0 1.0))                                        ;Extrusion Direction
(setq PT01 (polar BRPT (DTR90.0) WID))                              ;Calculate Door Point 01
(setq PT02 (polar PT01 (DTR   0.0) THK))                              ;Calculate Door Point 02
(setq PT03 (polar PT02 (DTR 270.0) WID))                              ;Calculate Door Point 03
(setq PT04 (polar PT03 (DTR 180.0) THK))                              ;Calculate Door Point 04
(setq SANG   0.0)                                                   ;Arc Start Angle
(setq EANG   1.5708)                                                ;Arc Ending Angle
(setq AFAP   (polar BRPT (DTR 270.0)      11.25))                     ;Attribute First Alignment Point
(setq AFAP01 (polar AFAP (DTR   0.0)      15.0))
(setq ASAP   (polar BRPT (DTR 270.0)       6.75))                     ;Attribute Second Alignment Point
(setq ASAP01 (polar ASAP (DTR   0.0)(/ WID 2.0)))
(setq INPT (getpoint "\nGet insertion point:"))                     ;Insertion Point
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "block")                                                ;Object Type
   (cons 2    BNAM)                                                ;Object Name
   (cons 10   BRPT)                                                ;Object Base Reference Point
   (cons 70   2)))                                                   ;Attribute Flag ~ Has None Constant Attributes
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "LWPOLYLINE")                                           ;Object Type
   (cons 100 "AcDbEntity")                                           ;Subclass Marker
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8   "0")                                                    ;Layer Name
   (cons 100 "AcDbPolyline")                                       ;Subclass Marker
   (cons 90   4)                                                   ;Number of Vertices
   (cons 70   1)                                                   ;Polyline Flag ~ Closed
   (cons 43   0.0)                                                   ;Constant width
   (cons 38   0.0)                                                   ;Elevation
   (cons 39   0.0)                                                   ;Thickness
   (cons 10   PT01)                                                ;Vertex Coordinates ~ (Point 01)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT02)                                                ;Vertex Coordinates ~ (Point 02)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT03)                                                ;Vertex Coordinates ~ (Point 03)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT04)                                                ;Vertex Coordinates ~ (Point 04)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 210EXDR)))                                                ;Extrusion Direction
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "arc")                                                ;Object Type
   (cons 100 "AcDbEntity")                                           ;Subclass Marker
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8   "0")                                                    ;Layer Name
   (cons 100 "AcDbCircle")                                           ;Subclass Marker
   (cons 10   BRPT)                                                ;Center Point ~ (Base Reference Point)
   (cons 39   0.0)                                                   ;Thickness
   (cons 40   WID)                                                   ;Arc Radius ~ (Width)
   (cons 210EXDR)                                                ;Extrusion Direction
   (cons 100 "AcDbArc")                                              ;Subclass Marker
   (cons 50   SANG)                                                ;Arc Start Angle
   (cons 51   EANG)))                                                ;Arc Ending Angle
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "attdef")                                             ;Object Type
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8    ALNAM)                                                 ;Attribute Layer Name
   (cons 10   AFAP01)                                                ;Attribute First Alignment Point
   (cons 40   ASIZ)                                                ;Attribute Size ~ (4.5)
   (cons 1   "D01")                                                ;Attribute Value
   (cons 50   0.0)                                                   ;Text Rotation
   (cons 41   AWID)                                                ;Font Width Factor ~ (1.0)
   (cons 51   0.0)                                                   ;Oblique Angle
   (cons 7    ASTY)                                                ;Attribute Style ~ (Romans)
   (cons 71   0)                                                   ;Text Generation Flag ~ (Default)
   (cons 72   1)                                                   ;Horiz. Text Justification ~ (Center)
   (cons 11   ASAP01)                                                ;Attribute Second Alignment Point
   (cons 210EXDR)                                                ;Extrusion Direction
   (cons 3   "Door ID:")                                             ;Attribute Prompt
   (cons 2   "ID")                                                   ;Attribute Tag
   (cons 70                                                      ;Attribute Visibility Flag ~ (Attribute Is Preset (No Prompt During Insertion)
   (cons 73   0)                                                   ;Field Length
   (cons 74   2)))                                                   ;Vertical Text Justification ~ (Middle)
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "endblk")))                                             ;Object Type
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "INSERT")                                             ;Object Type
   (cons 2    BNAM)                                                ;Object Name
   (cons 10   INPT)))                                                ;Insertion Point
(prompt "\nRotation Angle: ")                                       ;Prompt For Rotation
(command "_.rotate" "last" "" INPT pause)                           ;Rotate Command, Last Object, Rotate On Insertion Point, Pause For Input
)                                                                     ;End Define Function
(defun DTR (a)                                                          ;Define Function
(* pi (/ a 180.0))                                                   ;Calculate Degrees To Radians
)                                                                     ;End Define Function

Lee Mac 发表于 2022-7-6 09:45:13

这似乎对我有用
 
PS,如果你想走这条路,我添加了另一种方式来提示轮换
 

(defun C:LD ()                                                          ;Define Function
(command "_.STYLE" "Romans" "romans.shx" "0.0" "1.0" "0" "N" "N" "N") ;Style command
(setq ASTY"Romans")                                                 ;Attribute Style
(setq AWID    1.0)                                                    ;Attribute Width Factor
(setq ASIZ    4.5)                                                    ;Attribute Height
(setq ALNAM "A-DOOR-IDEN")                                          ;Attribut Layer Name
(setq BNAM"LDR")                                                    ;Block Name
(setq WID    36.0)                                                    ;Door Width
(setq THK   2.0)                                                    ;Door Thickness
(setq BRPT (list 0.0 0.0 0.0))                                        ;Base Reference Point
(setq EXDR (list 0.0 0.0 1.0))                                        ;Extrusion Direction
(setq PT01 (polar BRPT (DTR90.0) WID))                              ;Calculate Door Point 01
(setq PT02 (polar PT01 (DTR   0.0) THK))                              ;Calculate Door Point 02
(setq PT03 (polar PT02 (DTR 270.0) WID))                              ;Calculate Door Point 03
(setq PT04 (polar PT03 (DTR 180.0) THK))                              ;Calculate Door Point 04
(setq SANG   0.0)                                                   ;Arc Start Angle
(setq EANG   1.5708)                                                ;Arc Ending Angle
(setq AFAP   (polar BRPT (DTR 270.0)      11.25))                     ;Attribute First Alignment Point
(setq AFAP01 (polar AFAP (DTR   0.0)      15.0))
(setq ASAP   (polar BRPT (DTR 270.0)       6.75))                     ;Attribute Second Alignment Point
(setq ASAP01 (polar ASAP (DTR   0.0)(/ WID 2.0)))
(setq INPT (getpoint "\nGet insertion point:"))                     ;Insertion Point
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "block")                                                ;Object Type
   (cons 2    BNAM)                                                ;Object Name
   (cons 10   BRPT)                                                ;Object Base Reference Point
   (cons 70   2)))                                                   ;Attribute Flag ~ Has None Constant Attributes
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "LWPOLYLINE")                                           ;Object Type
   (cons 100 "AcDbEntity")                                           ;Subclass Marker
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8   "0")                                                    ;Layer Name
   (cons 100 "AcDbPolyline")                                       ;Subclass Marker
   (cons 90   4)                                                   ;Number of Vertices
   (cons 70   1)                                                   ;Polyline Flag ~ Closed
   (cons 43   0.0)                                                   ;Constant width
   (cons 38   0.0)                                                   ;Elevation
   (cons 39   0.0)                                                   ;Thickness
   (cons 10   PT01)                                                ;Vertex Coordinates ~ (Point 01)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT02)                                                ;Vertex Coordinates ~ (Point 02)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT03)                                                ;Vertex Coordinates ~ (Point 03)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT04)                                                ;Vertex Coordinates ~ (Point 04)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 210EXDR)))                                                ;Extrusion Direction
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "arc")                                                ;Object Type
   (cons 100 "AcDbEntity")                                           ;Subclass Marker
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8   "0")                                                    ;Layer Name
   (cons 100 "AcDbCircle")                                           ;Subclass Marker
   (cons 10   BRPT)                                                ;Center Point ~ (Base Reference Point)
   (cons 39   0.0)                                                   ;Thickness
   (cons 40   WID)                                                   ;Arc Radius ~ (Width)
   (cons 210EXDR)                                                ;Extrusion Direction
   (cons 100 "AcDbArc")                                              ;Subclass Marker
   (cons 50   SANG)                                                ;Arc Start Angle
   (cons 51   EANG)))                                                ;Arc Ending Angle
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "attdef")                                             ;Object Type
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8    ALNAM)                                                 ;Attribute Layer Name
   (cons 10   AFAP01)                                                ;Attribute First Alignment Point
   (cons 40   ASIZ)                                                ;Attribute Size ~ (4.5)
   (cons 1   "D01")                                                ;Attribute Value
   (cons 50   0.0)                                                   ;Text Rotation
   (cons 41   AWID)                                                ;Font Width Factor ~ (1.0)
   (cons 51   0.0)                                                   ;Oblique Angle
   (cons 7    ASTY)                                                ;Attribute Style ~ (Romans)
   (cons 71   0)                                                   ;Text Generation Flag ~ (Default)
   (cons 72   1)                                                   ;Horiz. Text Justification ~ (Center)
   (cons 11   ASAP01)                                                ;Attribute Second Alignment Point
   (cons 210EXDR)                                                ;Extrusion Direction
   (cons 3   "Door ID:")                                             ;Attribute Prompt
   (cons 2   "ID")                                                   ;Attribute Tag
   (cons 70                                                      ;Attribute Visibility Flag ~ (Attribute Is Preset (No Prompt During Insertion)
   (cons 73   0)                                                   ;Field Length
   (cons 74   2)))                                                   ;Vertical Text Justification ~ (Middle)
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "endblk")))                                             ;Object Type
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "INSERT")                                             ;Object Type
   (cons 2    BNAM)                                                ;Object Name
   (cons 10   INPT)                                                ;Insertion Point
      ;(cons 50(getangle INPT "\nSelect Rotation: "))               ;Rotation Angle
   ))
(prompt "\nRotation Angle: ")                                       ;Prompt For Rotation
(command "_.rotate" "last" "" INPT pause)                           ;Rotate Command, Last Object, Rotate On Insertion Point, Pause For Input
)                                                                     ;End Define Function
(defun DTR (a)                                                          ;Define Function
(* pi (/ a 180.0))                                                   ;Calculate Degrees To Radians
)                                                                     ;End Define Function

The Buzzard 发表于 2022-7-6 09:50:01

我不明白,你是说属性出现了?

Lee Mac 发表于 2022-7-6 09:53:19

 
对不起,没有检查属性
 
*下次不会这么快*

Lee Mac 发表于 2022-7-6 09:55:31

好的,这将用ATTRIB插入,但你会看到我遇到的问题。。。
 

(defun C:LD ()                                                          ;Define Function
(command "_.STYLE" "Romans" "romans.shx" "0.0" "1.0" "0" "N" "N" "N") ;Style command
(setq ASTY"Romans")                                                 ;Attribute Style
(setq AWID    1.0)                                                    ;Attribute Width Factor
(setq ASIZ    4.5)                                                    ;Attribute Height
(setq ALNAM "A-DOOR-IDEN")                                          ;Attribut Layer Name
(setq BNAM"LDR")                                                    ;Block Name
(setq WID    36.0)                                                    ;Door Width
(setq THK   2.0)                                                    ;Door Thickness
(setq BRPT (list 0.0 0.0 0.0))                                        ;Base Reference Point
(setq EXDR (list 0.0 0.0 1.0))                                        ;Extrusion Direction
(setq PT01 (polar BRPT (DTR90.0) WID))                              ;Calculate Door Point 01
(setq PT02 (polar PT01 (DTR   0.0) THK))                              ;Calculate Door Point 02
(setq PT03 (polar PT02 (DTR 270.0) WID))                              ;Calculate Door Point 03
(setq PT04 (polar PT03 (DTR 180.0) THK))                              ;Calculate Door Point 04
(setq SANG   0.0)                                                   ;Arc Start Angle
(setq EANG   1.5708)                                                ;Arc Ending Angle
(setq AFAP   (polar BRPT (DTR 270.0)      11.25))                     ;Attribute First Alignment Point
(setq AFAP01 (polar AFAP (DTR   0.0)      15.0))
(setq ASAP   (polar BRPT (DTR 270.0)       6.75))                     ;Attribute Second Alignment Point
(setq ASAP01 (polar ASAP (DTR   0.0)(/ WID 2.0)))
(setq INPT (getpoint "\nGet insertion point:"))                     ;Insertion Point
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "block")                                                ;Object Type
   (cons 2    BNAM)                                                ;Object Name
   (cons 10   BRPT)                                                ;Object Base Reference Point
   (cons 70   2)))                                                   ;Attribute Flag ~ Has None Constant Attributes
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "LWPOLYLINE")                                           ;Object Type
   (cons 100 "AcDbEntity")                                           ;Subclass Marker
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8   "0")                                                    ;Layer Name
   (cons 100 "AcDbPolyline")                                       ;Subclass Marker
   (cons 90   4)                                                   ;Number of Vertices
   (cons 70   1)                                                   ;Polyline Flag ~ Closed
   (cons 43   0.0)                                                   ;Constant width
   (cons 38   0.0)                                                   ;Elevation
   (cons 39   0.0)                                                   ;Thickness
   (cons 10   PT01)                                                ;Vertex Coordinates ~ (Point 01)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT02)                                                ;Vertex Coordinates ~ (Point 02)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT03)                                                ;Vertex Coordinates ~ (Point 03)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT04)                                                ;Vertex Coordinates ~ (Point 04)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 210EXDR)))                                                ;Extrusion Direction
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "arc")                                                ;Object Type
   (cons 100 "AcDbEntity")                                           ;Subclass Marker
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8   "0")                                                    ;Layer Name
   (cons 100 "AcDbCircle")                                           ;Subclass Marker
   (cons 10   BRPT)                                                ;Center Point ~ (Base Reference Point)
   (cons 39   0.0)                                                   ;Thickness
   (cons 40   WID)                                                   ;Arc Radius ~ (Width)
   (cons 210EXDR)                                                ;Extrusion Direction
   (cons 100 "AcDbArc")                                              ;Subclass Marker
   (cons 50   SANG)                                                ;Arc Start Angle
   (cons 51   EANG)))                                                ;Arc Ending Angle
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "attdef")                                             ;Object Type
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8    ALNAM)                                                 ;Attribute Layer Name
   (cons 10   AFAP01)                                                ;Attribute First Alignment Point
   (cons 40   ASIZ)                                                ;Attribute Size ~ (4.5)
   (cons 1   "D01")                                                ;Attribute Value
   (cons 50   0.0)                                                   ;Text Rotation
   (cons 41   AWID)                                                ;Font Width Factor ~ (1.0)
   (cons 51   0.0)                                                   ;Oblique Angle
   (cons 7    ASTY)                                                ;Attribute Style ~ (Romans)
   (cons 71   0)                                                   ;Text Generation Flag ~ (Default)
   (cons 72   1)                                                   ;Horiz. Text Justification ~ (Center)
   (cons 11   ASAP01)                                                ;Attribute Second Alignment Point
   (cons 210EXDR)                                                ;Extrusion Direction
   (cons 3   "Door ID:")                                             ;Attribute Prompt
   (cons 2   "ID")                                                   ;Attribute Tag
   (cons 70                                                      ;Attribute Visibility Flag ~ (Attribute Is Preset (No Prompt During Insertion)
   (cons 73   0)                                                   ;Field Length
   (cons 74   2)))                                                   ;Vertical Text Justification ~ (Middle)
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "endblk")))                                             ;Object Type
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "INSERT")                                             ;Object Type
   (cons 2    BNAM)                                                ;Object Name
      (cons 66   1)
   (cons 10   INPT)                                                ;Insertion Point
   ;(cons 50(getangle INPT "\nSelect Rotation: "))               ;Rotation Angle
   ))
(prompt "\nRotation Angle: ")                                       ;Prompt For Rotation
(command "_.rotate" (entlast) "" INPT pause)                           ;Rotate Command, Last Object, Rotate On Insertion Point, Pause For Input
)                                                                     ;End Define Function
(defun DTR (a)                                                          ;Define Function
(* pi (/ a 180.0))                                                   ;Calculate Degrees To Radians
)                                                                     ;End Define Function

 
检查突出显示是否有更改

The Buzzard 发表于 2022-7-6 09:59:31

我喜欢将提示放在列表中的想法。我不知道可以这样做。我会用的。无论如何,我相信我离目标很近了,很可能只有几英尺远。

The Buzzard 发表于 2022-7-6 10:02:51

我已经试过了,它把所有的东西都当成了松散的物体。

Lee Mac 发表于 2022-7-6 10:03:17

阅读66组代码,我认为应该这样做,但它似乎没有插入任何内容。。。

(defun C:LD ()                                                          ;Define Function
(command "_.STYLE" "Romans" "romans.shx" "0.0" "1.0" "0" "N" "N" "N") ;Style command
(setq ASTY"Romans")                                                 ;Attribute Style
(setq AWID    1.0)                                                    ;Attribute Width Factor
(setq ASIZ    4.5)                                                    ;Attribute Height
(setq ALNAM "A-DOOR-IDEN")                                          ;Attribut Layer Name
(setq BNAM"LDR")                                                    ;Block Name
(setq WID    36.0)                                                    ;Door Width
(setq THK   2.0)                                                    ;Door Thickness
(setq BRPT (list 0.0 0.0 0.0))                                        ;Base Reference Point
(setq EXDR (list 0.0 0.0 1.0))                                        ;Extrusion Direction
(setq PT01 (polar BRPT (DTR90.0) WID))                              ;Calculate Door Point 01
(setq PT02 (polar PT01 (DTR   0.0) THK))                              ;Calculate Door Point 02
(setq PT03 (polar PT02 (DTR 270.0) WID))                              ;Calculate Door Point 03
(setq PT04 (polar PT03 (DTR 180.0) THK))                              ;Calculate Door Point 04
(setq SANG   0.0)                                                   ;Arc Start Angle
(setq EANG   1.5708)                                                ;Arc Ending Angle
(setq AFAP   (polar BRPT (DTR 270.0)      11.25))                     ;Attribute First Alignment Point
(setq AFAP01 (polar AFAP (DTR   0.0)      15.0))
(setq ASAP   (polar BRPT (DTR 270.0)       6.75))                     ;Attribute Second Alignment Point
(setq ASAP01 (polar ASAP (DTR   0.0)(/ WID 2.0)))
(setq INPT (getpoint "\nGet insertion point:"))                     ;Insertion Point
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "block")                                                ;Object Type
   (cons 2    BNAM)                                                ;Object Name
   (cons 10   BRPT)                                                ;Object Base Reference Point
   (cons 70   2)))                                                   ;Attribute Flag ~ Has None Constant Attributes
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "LWPOLYLINE")                                           ;Object Type
   (cons 100 "AcDbEntity")                                           ;Subclass Marker
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8   "0")                                                    ;Layer Name
   (cons 100 "AcDbPolyline")                                       ;Subclass Marker
   (cons 90   4)                                                   ;Number of Vertices
   (cons 70   1)                                                   ;Polyline Flag ~ Closed
   (cons 43   0.0)                                                   ;Constant width
   (cons 38   0.0)                                                   ;Elevation
   (cons 39   0.0)                                                   ;Thickness
   (cons 10   PT01)                                                ;Vertex Coordinates ~ (Point 01)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT02)                                                ;Vertex Coordinates ~ (Point 02)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT03)                                                ;Vertex Coordinates ~ (Point 03)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 10   PT04)                                                ;Vertex Coordinates ~ (Point 04)
   (cons 40   0.0)                                                   ;Starting width
   (cons 41   0.0)                                                   ;Ending width
   (cons 42   0.0)                                                   ;Bulge
   (cons 210EXDR)))                                                ;Extrusion Direction
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "arc")                                                ;Object Type
   (cons 100 "AcDbEntity")                                           ;Subclass Marker
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8   "0")                                                    ;Layer Name
   (cons 100 "AcDbCircle")                                           ;Subclass Marker
   (cons 10   BRPT)                                                ;Center Point ~ (Base Reference Point)
   (cons 39   0.0)                                                   ;Thickness
   (cons 40   WID)                                                   ;Arc Radius ~ (Width)
   (cons 210EXDR)                                                ;Extrusion Direction
   (cons 100 "AcDbArc")                                              ;Subclass Marker
   (cons 50   SANG)                                                ;Arc Start Angle
   (cons 51   EANG)))                                                ;Arc Ending Angle
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "attdef")                                             ;Object Type
   (cons 67   0)                                                   ;Object Space ~ Model
   (cons 410 "Model")                                                ;Layout Tab Name ~ Model
   (cons 8    ALNAM)                                                 ;Attribute Layer Name
   (cons 10   AFAP01)                                                ;Attribute First Alignment Point
   (cons 40   ASIZ)                                                ;Attribute Size ~ (4.5)
   (cons 1   "D01")                                                ;Attribute Value
   (cons 50   0.0)                                                   ;Text Rotation
   (cons 41   AWID)                                                ;Font Width Factor ~ (1.0)
   (cons 51   0.0)                                                   ;Oblique Angle
   (cons 7    ASTY)                                                ;Attribute Style ~ (Romans)
   (cons 71   0)                                                   ;Text Generation Flag ~ (Default)
   (cons 72   1)                                                   ;Horiz. Text Justification ~ (Center)
   (cons 11   ASAP01)                                                ;Attribute Second Alignment Point
   (cons 210EXDR)                                                ;Extrusion Direction
   (cons 3   "Door ID:")                                             ;Attribute Prompt
   (cons 2   "ID")                                                   ;Attribute Tag
   (cons 70                                                      ;Attribute Visibility Flag ~ (Attribute Is Preset (No Prompt During Insertion)
   (cons 73   0)                                                   ;Field Length
   (cons 74   2)))                                                   ;Vertical Text Justification ~ (Middle)
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "endblk")))                                             ;Object Type
(entmake                                                            ;Entmake
   (list                                                               ;Start List
   (cons 0   "INSERT")                                             ;Object Type
   (cons 2    BNAM)                                                ;Object Name
   (cons 66   1)
   (cons 10   INPT)                                                ;Insertion Point
   ;(cons 50(getangle INPT "\nSelect Rotation: "))               ;Rotation Angle
   ))
(entmake
   (list      
   (cons 0 "ATTRIB")
   (cons 8 "A-DOOR-IDEN")
   (cons 1 "D01")
   (cons 7 "Romans")
   (cons 2 "ID")))
(entmake
   (list
   (cons 0 "SEQEND")
   (cons 8 "0")))
;(prompt "\nRotation Angle: ")                                       ;Prompt For Rotation
;(command "_.rotate" (entlast) "" INPT pause)                           ;Rotate Command, Last Object, Rotate On Insertion Point, Pause For Input
)                                                                     ;End Define Function
(defun DTR (a)                                                          ;Define Function
(* pi (/ a 180.0))                                                   ;Calculate Degrees To Radians
)                           

The Buzzard 发表于 2022-7-6 10:06:18

我记得类似的事情,但不是这里使用的方式。
我几个月前就试过了,放弃了这个想法。这就是为什么我在代码中使用insert命令。

Lee Mac 发表于 2022-7-6 10:11:36

 
没错,但Entmake总是比我找到的任何“命令调用”方法都快。
 
我有一半的时间在考虑修改我的管道程序,使其使用entmake方法来创建实体,但这将意味着完全重写绘图程序。。。任务不小。。。
页: [1] 2
查看完整版本: 使用Entmake插入对象