乐筑天下

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

[编程交流] 关于线型/旋转的问题

[复制链接]

59

主题

327

帖子

268

银币

后起之秀

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

铜币
295
发表于 2022-7-6 10:24:44 | 显示全部楼层 |阅读模式
我可能在错误的论坛,如果是这样,请将我转移到它所属的地方:
 
请参见下图,如果我创建类似acad GAS_线的线型,则文字不会按我希望的方式旋转。
 
  1. *GAS_LINE,Gas line ----GAS----GAS----GAS----GAS--
  2. A,12.7,-5.08,["GAS",STANDARD,S=2.54,R=0.0,X=-2.54,Y=-1.27],-6.35

 
“R”表示从x轴旋转。。。如果“R”是“A”,则从实际线条旋转。。。有人能跟着我吗??
 
无论如何我想让线型“可读”,例如参见图。
 
一个人怎样才能完成这样的事情?我是否可以使用类似sysvariable的东西,或者它必须是解决这个问题的lisp例程?
 
谢谢你的帮助!!
112449a5wu0ezaw5dtkg58.jpg
回复

使用道具 举报

4

主题

940

帖子

961

银币

初来乍到

Rank: 1

铜币
12
发表于 2022-7-6 10:31:03 | 显示全部楼层
无法使用1条连续的多段线,您将需要2条不同的多段线;或者在LR角处打断它,然后使用反向多段线例程来获取所需内容。
回复

使用道具 举报

59

主题

327

帖子

268

银币

后起之秀

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

铜币
295
发表于 2022-7-6 10:32:54 | 显示全部楼层
如果这是真的,我就不是舒尔了:有些人会制定“动态”的常规。。。可能是DynamicNetype。。。。。(提示提示…)
回复

使用道具 举报

4

主题

940

帖子

961

银币

初来乍到

Rank: 1

铜币
12
发表于 2022-7-6 10:35:18 | 显示全部楼层
我们希望舒尔在您写完后发布它;我很想看看你是怎么做的。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 10:39:58 | 显示全部楼层
 
我也是
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 10:41:30 | 显示全部楼层
我三个。
回复

使用道具 举报

59

主题

327

帖子

268

银币

后起之秀

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

铜币
295
发表于 2022-7-6 10:46:46 | 显示全部楼层
很抱歉,我无法抗拒:
 
我们在模型空间工作的父亲。。。“我是舒尔,有人会想出一个解决方案,”他相当认真地说。
 
“是的,对,但不是我!”第一个人说。
 
“你是谁,你这个小矮人”?”牧师愤怒地问道。
 
“嗯,我是一个乐队的鼓手,我只是$%^#!陪着你转。”。“哦,嗨。我是约翰、林戈和弗雷迪”。我们都在同一个乐队里。。。
 
[嘘..]
 
你可以感觉到紧张。。。它静了下来,在寂静中你可以听到一颗小水滴落下。。。
 
然后突然,牧师揭示了他的真实内心:
“我本身就是邪恶的,我会把你和你们乐队的其他人踢扁!”他喊道。
 
哈,他们都会嘲笑他“嘲笑我们……”
“来吧,让我们牵着他的马!!!”
 
他们跑到外面,事情发生了:马被打得很惨:
 
就在那天,这是关于牧师的故事。
 
当然,外面还有一些打斗,因为约翰对那匹被打的马感到恶心,他想让它停下来。
 
约翰-->病得很厉害。。。
 
最后他们想出了一个主意,应该有人帮助牧师。考虑到这匹死马,他们认为欠他一匹。
 
他们根据需要制定了一套程序。不是为了取悦牧师,而是为了留在论坛上,以避免被禁止
 
 
故事以一个快乐的牧师、一匹死马和一个精彩的节目结束。
 
---
 
这不是玩笑。我们现在需要做的就是搜索在几个私人时刻丢失的原作(是的,你知道)
112451c3mib3hi3a333zmh.jpg
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 10:47:26 | 显示全部楼层
wth。。。
回复

使用道具 举报

49

主题

1246

帖子

1210

银币

后起之秀

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

铜币
254
发表于 2022-7-6 10:51:05 | 显示全部楼层
哈,如果lpseifert、lee mac和alanjt都同意这是不可能的,那么这是一成不变的。这三个人都是大多数人喜欢称之为CAD定制的“大师”。
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 10:54:01 | 显示全部楼层
 
 
马可,
 
附件是我帮助另一位会员的项目。它从包含文本的文件中绘制自定义线型。该程序实际上是从其中点旋转直线以纠正读取方向。
 
试试附件,看看这是否是你需要的。然后回顾程序,看看这是如何做到的。它充分评论了。
 
注意:确保所有三个文件都在一起并位于Acad搜索支持路径中。
 
查看循环以了解发生了什么。
 
  1. ;
  2. ; Output Function
  3. ;
  4. (defun ESS_OF ()                                                              ;Define function
  5. (setq c "84")                                                               ;Set Layer Color
  6. (setq d "0.3")                                                              ;Set Line Weight
  7. (if                                                                         ;If the following returns true
  8.    (= LCAT "C1")                                                             ;LCAT = C1
  9.    (setq a (strcat "CCC_DR_"SIZE"_"HOLE)                                     ;Set Linetype
  10.          b (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_"SIZE"_"HOLE) ;Set Layer Name
  11.    )                                                                         ;End setq
  12. )                                                                           ;End if
  13. (if                                                                         ;If the following returns true
  14.    (= LCAT "C2")                                                             ;LCAT = C2
  15.    (setq a (strcat "CCC_DR_"SIZE)                                            ;Set Linetype
  16.          b (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_"SIZE)        ;Set Layer Name
  17.    )                                                                         ;End setq
  18. )                                                                           ;End if
  19. (if                                                                         ;If the following returns true
  20.    (not                                                                      ;Verify that an item evaluates to nil
  21.      (tblsearch "LTYPE" a)                                                   ;Search drawing for linetype
  22.    )                                                                         ;If linetype not found
  23.    (command "_.-linetype" "_l" a "CCC_Drainage.lin" "")                      ;Load linetype, from file
  24. )                                                                           ;End if
  25. (ESS_LC b c a d)                                                            ;Go to ESS_LC ~ Layer Create Function, Layer Name/Color/Linetype/Lineweight
  26. (setvar "angbase" 0.0000)                                                   ;Set Angle Base to 0
  27. (setvar "angdir"  0)                                                        ;Set Angle Direction to 0
  28. (setvar "orthomode" 1)                                                      ;Turn on Orthomode
  29. (setvar "osmode"    16383)                                                  ;Turn on all Object Snaps
  30. (setq PT01 (getpoint "\nEnter the line start point:"))                      ;Get the first point of line
  31. [color=red](while                                                                      ;Evaluate expression till nill[/color]
  32. [color=red]   (/= nil                                                                   ;If not =[/color]
  33. [color=red]     (setq PT02 (getpoint PT01 "\nEnter the line end point:"))               ;Set point 2[/color]
  34. [color=red]   )                                                                         ;End if not[/color]
  35. [color=red]   (setvar "osmode" 0)                                                       ;Turn off all Object Snaps[/color]
  36. [color=red]   (if                                                                       ;If the following returns true[/color]
  37. [color=red]     (= LCAT "C1")                                                           ;LCAT ~ Line Category = C1[/color]
  38. [color=red]     (progn                                                                  ;Then do the following[/color]
  39. [color=red]       (command "_.pline" PT01 PT02 "")                                      ;Pline command[/color]
  40. [color=red]       (setq RADIANS (angle PT01 PT02))                                      ;Get line angle in radians[/color]
  41. [color=red]       (setq DEGREES (ESS_RTD RADIANS))                                      ;Convert radians to degrees[/color]
  42. [color=red]       (setq PLEN (distance PT01 PT02))                                      ;Get the line distance[/color]
  43. [color=red]       (setq MIDPT (polar PT01 (ESS_DTR DEGREES)(/ PLEN 2.0)))               ;Set the midpoint of the line[/color]
  44. [color=red]       (setq PT01 PT02)                                                      ;Set point 1 from point 2[/color]
  45. [color=red]       (setvar "osmode" 16383)                                               ;Turn on all Object Snaps[/color]
  46. [color=red]       (if                                                                   ;If the following returns true[/color]
  47. [color=red]         (and                                                                ;Return the logical AND of the supplied arguments [/color]
  48. [color=red]           (>  DEGREES 90.0)                                                 ;Degrees is greater than 90[/color]
  49. [color=red]           (<= DEGREES 270.0)                                                ;And less than or equal to 270[/color]
  50. [color=red]         )                                                                   ;End and[/color]
  51. [color=red]         (command "_.rotate" "last" "" MIDPT "180.0")                        ;Rotate the line on it mid-point 180 degrees[/color]
  52. [color=red]       )                                                                     ;End if[/color]
  53. [color=red]     )[/color]                                                                       ;Otherwise...
  54.    )                                                                         ;End if
  55.    (if                                                                       ;If the following returns true
  56.      (= LCAT "C2")                                                           ;LCAT ~ Line Category = C2
  57.      (progn                                                                  ;Then do the following
  58.        (command "_.pline" PT01 PT02 "")                                      ;Pline command
  59.        (setq PT01 PT02)                                                      ;Set point 1 from point 2
  60.        (setvar "osmode" 16383)                                               ;Turn on all Object Snaps
  61.      )                                                                       ;Otherwise...
  62.    )                                                                         ;End if
  63. )                                                                           ;End while
  64. (setq *error* temperr)                                                      ;Restore error
  65. (setvar "cmdecho"   SUCE)                                                   ;Restore Saved User Command Echo
  66. (setvar "orthomode" SUOM)                                                   ;Restore Saved User Orthomode
  67. (setvar "osmode"    SUSM)                                                   ;Restore Saved User Object Snapmode
  68. (setvar "angbase"   SUAB)                                                   ;Restore Saved User Angle Base
  69. (setvar "angdir"    SUAD)                                                   ;Restore Saved User Angle Direction
  70. (princ)                                                                     ;Exit quietly
  71. )                                                                             ;End defun
  72. ;

 
为什么不一次全部存储:
 
  1. ;//////////////////////////////////////////////////////////////////////////
  2. ;
  3. ; Start-Up Function
  4. ;
  5. (defun C:GL ()                                                             ;Define function
  6. (GL_MF)                                                                  ;Go to GL_MF ~ Main Function
  7. (princ)                                                                  ;Exit quietly
  8. )                                                                          ;End defun
  9. (princ "\nGL.lsp Loaded....")                                              ;print message to command line
  10. (princ "\nType GL to start program.")                                      ;print message to command line
  11. ;
  12. ;//////////////////////////////////////////////////////////////////////////
  13. ;
  14. ; Main Function
  15. ;
  16. (defun GL_MF (/ SUCE SUOM SUSM SUAB SUAD MIDPT PLEN  PT01 PT02)            ;Define function, Declare local variables
  17. ;                 
  18. (setq SUCE (getvar "cmdecho"))                                           ;Save User Command Echo
  19. (setq SUOM (getvar "orthomode"))                                         ;Save User Orthomode
  20. (setq SUSM (getvar "osmode"))                                            ;Save User Object Snapmode
  21. (setq SUAB (getvar "angbase"))                                           ;Save User Angle Base
  22. (setq SUAD (getvar "angdir"))                                            ;Save User Angle Direction
  23. (setq temperr *error*)                                                   ;Save Temporary Error
  24. (setq *error* ESS_ET)                                                    ;Go to GL_ET ~ Error Trap Function
  25. ;
  26. (GL_LC "GAS LINE" "3" "GAS_LINE" "")                                     ;Go to GL_LC Layer Function, Layer Name, Color, Linetype & Lineweight
  27. ;
  28. (setvar "angbase" 0.0000)                                                ;Set Angle Base to 0
  29. (setvar "angdir"  0)                                                     ;Set Angle Direction to 0
  30. (setvar "orthomode" 1)                                                   ;Turn on Orthomode
  31. (setvar "osmode"    SUSM)                                                ;Turn on User Object Snaps
  32. [color=red](setq PT01 (getpoint "\nEnter the line start point:"))                   ;Get the first point of line[/color]
  33. [color=red](while                                                                   ;Evaluate expression till nill[/color]
  34. [color=red](/= nil                                                                ;If not =[/color]
  35. [color=red]  (setq PT02 (getpoint PT01 "\nEnter the line end point:"))            ;Set point 2[/color]
  36. [color=red])                                                                      ;End if not[/color]
  37. [color=red](setvar "osmode" 0)                                                    ;Turn off all Object Snaps[/color]
  38. [color=red](progn                                                                 ;Then do the following[/color]
  39. [color=red]  (command "_.pline" PT01 PT02 "")                                     ;Pline command[/color]
  40. [color=red]  (setq RADIANS (angle PT01 PT02))                                     ;Get line angle in radians[/color]
  41. [color=red]  (setq DEGREES (GL_RTD RADIANS))                                      ;Convert radians to degrees[/color]
  42. [color=red]  (setq PLEN (distance PT01 PT02))                                     ;Get the line distance[/color]
  43. [color=red]  (setq MIDPT (polar PT01 (GL_DTR DEGREES)(/ PLEN 2.0)))               ;Set the midpoint of the line[/color]
  44. [color=red]  (setq PT01 PT02)                                                     ;Set point 1 from point 2[/color]
  45. [color=red]  (setvar "osmode" SUSM)                                               ;Turn on User Object Snaps[/color]
  46. [color=red]  (if                                                                  ;If the following returns true[/color]
  47. [color=red]    (and                                                               ;Return the logical AND of the supplied arguments [/color]
  48. [color=red]      (>  DEGREES 90.0)                                                ;Degrees is greater than 90[/color]
  49. [color=red]      (<= DEGREES 270.0)                                               ;And less than or equal to 270[/color]
  50. [color=red]    )                                                                  ;End and[/color]
  51. [color=red]    (command "_.rotate" "last" "" MIDPT "180.0")                       ;Rotate the line on it mid-point 180 degrees[/color]
  52. [color=red]  )                                                                    ;End if[/color]
  53.    [color=red])                                                                      ;Otherwise...[/color]
  54. [color=red])                                                                        ;End while[/color]
  55. (setq *error* temperr)                                                   ;Restore error
  56. (setvar "cmdecho"   SUCE)                                                ;Restore Saved User Command Echo
  57. (setvar "orthomode" SUOM)                                                ;Restore Saved User Orthomode
  58. (setvar "osmode"    SUSM)                                                ;Restore Saved User Object Snapmode
  59. (setvar "angbase"   SUAB)                                                ;Restore Saved User Angle Base
  60. (setvar "angdir"    SUAD)                                                ;Restore Saved User Angle Direction
  61. (princ)                                                                  ;Exit quietly
  62. )                                                                          ;End defun
  63. ;
  64. ;//////////////////////////////////////////////////////////////////////////
  65. ;
  66. ; Degrees to Radians Function
  67. ;
  68. (defun GL_DTR (DEGREES)                                                    ;Define function, DEGREES is the argument
  69. (* pi (/ DEGREES 180.0))                                                  ;Calculate Degress to radians
  70. )                                                                          ;End defun
  71. ;
  72. ;//////////////////////////////////////////////////////////////////////////
  73. ;
  74. ; Radians to Degrees Function
  75. ;
  76. (defun GL_RTD (RADIANS)                                                    ;Define function, RADIANS is the argument
  77. (* 180.0 (/ RADIANS pi))                                                 ;Calculate Radians to degress
  78. )                                                                          ;End defun
  79. ;
  80. ;//////////////////////////////////////////////////////////////////////////
  81. ;
  82. ; Layer Create Function
  83. ;
  84. (defun GL_LC (NLAY LCLR LTYP LWGT / LAY FRZ)                               ;Define function, Declare local variables and arguments
  85. ;
  86. (setq CLAY (getvar "clayer"))                                            ;Get the current layer
  87. (setq LAY (tblsearch "layer" NLAY))                                      ;Search drawing to find layer, Note: (NOT USED)
  88. (if                                                                      ;If the following returns true
  89.    (not LAY)                                                              ;Layer not in drawing
  90.    (command "_.layer" "m" NLAY "c" LCLR "" "lt" LTYP "" "lw" LWGT "" "")  ;Layer command
  91.    (progn                                                                 ;Then do the following
  92.      (setq FRZ (cdr (assoc 70 LAY)))                                      ;Variable FRZ is frozen layer
  93.      (if                                                                  ;If the following returns true
  94.        (= FRZ 65)                                                         ;Layer frozen from last edit
  95.        (progn                                                             ;Then do the following
  96.          (command "_.layer" "t" NLAY "")                                  ;Thaw layer
  97.          (command "_.layer" "s" NLAY "")                                  ;Set layer
  98.        )                                                                  ;Otherwise...
  99.        (command "_.layer" "s" NLAY "")                                    ;Set layer
  100.      )                                                                    ;End if
  101.    )                                                                      ;Otherwise...
  102. )                                                                        ;End if
  103. (princ)                                                                  ;Exit quietly
  104. )                                                                          ;End defun
  105. ;
  106. ;//////////////////////////////////////////////////////////////////////////
  107. ;
  108. ; Error Trap Function
  109. ;
  110. (defun GL_ET (errmsg)                                                      ;Define function, errmsg is the argument
  111. (command nil nil nil)                                                    ;When escape selected
  112. (if                                                                      ;If the following returns true
  113.    (not                                                                   ;Verify that an item evaluates to nil
  114.      (member errmsg '("console break" "Function Cancelled"))              ;Search list for an occurence of an expression
  115.    )                                                                      ;End not
  116.    (princ (strcat "\nError:" errmsg))                                     ;Print message to command line
  117. )                                                                        ;End if
  118. (setvar "cmdecho"   SUCE)                                                ;Restore Saved User Command Echo
  119. (setvar "orthomode" SUOM)                                                ;Restore Saved User Orthomode
  120. (setvar "osmode"    SUSM)                                                ;Restore Saved User Object Snapmode
  121. (setvar "angbase"   SUAB)                                                ;Restore Saved User Angle Base
  122. (setvar "angdir"    SUAD)                                                ;Restore Saved User Angle Direction
  123. (princ "\nError, Restoring Variables.")                                  ;Print message to command line
  124. (terpri)                                                                 ;Terminate print
  125. (setq *error* temperr)                                                   ;Restore error
  126. (princ)                                                                  ;Exit quietly
  127. )                                                                          ;End defun
  128. ;
  129. ;//////////////////////////////////////////////////////////////////////////

 
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-6 21:54 , Processed in 0.515978 second(s), 86 queries .

© 2020-2025 乐筑天下

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