乐筑天下

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

[编程交流] Qleader系统变量

[复制链接]

78

主题

207

帖子

129

银币

后起之秀

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

铜币
395
发表于 2022-7-6 11:47:11 | 显示全部楼层 |阅读模式
它们存在吗?我想写一个Lisp程序的句子把它们放进去。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:22:54 | 显示全部楼层
设置存储在字典中,您可以这样设置:
 
  1. ;;; qlset.lsp - example initialization of QLEADER settings
  2. ;;; Frank Whaley, Autodesk
  3. ;;;
  4. ;;; Two functions are included in this file:
  5. ;;;
  6. ;;; (acet-ql-Set)
  7. ;;; Returns an association list containing the current QLEADER settings from the
  8. ;;; Named Object Dictionary.
  9. ;;;
  10. ;;; (acet-ql-get <alist>)
  11. ;;; Sets the specified values for QLEADER settings from the given association
  12. ;;; list.
  13. ;;; Returns an association list containing the new values.
  14. ;;;
  15. ;;; These functions can be used to examine the current QLEADER settings, or to
  16. ;;; initialize the setting before using the QLEADER command.
  17. ;;; For example, to use splined leaders and framed text:
  18. ;;;
  19. ;;; (acet-ql-set '((65 . 1)(72 . 1)))
  20. ;;;
  21. ;;; Both functions use the following group codes to identify QLEADER settings:
  22. ;;;
  23. ;;;  3: user arrowhead block name (default="")
  24. ;;;  40: default text width (default=0.0)
  25. ;;;  60: annotation type (default=0)
  26. ;;;      0=MText
  27. ;;;      1=copy object
  28. ;;;      2=Tolerance
  29. ;;;      3=block
  30. ;;;      4=none
  31. ;;;  61: annotation reuse (default=0)
  32. ;;;      0=none
  33. ;;;      1=reuse next
  34. ;;;  62: left attachment point (default=1)
  35. ;;;  63: right attachment point (default=3)
  36. ;;;      0=Top of top line
  37. ;;;      1=Middle of top line
  38. ;;;      2=Middle of multiline text
  39. ;;;      3=Middle of bottom line
  40. ;;;      4=Bottom of bottom line
  41. ;;;  64: underline bottom line (default=0)
  42. ;;;  65: use splined leader line (default=0)
  43. ;;;  66: no limit on points (default=0)
  44. ;;;  67: maximum number of points (default=3)
  45. ;;;  68: prompt for MText width (word wrap) (default=1)
  46. ;;;  69: always left justify (default=0)
  47. ;;;  70: allowed angle, first segment (default=0)
  48. ;;;  71: allowed angle, second segment (default=0)
  49. ;;;      0=Any angle
  50. ;;;      1=Horizontal
  51. ;;;      2=90deg
  52. ;;;      3=45deg
  53. ;;;      4=30deg
  54. ;;;      5=15deg
  55. ;;;  72: frame text (default=0)
  56. ;;; 170: active tab (default=0)
  57. ;;;      0=Annotation
  58. ;;;      1=Leader Line & Arrow
  59. ;;;      2=Attachment
  60. ;;; 340: object ID for annotation reuse
  61. ;;;
  62. ;;; |;
  63. acad-push-dbmod
  64. (defun acet-ql-get  (/ xr cod itm reply)
  65. (if (setq xr (dictsearch (namedobjdict) "AcadDim"))
  66.    (progn
  67.      (foreach cod  '(3 40 60 61 62 63 64 65 66 67 68 69 70 71 72 170 340)
  68.        (if (setq itm (assoc cod xr))
  69.          (setq reply (append reply (list itm)))))
  70.      reply)
  71.    '((3 . "")
  72.      (40 . 0.0)
  73.      (60 . 0)
  74.      (61 . 1)
  75.      (62 . 1)
  76.      (63 . 3)
  77.      (64 . 0)
  78.      (65 . 0)
  79.      (66 . 0)
  80.      (67 . 3)
  81.      (68 . 1)
  82.      (69 . 0)
  83.      (70 . 0)
  84.      (71 . 0)
  85.      (72 . 0)
  86.      (170 . 0))))
  87. (defun acet-ql-set  (arg / cur prm)
  88. ;;  fetch current
  89. (setq cur (acet-ql-get))
  90. ;;  override per argument
  91. (while arg
  92.    (setq prm (car arg)
  93.          arg (cdr arg)
  94.          cur (subst prm (assoc (car prm) cur) cur))
  95.    ;;  handle DIMLDRBLK
  96.    (if (= 3 (car prm))
  97.      (setvar "DIMLDRBLK" (cdr prm))))
  98. ;;  put back
  99. (dictremove (namedobjdict) "AcadDim")
  100. (setq cur (append '((0 . "XRECORD") (100 . "AcDbXrecord") (90 . 990106))
  101.                    cur))
  102. (dictadd (namedobjdict) "AcadDim" (entmakex cur))
  103. (acet-ql-get))
  104. ;;  load quietly
  105. (princ)

 
或者,您可以输入引线并将覆盖放入扩展数据(-3)DXF代码中:
 
  1. (entmake (list (cons 0 "LEADER")
  2.               (cons 100 "AcDbEntity")
  3.               (cons 100 "AcDbLeader")
  4.               (cons 71 1)
  5.               (cons 72 0)
  6.               (cons 73 3)
  7.               (cons 74 0)
  8.               (cons 75 0)
  9.               (cons 10 pt)
  10.               (cons 10 pt1)
  11.               (cons 10 (getpoint pt1 "\nSpecify Next Point"))
  12.               (list -3
  13.                     (list "ACAD"
  14.                           (cons 1000 "DSTYLE")
  15.                           (cons 1002 "{")
  16.                           (cons 1070 41)
  17.                           (cons 1040 2.5)
  18.                           (cons 1002 "}")))))

 
此类组码的信息可在此处找到:
 
  1. Art Cooney (artc@autodesk.com)
  2. There's a description of the codes in the ObjectARX documentation (I've included
  3. it below).  I don't think the DXF documentation explains the overrides.
  4. Here's the description from the ObjectARX docs:
  5. Dimension style overrides can be applied to any of the AcDbEntity types that
  6. reference an AcDbDimStyleTableRecord.  These are:
  7. AcDbAlignedDimension
  8. AcDbRotatedDimension
  9. AcDbDiametricDimension
  10. AcDbRadialDimension
  11. AcDb2LineAngularDimension
  12. AcDb3PointAngularDimension
  13. AcDbOrdinateDimension
  14. AcDbLeader
  15. AcDbFcf
  16. Dimension overrides applied to an object of any of these classes are stored as
  17. xdata under the "ACAD" appId in a special subsection. The subsection starts with
  18. a group code 1000 (AcDb::kDxfXdAsciiString) with the string "DSTYLE", followed
  19. by all the dimension override data bracketed inside a pair of group code 1002's
  20. (AcDb::kDxfXdControlString) (the first being a "{" and the other a "}").
  21. Dimension variables in general are called dimvars, and this data is commonly
  22. called "per-entity dimvar overrides" or just dimvar overrides.
  23. Within the group code 1002 brackets is a chain of dimvar group-code/data-value
  24. resbuf pairs, one pair for each dimvar being overridden.
  25. The first resbuf in each pair is the DXF group code for the dimvar, as found in
  26. the Table below.  Since the group code is an integer it has a restype of
  27. AcDb::kDxfXdInteger16 (group code 1070).
  28. The second resbuf in each pair is the value for that dimvar.  Data values for
  29. dimvars may be strings, integers, reals, or objectIds.  As with resbufs in
  30. general, the value of the resbuf’s restype indicates how to read the data in the
  31. resval.  Please refer to the Table below.
  32. As an example, here is a dimension style override list that will override the
  33. DIMTAD and DIMGAP variables. The list is shown in AutoLISP format with indenting
  34. for clarity.
  35. ("ACAD"
  36.    (1000 . "DSTYLE")
  37.    (1002 . "{")
  38.    (1070 . 77) (1070 . 1)
  39.    (1070 . 147) (1000 .  0.2)
  40.    (1002 . "}")
  41. )
  42. In this example the group code 77 is DIMTAD, which is overridden to be 1. Then
  43. DIMGAP (group code 147) is set to 0.2.
  44. The following code sample uses acutBuildList() to create this resbuf chain and
  45. to set overrides for DIMTAD and DIMGAP on the entity pointed to by pEnt,
  46. assuming pEnt points to an AcDbEntity of one of the types listed above and is
  47. open for writing:
  48. resbuf* pRb = acutBuildList(
  49.        AcDb::kDxfRegAppName,      "ACAD",
  50.        AcDb::kDxfXdAsciiString,   "DSTYLE",
  51.        AcDb::kDxfXdControlString, "{",
  52.        AcDb::kDxfXdInteger16,  77, AcDb::kDxfXdInteger16, 1,
  53.        AcDb::kDxfXdInteger16, 147, AcDb::kDxfXdReal,      0.2,
  54.        AcDb::kDxfXdControlString, "}",
  55.        RTNONE);
  56. Acad::ErrorStatus es = pEnt->setXdata(pRb);
  57. acutRelRb(pRb);
  58. It is very important the xdata you set onto an object have the proper sequence
  59. of resbufs.  Each override must have both the DXF group code resbuf and the
  60. associated value resbuf. In addition, the value must be the correct data type
  61. (string, real, or int) and must be within the allowable range for that dimvar.
  62. If any of these conditions are not met, AutoCAD may terminate. Also, the 1000
  63. "DSTYLE" and the following 1002 "{" "}" set must be present, and there must only
  64. be one set of all of these.
  65. Remember that xdata is obtained and replaced on a per-appId basis. To modify any
  66. dimension overrides, work with the complete list of xdata for the "ACAD" appId,
  67. which may have other data, including other dimension overrides. So, be sure to
  68. obtain whatever xdata may already be present for the "ACAD" appId (use the
  69. object's xData() method with the string "ACAD"). Add or remove only the
  70. dimension override information you need, making sure that if dimension override
  71. information already exists you don't duplicate any of the xdata that's already
  72. there (including the "DSTYLE" string and the 1002 "{" "}" bracket pairs). Place
  73. new overrides in between the existing 1002 bracket pair, and put the complete
  74. modified list back into the object via the object's setXData() method. If not
  75. done correctly, AutoCAD may terminate.
  76. Here is a table of all the DimStyleTableRecord dimvars, with their DXF group
  77. codes, data types, and value ranges:
  78. Group code  Dimension variable     Data type     Value range
  79. 3           DIMPOST                string        any
  80. 4           DIMAPOST               string        any
  81. 40          DIMSCALE               real          >= 0.0
  82. 41          DIMASZ                 real          >= 0.0
  83. 42          DIMEXO                 real          >= 0.0
  84. 43          DIMDLI                 real          >= 0.0
  85. 44          DIMEXE                 real          >= 0.0
  86. 45          DIMRND                 real          >= 0.0
  87. 46          DIMDLE                 real          >= 0.0
  88. 47          DIMTP                  real          >= 0.0
  89. 48          DIMTM                  real          >= 0.0
  90. 71          DIMTOL                 int           0 = off,  1 = on
  91. 72          DIMLIM                 int           0 = off,  1 = on
  92. 73          DIMTIH                 int           0 = off,  1 = on
  93. 74          DIMTOH                 int           0 = off,  1 = on
  94. 75          DIMSE1                 int           0 = off,  1 = on
  95. 76          DIMSE2                 int           0 = off,  1 = on
  96. 77          DIMTAD                 int           0 - 3
  97. 78          DIMZIN                 int           0 - 15
  98. 79          DIMAZIN                int           0 - 15            new
  99. 140         DIMTXT                 real          >= 0.0
  100. 141         DIMCEN                 real          any value
  101. 142         DIMTSZ                 real          >= 0.0
  102. 143         DIMALTF                real          >= 0.0
  103. 144         DIMLFAC                real          >= 0.0
  104. 145         DIMTVP                 real          >= 0.0
  105. 146         DIMTFAC                real          >= 0.0
  106. 147         DIMGAP                 real          any value
  107. 148         DIMALTRND              real          >= 0.0           new
  108. 170         DIMALT                 int           0 = off,  1 = on
  109. 171         DIMALTD                int           >= 0
  110. 172         DIMTOFL                int           0 = off,  1 = on
  111. 173         DIMSAH                 int           0 = off,  1 = on
  112. 174         DIMTIX                 int           0 = off,  1 = on
  113. 175         DIMSOXD                int           0 = off,  1 = on
  114. 176         DIMCLRD                int           0 - 256
  115. 177         DIMCLRE                int           0 - 256
  116. 178         DIMCLRT                int           0 - 256
  117. 179         DIMADEC                int           0 - 8            new
  118. 271         DIMDEC                 int           0 - 8
  119. 272         DIMTDEC                int           0 - 8
  120. 273         DIMALTU                int           1 - 8
  121. 274         DIMALTTD               int           0 - 8
  122. 275         DIMAUNIT               int           0 - 4
  123. 276         DIMFRAC                int           0 - 2            new
  124. 277         DIMLUNIT               int           0 - 4            new
  125. 278         DIMDSEP                int           (char) any char  new
  126. 279         DIMATMOVE              int           0 - 2            new
  127. 280         DIMJUST                int           0 - 4
  128. 281         DIMSD1                 int           0 = off,  1 = on
  129. 282         DIMSD2                 int           0 = off,  1 = on
  130. 283         DIMTOLJ                int           0 - 2
  131. 284         DIMTZIN                int           0 - 15
  132. 285         DIMALTZ                int           0 - 15
  133. 286         DIMALTTZ               int           0 - 15
  134. 288         DIMUPT                 int           0 = off,  1 = on
  135. 289         DIMATFIT               int           0 - 3            new
  136. 340         DIMTXSTY               objectId                       new
  137. 341         DIMLDRBLK              objectId                       new
  138. 342         DIMBLK                 objectId                       new
  139. 343         DIMBLK1                objectId                       new
  140. 344         DIMBLK2                objectId                       new
  141. 371         DIMLWD                 int           lineweights      new
  142. 372         DIMLWE                 int           lineweights      new
回复

使用道具 举报

78

主题

207

帖子

129

银币

后起之秀

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

铜币
395
发表于 2022-7-6 12:37:10 | 显示全部楼层
很有趣,非常感谢
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:49:27 | 显示全部楼层
不客气
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-5 11:06 , Processed in 0.673407 second(s), 60 queries .

© 2020-2025 乐筑天下

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