manirpg 发表于 2022-7-6 11:00:57

Mlstyle Caps关闭?

亲爱的朋友们:,
我需要lisp或宏。。。
以标准mlstyle按行关闭封口
如果可能的话,请帮助我。。。。。。。
当做
马尼

Tharwat 发表于 2022-7-6 11:06:13

你好
实际上,这些点的实体代码是什么(开始和结束)。
 
君王,
塔瓦特

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

 
那你为什么不学着写呢?

Lee Mac 发表于 2022-7-6 11:11:42

 
样式存储在ACAD_MLINESTYLE字典中,cap设置(除其他外)存储在样式字典项的组70中。
 
查找设置了哪些属性的示例:
 

(defun GetMLineStyleProps ( style / dic )
;; © Lee Mac~10.06.10
(if (and (setq dic (dictsearch (namedobjdict) "ACAD_MLINESTYLE"))
          (setq dic (dictsearch (cdr (assoc -1 dic)) style)))
   (GetBits (cdr (assoc 70 dic)))
)
)


;; GetBits ~© Lee Mac
;; Returns the bit combination of a number
(defun GetBits (n / b)
(if (< 0 n)
   (cons (setq b (expt 2 (fix (/ (log n) (log 2)))))
   (GetBits (- n b))
   )
)
)
 
(GetMLineStyleProps "Standard")

Lee Mac 发表于 2022-7-6 11:16:05

修改属性的示例。。。
 

;;;    1 = Fill on
;;;    2 = Display miters
;;;   16 = Start square end (line) cap
;;;   32 = Start inner arcs cap
;;;   64 = Start round (outer arcs) cap
;;;256 = End square (line) cap
;;;512 = End inner arcs cap
;;; 1024 = End round (outer arcs) cap

(defun PutMLineStyleProps ( style code / dic )
;; © Lee Mac~10.06.10
(if (and (setq dic (dictsearch (namedobjdict) "ACAD_MLINESTYLE"))
          (setq dic (dictsearch (cdr (assoc -1 dic)) style)))
   (entmod
   (subst (cons 70 (boole 7 (cdr (assoc 70 dic)) code))
       (assoc 70 dic)
       dic
   )
   )
)
)

Tharwat 发表于 2022-7-6 11:19:53

嗨,李先生
您使用的是一种非常高级的编程语言,超过98%的Cadtutor参与者和普通Autolisp程序员都不知道这种语言,因此,请使用普通Autolisp函数使您的宝贵答案更加清晰。
 
关于您的答案和示例,我真的无法处理大部分内容,尽管我已经使用Autolisp大约三年了。
 
我发现70不属于Mlinestyle的开始或结束,如Autocad DXF帮助中所示;
Mline group codes

Group code
Description

100
Subclass marker (AcDbMline)

2
String of up to 32 characters. The name of the style used for this mline. An entry for this style must exist in the MLINESTYLE dictionary.

Do not modify this field without also updating the associated entry in the MLINESTYLE dictionary

340
Pointer-handle/ID of MLINESTYLE object

40
Scale factor

70
Justification: 0 = Top; 1 = Zero; 2 = Bottom

71
Flags (bit-coded values):

1 = Has at least one vertex (code 72 is greater than 0)

2 = Closed

4 = Suppress start caps

8 = Suppress end caps

72
Number of vertices


 
非常感谢
塔瓦特

Lee Mac 发表于 2022-7-6 11:22:03

我不确定您所说的“普通AutoLISP函数”是什么意思。我使用执行任务所需的函数,作为参考,请参阅此处:
 
http://images.autodesk.com/adsk/files/acad_dxf1.pdf
 
第186页

Tharwat 发表于 2022-7-6 11:24:46

 
没关系。但问题是,为什么我从autocad Help 2010复制autocad时,autocad有不同的DXF代码。
请给我澄清一下。
LWPOLYLINE

ENTITIES Section

MULTILEADER
DXF Reference > ENTITIES Section >
MLINE Expand All
Expand all collapsed sections.

Collapse All
Collapse all expanded sections.





The following group codes apply to mline entities. In addition to the group codes described here, see Common Group Codes for Entities. For information about abbreviations and formatting used in this table, see Formatting Conventions in This Reference.

Mline group codes

Group code
Description

100
Subclass marker (AcDbMline)

2
String of up to 32 characters. The name of the style used for this mline. An entry for this style must exist in the MLINESTYLE dictionary.

Do not modify this field without also updating the associated entry in the MLINESTYLE dictionary

340
Pointer-handle/ID of MLINESTYLE object

40
Scale factor

70
Justification: 0 = Top; 1 = Zero; 2 = Bottom

71
Flags (bit-coded values):

1 = Has at least one vertex (code 72 is greater than 0)

2 = Closed

4 = Suppress start caps

8 = Suppress end caps

72
Number of vertices

73
Number of elements in MLINESTYLE definition

10
Start point (in WCS)

DXF: X value; APP: 3D point

20, 30
DXF: Y and Z values of start point (in WCS)

210
Extrusion direction (optional; default = 0, 0, 1)

DXF: X value; APP: 3D vector

220, 230
DXF: Y and Z values of extrusion direction (optional)

11
Vertex coordinates (multiple entries; one entry for each vertex) DXF: X value; APP: 3D point

21, 31
DXF: Y and Z values of vertex coordinates

12
Direction vector of segment starting at this vertex (multiple entries; one for each vertex)

DXF: X value; APP: 3D vector

22, 32
DXF: Y and Z values of direction vector of segment starting at this vertex

13
Direction vector of miter at this vertex (multiple entries: one for each vertex)

DXF: X value; APP: 3D vector

23, 33
DXF: Y and Z values of direction vector of miter

74
Number of parameters for this element (repeats for each element in segment)

41
Element parameters (repeats based on previous code 74)

75
Number of area fill parameters for this element (repeats for each element in segment)

42
Area fill parameters (repeats based on previous code 75)


The group code 41 parameterization is a list of real values, one real per group code 41. The list may contain zero or more items. The first group code 41 value is the distance from the segment vertex along the miter vector to the point where the line element's path intersects the miter vector. The next group code 41 value is the distance along the line element's path from the point defined by the first group 41 to the actual start of the line element. The next is the distance from the start of the line element to the first break (or cut) in the line element. The successive group code 41 values continue to list the start and stop points of the line element in this segment of the mline. Linetypes do not affect group 41 lists.

The group code 42 parameterization is also a list of real values. Similar to the 41 parameterization, it describes the parameterization of the fill area for this mline segment. The values are interpreted identically to the 41 parameters and when taken as a whole for all line elements in the mline segment, they define the boundary of the fill area for the mline segment.

A common example of the use of the group code 42 mechanism is when an unfilled mline crosses over a filled mline and mledit is used to cause the filled mline to appear unfilled in the crossing area. This would result in two group 42s for each line element in the affected mline segment; one for the fill stop and one for the fill start.

The 2 group codes in mline entities and mlinestyle objects are redundant fields. These groups should not be modified under any circumstances, although it is safe to read them and use their values. The correct fields to modify are as follows:

Mline
The 340 group in the same object, which indicates the proper MLINESTYLE object.

Mlinestyle
The 3 group value in the MLINESTYLE dictionary, which precedes the 350 group that has the handle or entity name of the current mlinestyle.

Please send us your comment about this page

Lee Mac 发表于 2022-7-6 11:29:20

您提供的DXF代码是通过在MLine对象上使用“entget”返回的代码(我假设)。
 
多线样式设置存储在名称对象词典(namedobjdict)中包含的ACAD_多线样式词典对象中。
 
该字典列出了图形中定义的所有MLINESTYLE,因此我们可以在字典中搜索希望检查的样式。
 
我提供的参考资料第186页上列出的DXF代码是样式字典条目的代码。
 

Lee Mac 发表于 2022-7-6 11:32:23

看看我提供的代码——注意,参数不是一个MLine对象,而是一个样式名(字符串)。
 
看看我是如何在我发布的代码中检索DXF代码的。
页: [1] 2
查看完整版本: Mlstyle Caps关闭?