乐筑天下

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

[编程交流] 使用创建名为的dimstyle

[复制链接]

29

主题

196

帖子

168

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
145
发表于 2022-7-6 11:23:53 | 显示全部楼层 |阅读模式
嗨,伙计们
 
正如我所了解的,函数是如何工作的。。。我可以改进一下我的日常生活,现在有人要求用不同的方式来做。。。
 
它根据所需比例的名称创建多个尺寸样式。。。
键入E1、E5、E25等。。。你创建你想要的比例。。。但现在我想允许例程创建任何所需的比例,而不是将其限制到特定的比例。。。所以我做了一个价值选择。。。我差点就成功了。。。我唯一不知道该怎么做的是新dimtyle的全名。。
 
红色。。。我不知道怎么写的那一行。。。
在下一个红排。。。应创建的比例。。
 
任何帮助都将不胜感激。。。
 
  1. ;STANDARD PARA COTAS HECHO POR FAMILIA GIL
  2. (vmon)
  3. ;; DIMENSION VARIABLES
  4. ;; THESE VALUES WILL AFFECT ALL NEW DIMSTYLES
  5. ;;
  6. (defun dimvars (/)
  7.   (COMMAND "style""RS""romans.shx""0.0"".8""0.00""N""N""N")
  8. (command
  9. "DIMADEC"     "2"             ; Angular decimal places
  10. "DIMALT"      "Off"           ; Alternate units selected
  11. "DIMALTD"     "2"             ; Alternate unit decimal places
  12. "DIMALTF"     "25.4000"       ; Alternate unit scale factor
  13. "DIMALTRND"   "0"             ; Alternate units rounding value
  14. "DIMALTTD"    "2"             ; Alternate tolerance decimal places
  15. "DIMALTTZ"    "0"             ; Alternate tolerance zero suppression
  16. "DIMALTU"     "2"             ; Alternate units
  17. "DIMALTZ"     "0"             ; Alternate unit zero suppression
  18. "DIMAPOST"    ""              ; Prefix and suffix for alternate text
  19. "DIMASO"      "On"
  20. "DIMASSOC"    "2"
  21. "DIMASZ"      "0.15"          ; Arrow size
  22. "DIMATFIT"    "3"             ; Arrow and text fit
  23. "DIMAUNIT"    "0"             ; Angular unit format
  24. "DIMAZIN"     "0"             ; Angular zero supression
  25. "DIMBLK"      "."             ; Arrow block name
  26. "DIMBLK1"     "."             ; First arrow block name
  27. "DIMBLK2"     "."             ; Second arrow block name
  28. "DIMCEN"      "0.1"           ; Center mark size
  29. "DIMCLRD"     "256"           ; Dimension line and leader color
  30. "DIMCLRE"     "256"           ; Extension line color
  31. "DIMCLRT"     "256"             ; Dimension text color
  32. "DIMDEC"      "2"             ; Decimal places
  33. "DIMDLE"      "0.0000"        ; Dimension line extension
  34. "DIMDLI"      "0.1"           ; Dimension line spacing
  35. "DIMDSEP"     "."             ; Decimal separator
  36. "DIMEXE"      "0.05"          ; Extension above dimension line
  37. "DIMEXO"      "0.1"           ; Extension line origin offset
  38. "DIMFIT"      "4"             ; Move text, add leader when text doesn´t fit
  39. "DIMFRAC"     "0"
  40. "DIMGAP"      "0.05"          ; Gap from dimension line to text
  41. "DIMJUST"     "0"             ; Justification of text on dimension line
  42. "DIMLDRBLK"   ""              ; Leader block name
  43. "DIMLFAC"     "1.0000"        ; Linear unit scale factor
  44. "DIMLIM"      "Off"           ; Generate dimension limits
  45. "DIMLUNIT"    "2"             ; Linear unit format
  46. "DIMLWD"      "-2"            ; Dimension line and leader lineweight
  47. "DIMLWE"      "-2"            ; Extension line lineweight
  48. "DIMPOST"     ""              ; Prefix and suffix for dimension text
  49. "DIMRND"      "0.0000"        ; Rounding value
  50. "DIMSAH"      "Off"           ; Separate arrow blocks
  51. "DIMSD1"      "Off"           ; Suppress the first dimension line
  52. "DIMSD2"      "Off"           ; Suppress the second dimension line
  53. "DIMSE1"      "Off"           ; Suppress the first extension line
  54. "DIMSE2"      "Off"           ; Suppress the second extension line
  55. "dimsho"      "on"
  56. "DIMSOXD"     "Off"           ; Suppress outside dimension lines
  57. "DIMTAD"      "2"             ; Place text above the dimension line
  58. "DIMTDEC"     "2"             ; Tolerance decimal places
  59. "DIMTFAC"     "0.8"  
  60. "DIMTIH"      "Off"           ; Text inside extensions is horizontal
  61. "DIMTIX"      "Off"           ; Place text inside extensions
  62. "DIMTM"       "0.0000"        ; Minus tolerance
  63. "DIMTMOVE"    "1"             ; Text movement
  64. "DIMTOFL"     "On"            ; Force line inside extension lines
  65. "DIMTOH"      "Off"           ; Text outside horizontal
  66. "DIMTOL"      "Off"           ; Tolerance dimensioning
  67. "DIMTOLJ"     "2"             ; Tolerance vertical justification
  68. "DIMTP"       "0.0000"        ; Plus tolerance
  69. "DIMTSZ"      "0.0000"        ; Tick size
  70. "DIMTVP"      "0.0000"        ; Text vertical position
  71. "DIMTXSTY"    "RS"            ; Associated Text style
  72. "DIMTXT"      "0.2"           ; Text height
  73. "DIMTZIN"     "0"             ; Tolerance zero suppression
  74. "dimunit"     "2"
  75. "DIMUPT"      "Off"           ; User positioned text
  76. "DIMZIN"      "1"             ; Zero suppression
  77. "DIMFRAC"     "0"             ; Fraction format    (0 is stacked 2 horiz)
  78. "DIMTFAC"     "0.800"         ; Tolerance text height scaling factor
  79. );end command
  80. );end dimvars
  81. ;; LTSCALE AND TEXTSIZE VALUES
  82. ;;
  83. (defun othervars (/)
  84.   (COMMAND "LTSCALE" (* (getvar 'Dimscale)0.)
  85.   (COMMAND "TEXTSIZE" (* (getvar 'Dimscale)0.2))
  86. );end othervars
  87. ;; START OF DIMSTYLES
  88. ;;
  89. (defun C:ES ()
  90.   (setq value (getdist "\nEscala deseada: "))
  91.   (dimvars)
  92.   (COMMAND "DIMSCALE" (/ value 100))  
  93.   (othervars)
  94. [color=red]  (COMMAND "DIMSTYLE""SAVE""ESC1.(strcat (rtos value)2 0)""Y")[/color]
  95. (princ (strcat "\nESCALA 1: "(strcat value)" CARGADA..."))
  96. (princ)
  97. )
  98. ;;
  99. ;;
  100. (defun C:E25 ()
  101.   (dimvars)
  102.   (COMMAND "DIMSCALE"".25")
  103.   (othervars)
  104. [color=red]  (COMMAND "DIMSTYLE""SAVE""ESC1.25""Y")[/color]
  105.   (prompt "\nESCALA 1:25 CARGADA...")   
  106. (princ)
  107. )
  108. ;;
  109. ;;
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 11:36:12 | 显示全部楼层
STRCAT函数用于将两个或多个字符串连接在一起-您需要包括“ESC1”在他的电话里挂线;根据您的示例,如果函数调用包含在字符串中,则不会对其求值,而是将其视为字符串。还要注意RTOS函数,他的模式参数不包括在调用中。
 
因此,不是:
  1. "ESC1.(strcat (rtos value)2 0)"

 
应使用:
  1. (strcat "ESC1." (rtos value 2 0))

 
当做
回复

使用道具 举报

29

主题

196

帖子

168

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
145
发表于 2022-7-6 11:46:25 | 显示全部楼层
 
不是那样的。。。
 
命令:es
Escala deseada:7未知命令“(RTOS值2 0))”。按F1键获取帮助。
未知命令“Y”。按F1键获取帮助。
错误的参数类型:stringp 7.0
 
我应该得到
命令:e25未知命令“Y”。按F1键获取帮助。
埃斯卡拉1:25卡加达。。。
 
如果我选择7。。。我应该得到
Escala deseada:7未知命令“Y”。按F1键获取帮助。
埃斯卡拉1:7卡加达。。。
 
应该创建一个名为“ESC1.7”的dmstyle。。。这一步我需要找出如何。。
 
换句话说,我需要使用文本“ESC1.x”创建一个Dimstyle(但我需要使用用户之前输入的“value”来代替“x”)
 
你知道怎么做吗?
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 11:52:24 | 显示全部楼层
  1. (if (tblsearch "dimstyle" (strcat "ESC1." (rtos value 2 0)))
  2. (COMMAND "DIMSTYLE" "SAVE" (strcat "ESC1." (rtos value 2 0)) "Y")
  3. (COMMAND "DIMSTYLE" "SAVE" (strcat "ESC1." (rtos value 2 0)))
  4. )
回复

使用道具 举报

29

主题

196

帖子

168

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
145
发表于 2022-7-6 11:58:45 | 显示全部楼层
 
 
对你又成功了,艾伦。。。
 
无论如何,我犯了一个错误,这个错误并没有让程序结束。。。
 
命令:ES
Escala-deseada:22错误参数类型:numberp:“ESC1.22”
命令:
 
现在它创建了dimstyle E1.22,但我希望它完成,这样我就可以知道创建的dimstyle了。。。你知道这个错误的原因是什么吗?
 
  1. (defun C:ES ()
  2.   (setq value (getdist "\nEscala deseada: "))
  3.   (dimvars)
  4.   (COMMAND "DIMSCALE" (/ value 100))  
  5.   (othervars)
  6. (if (tblsearch "dimstyle" (strcat "ESC1." (rtos value 2 0)))
  7.   (COMMAND "DIMSTYLE" "SAVE" (strcat "ESC1." (rtos value 2 0)) "Y")
  8.   (COMMAND "DIMSTYLE" "SAVE" (strcat "ESC1." (rtos value 2 0)))
  9. )
  10. (princ (strcat "\nEscala: " (rtos (getvar 'dimstyle)) " CARGADA..."))
  11. (princ)
  12. )

 
没有关系。。。我这样解决了。。
 
  1. (setq curdimstyl (getvar 'dimstyle))
  2. (princ (strcat "\nEscala: " curdimstyl " CARGADA..."))
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 12:12:42 | 显示全部楼层
替换:
  1. (princ (strcat "\nESCALA 1: "(strcat value)" CARGADA..."))

 
使用:
  1. (princ (strcat "\nESCALA 1: " (rtos value 2 0) " CARGADA..."))
回复

使用道具 举报

29

主题

196

帖子

168

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
145
发表于 2022-7-6 12:19:23 | 显示全部楼层
所以,结果是这样的。。。
 
  1. ;; STANDARD PARA DIMENSIONES HECHO PARA FAMILIA GIL
  2. ;; Por Paulo Gil Soto , con ayuda de Alan J. Thompson
  3. ;; 13 Abril 2010
  4. (vmon)
  5. ;; DIMENSION VARIABLES
  6. ;; THESE VALUES WILL AFFECT ALL NEW DIMSTYLES
  7. ;;
  8. (defun dimvars (/)
  9.   (COMMAND "style""RS""romans.shx""0.0"".8""0.00""N""N""N")
  10. (command
  11. "DIMADEC"     "2"             ; Angular decimal places
  12. "DIMALT"      "Off"           ; Alternate units selected
  13. "DIMALTD"     "2"             ; Alternate unit decimal places
  14. "DIMALTF"     "25.4000"       ; Alternate unit scale factor
  15. "DIMALTRND"   "0"             ; Alternate units rounding value
  16. "DIMALTTD"    "2"             ; Alternate tolerance decimal places
  17. "DIMALTTZ"    "0"             ; Alternate tolerance zero suppression
  18. "DIMALTU"     "2"             ; Alternate units
  19. "DIMALTZ"     "0"             ; Alternate unit zero suppression
  20. "DIMAPOST"    ""              ; Prefix and suffix for alternate text
  21. "DIMASO"      "On"
  22. "DIMASSOC"    "2"
  23. "DIMASZ"      "0.15"          ; Arrow size
  24. "DIMATFIT"    "3"             ; Arrow and text fit
  25. "DIMAUNIT"    "0"             ; Angular unit format
  26. "DIMAZIN"     "0"             ; Angular zero supression
  27. "DIMBLK"      "."             ; Arrow block name
  28. "DIMBLK1"     "."             ; First arrow block name
  29. "DIMBLK2"     "."             ; Second arrow block name
  30. "DIMCEN"      "0.1"           ; Center mark size
  31. "DIMCLRD"     "256"           ; Dimension line and leader color
  32. "DIMCLRE"     "256"           ; Extension line color
  33. "DIMCLRT"     "256"             ; Dimension text color
  34. "DIMDEC"      "2"             ; Decimal places
  35. "DIMDLE"      "0.0000"        ; Dimension line extension
  36. "DIMDLI"      "0.1"           ; Dimension line spacing
  37. "DIMDSEP"     "."             ; Decimal separator
  38. "DIMEXE"      "0.05"          ; Extension above dimension line
  39. "DIMEXO"      "0.1"           ; Extension line origin offset
  40. "DIMFIT"      "4"             ; Move text, add leader when text doesn´t fit
  41. "DIMFRAC"     "0"
  42. "DIMGAP"      "0.05"          ; Gap from dimension line to text
  43. "DIMJUST"     "0"             ; Justification of text on dimension line
  44. "DIMLDRBLK"   ""              ; Leader block name
  45. "DIMLFAC"     "1.0000"        ; Linear unit scale factor
  46. "DIMLIM"      "Off"           ; Generate dimension limits
  47. "DIMLUNIT"    "2"             ; Linear unit format
  48. "DIMLWD"      "-2"            ; Dimension line and leader lineweight
  49. "DIMLWE"      "-2"            ; Extension line lineweight
  50. "DIMPOST"     ""              ; Prefix and suffix for dimension text
  51. "DIMRND"      "0.0000"        ; Rounding value
  52. "DIMSAH"      "Off"           ; Separate arrow blocks
  53. "DIMSD1"      "Off"           ; Suppress the first dimension line
  54. "DIMSD2"      "Off"           ; Suppress the second dimension line
  55. "DIMSE1"      "Off"           ; Suppress the first extension line
  56. "DIMSE2"      "Off"           ; Suppress the second extension line
  57. "dimsho"      "on"
  58. "DIMSOXD"     "Off"           ; Suppress outside dimension lines
  59. "DIMTAD"      "2"             ; Place text above the dimension line
  60. "DIMTDEC"     "2"             ; Tolerance decimal places
  61. "DIMTFAC"     "0.8"  
  62. "DIMTIH"      "Off"           ; Text inside extensions is horizontal
  63. "DIMTIX"      "Off"           ; Place text inside extensions
  64. "DIMTM"       "0.0000"        ; Minus tolerance
  65. "DIMTMOVE"    "1"             ; Text movement
  66. "DIMTOFL"     "On"            ; Force line inside extension lines
  67. "DIMTOH"      "Off"           ; Text outside horizontal
  68. "DIMTOL"      "Off"           ; Tolerance dimensioning
  69. "DIMTOLJ"     "2"             ; Tolerance vertical justification
  70. "DIMTP"       "0.0000"        ; Plus tolerance
  71. "DIMTSZ"      "0.0000"        ; Tick size
  72. "DIMTVP"      "0.0000"        ; Text vertical position
  73. "DIMTXSTY"    "RS"            ; Associated Text style
  74. "DIMTXT"      "0.2"           ; Text height
  75. "DIMTZIN"     "0"             ; Tolerance zero suppression
  76. "dimunit"     "2"
  77. "DIMUPT"      "Off"           ; User positioned text
  78. "DIMZIN"      "1"             ; Zero suppression
  79. "DIMFRAC"     "0"             ; Fraction format    (0 is stacked 2 horiz)
  80. "DIMTFAC"     "0.800"         ; Tolerance text height scaling factor
  81. );end command
  82. );end dimvars
  83. ;; LTSCALE AND TEXTSIZE VALUES
  84. ;;
  85. (defun othervars (/)
  86.   (COMMAND "LTSCALE" (* (getvar 'Dimscale)0.)
  87.   (COMMAND "TEXTSIZE" (* (getvar 'Dimscale)0.2))
  88. );end othervars
  89. ;; START OF DIMSTYLES
  90. ;;
  91. (defun C:ES ()
  92.   (setq value (getdist "\nEscala deseada 1:... "))
  93. ;; LOAD DIMVARS
  94.   (dimvars)
  95.   (COMMAND "DIMSCALE" (/ value 100))  
  96. ;; LOAD OTHERVARS
  97.   (othervars)
  98. ;; CREATE NEW DIMSTYLE
  99. (if (tblsearch "dimstyle" (strcat "ESC1." (rtos value 2 0)))
  100.   (COMMAND "DIMSTYLE" "SAVE" (strcat "ESC1." (rtos value 2 0)) "Y")
  101.   (COMMAND "DIMSTYLE" "SAVE" (strcat "ESC1." (rtos value 2 0)))
  102. )
  103. ;; FINAL MESSAGE
  104. (setq curdimstyl (getvar 'dimstyle))
  105. (princ (strcat "\nEscala: " curdimstyl " CARGADA..."))
  106. (princ)
  107. )
  108. ;;
  109. ;;
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 12:30:25 | 显示全部楼层
无需定义DimStyle:
 
  1. (princ (strcat "\nEscala: " (getvar 'dimstyle) " CARGADA..."))
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-6 02:06 , Processed in 0.324691 second(s), 68 queries .

© 2020-2025 乐筑天下

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