MarcoW 发表于 2022-7-6 10:24:44

关于线型/旋转的问题

我可能在错误的论坛,如果是这样,请将我转移到它所属的地方:
 
请参见下图,如果我创建类似acad GAS_线的线型,则文字不会按我希望的方式旋转。
 

*GAS_LINE,Gas line ----GAS----GAS----GAS----GAS--
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例程?
 
谢谢你的帮助!!

lpseifert 发表于 2022-7-6 10:31:03

无法使用1条连续的多段线,您将需要2条不同的多段线;或者在LR角处打断它,然后使用反向多段线例程来获取所需内容。

MarcoW 发表于 2022-7-6 10:32:54

如果这是真的,我就不是舒尔了:有些人会制定“动态”的常规。。。可能是DynamicNetype。。。。。(提示提示…)

lpseifert 发表于 2022-7-6 10:35:18

我们希望舒尔在您写完后发布它;我很想看看你是怎么做的。

Lee Mac 发表于 2022-7-6 10:39:58

 
我也是

alanjt 发表于 2022-7-6 10:41:30

我三个。

MarcoW 发表于 2022-7-6 10:46:46

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

Lee Mac 发表于 2022-7-6 10:47:26

wth。。。

tzframpton 发表于 2022-7-6 10:51:05

哈,如果lpseifert、lee mac和alanjt都同意这是不可能的,那么这是一成不变的。这三个人都是大多数人喜欢称之为CAD定制的“大师”。

The Buzzard 发表于 2022-7-6 10:54:01

 
 
马可,
 
附件是我帮助另一位会员的项目。它从包含文本的文件中绘制自定义线型。该程序实际上是从其中点旋转直线以纠正读取方向。
 
试试附件,看看这是否是你需要的。然后回顾程序,看看这是如何做到的。它充分评论了。
 
注意:确保所有三个文件都在一起并位于Acad搜索支持路径中。
 
查看循环以了解发生了什么。
 
;
; Output Function
;
(defun ESS_OF ()                                                            ;Define function
(setq c "84")                                                               ;Set Layer Color
(setq d "0.3")                                                            ;Set Line Weight
(if                                                                         ;If the following returns true
   (= LCAT "C1")                                                             ;LCAT = C1
   (setq a (strcat "CCC_DR_"SIZE"_"HOLE)                                     ;Set Linetype
         b (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_"SIZE"_"HOLE) ;Set Layer Name
   )                                                                         ;End setq
)                                                                           ;End if
(if                                                                         ;If the following returns true
   (= LCAT "C2")                                                             ;LCAT = C2
   (setq a (strcat "CCC_DR_"SIZE)                                          ;Set Linetype
         b (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_"SIZE)      ;Set Layer Name
   )                                                                         ;End setq
)                                                                           ;End if
(if                                                                         ;If the following returns true
   (not                                                                      ;Verify that an item evaluates to nil
   (tblsearch "LTYPE" a)                                                   ;Search drawing for linetype
   )                                                                         ;If linetype not found
   (command "_.-linetype" "_l" a "CCC_Drainage.lin" "")                      ;Load linetype, from file
)                                                                           ;End if
(ESS_LC b c a d)                                                            ;Go to ESS_LC ~ Layer Create Function, Layer Name/Color/Linetype/Lineweight
(setvar "angbase" 0.0000)                                                   ;Set Angle Base to 0
(setvar "angdir"0)                                                      ;Set Angle Direction to 0
(setvar "orthomode" 1)                                                      ;Turn on Orthomode
(setvar "osmode"    16383)                                                ;Turn on all Object Snaps
(setq PT01 (getpoint "\nEnter the line start point:"))                      ;Get the first point of line
(while                                                                      ;Evaluate expression till nill
   (/= nil                                                                   ;If not =
   (setq PT02 (getpoint PT01 "\nEnter the line end point:"))               ;Set point 2
   )                                                                         ;End if not
   (setvar "osmode" 0)                                                       ;Turn off all Object Snaps
   (if                                                                     ;If the following returns true
   (= LCAT "C1")                                                         ;LCAT ~ Line Category = C1
   (progn                                                                  ;Then do the following
       (command "_.pline" PT01 PT02 "")                                    ;Pline command
       (setq RADIANS (angle PT01 PT02))                                    ;Get line angle in radians
       (setq DEGREES (ESS_RTD RADIANS))                                    ;Convert radians to degrees
       (setq PLEN (distance PT01 PT02))                                    ;Get the line distance
       (setq MIDPT (polar PT01 (ESS_DTR DEGREES)(/ PLEN 2.0)))               ;Set the midpoint of the line
       (setq PT01 PT02)                                                      ;Set point 1 from point 2
       (setvar "osmode" 16383)                                             ;Turn on all Object Snaps
       (if                                                                   ;If the following returns true
         (and                                                                ;Return the logical AND of the supplied arguments
         (>DEGREES 90.0)                                                 ;Degrees is greater than 90
         (<= DEGREES 270.0)                                                ;And less than or equal to 270
         )                                                                   ;End and
         (command "_.rotate" "last" "" MIDPT "180.0")                        ;Rotate the line on it mid-point 180 degrees
       )                                                                     ;End if
   )                                                                     ;Otherwise...
   )                                                                         ;End if
   (if                                                                     ;If the following returns true
   (= LCAT "C2")                                                         ;LCAT ~ Line Category = C2
   (progn                                                                  ;Then do the following
       (command "_.pline" PT01 PT02 "")                                    ;Pline command
       (setq PT01 PT02)                                                      ;Set point 1 from point 2
       (setvar "osmode" 16383)                                             ;Turn on all Object Snaps
   )                                                                     ;Otherwise...
   )                                                                         ;End if
)                                                                           ;End while
(setq *error* temperr)                                                      ;Restore error
(setvar "cmdecho"   SUCE)                                                   ;Restore Saved User Command Echo
(setvar "orthomode" SUOM)                                                   ;Restore Saved User Orthomode
(setvar "osmode"    SUSM)                                                   ;Restore Saved User Object Snapmode
(setvar "angbase"   SUAB)                                                   ;Restore Saved User Angle Base
(setvar "angdir"    SUAD)                                                   ;Restore Saved User Angle Direction
(princ)                                                                     ;Exit quietly
)                                                                           ;End defun
;
 
为什么不一次全部存储:
 
;//////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:GL ()                                                             ;Define function
(GL_MF)                                                                  ;Go to GL_MF ~ Main Function
(princ)                                                                  ;Exit quietly
)                                                                        ;End defun
(princ "\nGL.lsp Loaded....")                                              ;print message to command line
(princ "\nType GL to start program.")                                    ;print message to command line
;
;//////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun GL_MF (/ SUCE SUOM SUSM SUAB SUAD MIDPT PLENPT01 PT02)            ;Define function, Declare local variables
;               
(setq SUCE (getvar "cmdecho"))                                           ;Save User Command Echo
(setq SUOM (getvar "orthomode"))                                       ;Save User Orthomode
(setq SUSM (getvar "osmode"))                                          ;Save User Object Snapmode
(setq SUAB (getvar "angbase"))                                           ;Save User Angle Base
(setq SUAD (getvar "angdir"))                                          ;Save User Angle Direction
(setq temperr *error*)                                                   ;Save Temporary Error
(setq *error* ESS_ET)                                                    ;Go to GL_ET ~ Error Trap Function
;
(GL_LC "GAS LINE" "3" "GAS_LINE" "")                                     ;Go to GL_LC Layer Function, Layer Name, Color, Linetype & Lineweight
;
(setvar "angbase" 0.0000)                                                ;Set Angle Base to 0
(setvar "angdir"0)                                                   ;Set Angle Direction to 0
(setvar "orthomode" 1)                                                   ;Turn on Orthomode
(setvar "osmode"    SUSM)                                                ;Turn on User Object Snaps
(setq PT01 (getpoint "\nEnter the line start point:"))                   ;Get the first point of line
(while                                                                   ;Evaluate expression till nill
(/= nil                                                                ;If not =
(setq PT02 (getpoint PT01 "\nEnter the line end point:"))            ;Set point 2
)                                                                      ;End if not
(setvar "osmode" 0)                                                    ;Turn off all Object Snaps
(progn                                                               ;Then do the following
(command "_.pline" PT01 PT02 "")                                     ;Pline command
(setq RADIANS (angle PT01 PT02))                                     ;Get line angle in radians
(setq DEGREES (GL_RTD RADIANS))                                    ;Convert radians to degrees
(setq PLEN (distance PT01 PT02))                                     ;Get the line distance
(setq MIDPT (polar PT01 (GL_DTR DEGREES)(/ PLEN 2.0)))               ;Set the midpoint of the line
(setq PT01 PT02)                                                   ;Set point 1 from point 2
(setvar "osmode" SUSM)                                             ;Turn on User Object Snaps
(if                                                                  ;If the following returns true
    (and                                                               ;Return the logical AND of the supplied arguments
      (>DEGREES 90.0)                                                ;Degrees is greater than 90
      (<= DEGREES 270.0)                                             ;And less than or equal to 270
    )                                                                  ;End and
    (command "_.rotate" "last" "" MIDPT "180.0")                     ;Rotate the line on it mid-point 180 degrees
)                                                                  ;End if
   )                                                                      ;Otherwise...
)                                                                        ;End while
(setq *error* temperr)                                                   ;Restore error
(setvar "cmdecho"   SUCE)                                                ;Restore Saved User Command Echo
(setvar "orthomode" SUOM)                                                ;Restore Saved User Orthomode
(setvar "osmode"    SUSM)                                                ;Restore Saved User Object Snapmode
(setvar "angbase"   SUAB)                                                ;Restore Saved User Angle Base
(setvar "angdir"    SUAD)                                                ;Restore Saved User Angle Direction
(princ)                                                                  ;Exit quietly
)                                                                        ;End defun
;
;//////////////////////////////////////////////////////////////////////////
;
; Degrees to Radians Function
;
(defun GL_DTR (DEGREES)                                                    ;Define function, DEGREES is the argument
(* pi (/ DEGREES 180.0))                                                ;Calculate Degress to radians
)                                                                        ;End defun
;
;//////////////////////////////////////////////////////////////////////////
;
; Radians to Degrees Function
;
(defun GL_RTD (RADIANS)                                                    ;Define function, RADIANS is the argument
(* 180.0 (/ RADIANS pi))                                                 ;Calculate Radians to degress
)                                                                        ;End defun
;
;//////////////////////////////////////////////////////////////////////////
;
; Layer Create Function
;
(defun GL_LC (NLAY LCLR LTYP LWGT / LAY FRZ)                               ;Define function, Declare local variables and arguments
;
(setq CLAY (getvar "clayer"))                                          ;Get the current layer
(setq LAY (tblsearch "layer" NLAY))                                    ;Search drawing to find layer, Note: (NOT USED)
(if                                                                      ;If the following returns true
   (not LAY)                                                            ;Layer not in drawing
   (command "_.layer" "m" NLAY "c" LCLR "" "lt" LTYP "" "lw" LWGT "" "");Layer command
   (progn                                                               ;Then do the following
   (setq FRZ (cdr (assoc 70 LAY)))                                    ;Variable FRZ is frozen layer
   (if                                                                  ;If the following returns true
       (= FRZ 65)                                                         ;Layer frozen from last edit
       (progn                                                             ;Then do the following
         (command "_.layer" "t" NLAY "")                                  ;Thaw layer
         (command "_.layer" "s" NLAY "")                                  ;Set layer
       )                                                                  ;Otherwise...
       (command "_.layer" "s" NLAY "")                                    ;Set layer
   )                                                                  ;End if
   )                                                                      ;Otherwise...
)                                                                        ;End if
(princ)                                                                  ;Exit quietly
)                                                                        ;End defun
;
;//////////////////////////////////////////////////////////////////////////
;
; Error Trap Function
;
(defun GL_ET (errmsg)                                                      ;Define function, errmsg is the argument
(command nil nil nil)                                                    ;When escape selected
(if                                                                      ;If the following returns true
   (not                                                                   ;Verify that an item evaluates to nil
   (member errmsg '("console break" "Function Cancelled"))            ;Search list for an occurence of an expression
   )                                                                      ;End not
   (princ (strcat "\nError:" errmsg))                                     ;Print message to command line
)                                                                        ;End if
(setvar "cmdecho"   SUCE)                                                ;Restore Saved User Command Echo
(setvar "orthomode" SUOM)                                                ;Restore Saved User Orthomode
(setvar "osmode"    SUSM)                                                ;Restore Saved User Object Snapmode
(setvar "angbase"   SUAB)                                                ;Restore Saved User Angle Base
(setvar "angdir"    SUAD)                                                ;Restore Saved User Angle Direction
(princ "\nError, Restoring Variables.")                                  ;Print message to command line
(terpri)                                                               ;Terminate print
(setq *error* temperr)                                                   ;Restore error
(princ)                                                                  ;Exit quietly
)                                                                        ;End defun
;
;//////////////////////////////////////////////////////////////////////////
 
页: [1] 2
查看完整版本: 关于线型/旋转的问题