gys2010 发表于 2014-12-15 14:11:09

如何在加工注解输出前,在代码中加入提示,输入字体高度和字体类型和颜色

本帖最后由 ZZXXQQ 于 2014-12-20 10:55 编辑

;;;;;;;注解输出
(defun C:EP_output (/                os          txt            cla            no
            len0      LEN          ss            nam            ent
            w1      w2          ent1            ent2      rad1
            rad2      rad3          cen1            cen2      true1
            STR      dist          ss1            ss2            sscen1
            num      textnum          dist1            dist3   ptb
            ptb1      ptb2          ptb3            pto            RAD1
            RAD2      df_text          SS3            SS4            SS5
            ss0      LEN3          LEN4            LEN5      TRUE
            SSCEN      LTY1          LTY2            COL1      DIST12
            DIST13      DIST23          cen_sel   STR            cen_ss_reat
            ss_ins      cen_no_list            ss_no_list
            nam_no_list          ss_no_select            str_no_list
            str_ent2      cen3          bsw            COL2      stringth_list
            insert_3add          insert    insert_wl_length
            wl_length      deepth_ref
             )
(setq cdat (atoi (rtos (getvar "cdate"))))
(if (> cdat 20000430)
    (progn
      (COMMAND "UCS" "")
      (SETVAR "CMDECHO" 0)
      (setvar "dimzin" 8)
      (if (not (tblsearch "style" "iso-25"))
      (command "style" "iso-25" "gbcbig" "" "0.7" "" "" "" "")
      (setvar "textstyle" "iso-25")
      )
      (prompt
      "\n Thank you!
               \n Thank you!
               \n Thank you!
               \n Thank you!"
      )
      (setq txt               (getvar "DIMTXT")
            view_ctr   (getvar "viewctr")
            view_width (/ (getvar "viewsize") 2)
      )
      (setq stringth_list (list      "A"   "B"   "C"          "D"      "E"   "F"
                              "G"   "H"   "J"          "K"      "L"   "M"
                              "N"   "P"   "Q"          "R"      "S"   "T"
                              "U"   "V"   "W"          "X"      "Y"   "Z"
                              "A1""B1""C1""D1"      "E1""F1"
                              "G1""H1""J1""K1"      "L1""M1"
                              "N1""P1""Q1""R1"      "S1""T1"
                              "U1""V1""W1""X1"      "Y1""Z1"
                              "A2""B2""C2"
                               )
            stringth_no          -1
      )
      (setq aute_point1 (getpoint "\n 请选择框选的一点"))
      (if (null aute_point1)
      (setq aute_point1 (polar view_ctr 3.66 (/ view_width 0.48)))
      )
      (setq aute_point2 (getcorner aute_point1 "\n 请选择框选的另一点"))
      (if (null aute_point2)
      (setq aute_point2 (polar view_ctr 0.52 (/ view_width 0.48)))
      )
      (setq pto (getpoint "\n 请选择标注内容的位置起始点"))
;;;;;;
;;;;;;
      (SETQ SS_all (SSGET "c"
                        aute_point1
                        aute_point2
                        (list      (cons -4 "<or")
                              (cons -4 "<and")
                              (cons 0 "CIRCLE")
                              (cons -4 "/=")
                              (cons 40 0.15)
                              (cons -4 "and>")
                              (cons -4 "<and")
                              (cons 0 "ARC")
                              (cons -4 ">")
                              (cons 40 3)
                              (cons -4 "<")
                              (cons 40 15)
                              (cons -4 "and>")
                              (cons -4 "or>")
                        )
                   )
      )
      (if (not (null SS_all))
      (progn
          (setq      no      -1
                cen_all      (list)
          )
          (repeat (sslength SS_all)
            (setq no         (1+ no)
                  cen_ss (cdr (assoc 10 (entget (ssname SS_all no))))
            )
            (if      (null (member cen_ss cen_all))
            (setq cen_all (cons cen_ss cen_all))
            )
          )
          (setq      no_cen_all
               -1
                cen_sel      (list)
          )
          (repeat (length cen_all)
            (setq no_cen_all(1+ no_cen_all)
                  cen_ss_reat (nth no_cen_all cen_all)
                  ss_start    (SSGET "c"
                                     aute_point1
                                     aute_point2
                                     (list (cons -4 "<or")
                                           (cons 0 "CIRCLE")
                                           (cons 0 "ARC")
                                           (cons -4 "or>")
                                           (cons 10 cen_ss_reat)
                                     )
                              )
            )
;;;;;
            (setq os (getvar "osmode"))
            (setvar "osmode" 0)
            (setq ss (ssadd))
            (SETQ NO -1
                  ay 0
            )
            (repeat (sslength ss_start)
            (SETQ no (1+ no))
            (setq nam1 (SSNAME ss_start NO))
            (setq ww (ENTGET nam1))
            (setq ptc (cdr (assoc 40 ww)))
            (setq ptc_point (cdr (assoc 10 ww)))
            (if (> ptc ay)
                (setq ay      ptc
                      ptc_pot ptc_point
                )
            )

            )
            (setq pot_left(polar ptc_pot 2.4 (* 1.5 ay))
                  pot_right (polar ptc_pot 5.5 (* 1.5 ay))
                  ss0            (SSGET "C"
                                 pot_left
                                 pot_right
                                 (LIST (CONS -4 "<or")
                                       (CONS 0 "CIRCLE")
                                       (CONS 0 "ARC")
                                       (CONS -4 "or>")
                                 )
                            )
            )
;;;;;
            (while (> (sslength ss0) 0)
            (SETQ NO -1
                  ay 0
            )
            (repeat (sslength ss0)
                (SETQ no (1+ no))
                (setq nam1 (SSNAME ss0 NO))
                (setq ww (ENTGET nam1))
                (setq ptc (cdr (assoc 40 ww)))
                (if (> ptc ay)
                  (setq      ayptc
                        nam nam1
                  )
                )

            )
            (setq ss0 (ssdel nam ss0))
            (setq ss (ssadd nam ss))
            )
            (IF      (= 2 (SSLENGTH SS))
            (PROGN
                (setq W1   (entget (ssname ss 0))
                      W2   (entget (ssname ss 1))
                      ent1 (cdr (assoc 0 W1))
                      ent2 (cdr (assoc 0 W2))
                      ent3 nil
                      COL1 (cdr (assoc 62 W1))
                      COL2 (cdr (assoc 62 W2))
                      LTY1 (cdr (assoc 6 W1))
                      LTY2 (cdr (assoc 6 W2))
                      cla1 (cdr (assoc 8 W1))
                      cla2 (cdr (assoc 8 W2))
                      RAD1 (CDR (ASSOC 40 W1))
                      RAD2 (CDR (ASSOC 40 W2))
                      CEN1 (trans (CDR (ASSOC 10 W1)) 0 1)
                      CEN2 (trans (CDR (ASSOC 10 W2)) 0 1)
                      DIST (DISTANCE CEN1 CEN2)
                )
                (IF (NULL LTY1)
                  (SETQ LTY1 "BYLAYER")
                )
                (IF (NULL LTY2)
                  (SETQ LTY2 "BYLAYER")
                )
                (IF (NULL COL1)
                  (SETQ COL1 256)
                )
                (IF (NULL COL2)
                  (SETQ COL2 256)
                )
                (setq ss_nam_list         (entget (ssname ss 0) (list "wl_length"))
                      insert_number_long (cadadr (assoc -3 ss_nam_list))
                )
                (if (not (null insert_number_long))
                  (setq deepth (rtos (cdr insert_number_long)))
                  (setq deepth "*")
                )
            )
            )
            (IF      (= 1 (SSLENGTH SS))
            (PROGN
                (setq W1   (entget (ssname ss 0))
                      col1 (cdr (assoc 62 W1))
                      ent1 (cdr (assoc 0 W1))
                      ent2 NIL
                      ent3 NIL
                      cla1 (cdr (assoc 8 W1))
                      RAD1 (CDR (ASSOC 40 W1))
                      LTY1 (CDR (ASSOC 6 W1))
                      CEN1 (trans (CDR (ASSOC 10 W1)) 0 1)
                )
                (IF (NULL LTY1)
                  (SETQ LTY1 "BYLAYER")
                )
                (IF (NULL COL1)
                  (SETQ COL1 256)
                )
                (setq ss_nam_list         (entget (ssname ss 0) (list "wl_length"))
                      insert_number_long (cadadr (assoc -3 ss_nam_list))
                )
                (if (not (null insert_number_long))
                  (setq deepth (rtos (cdr insert_number_long)))
                  (setq deepth "*")
                )
            )
            )
            (IF      (= 3 (SSLENGTH SS))
            (PROGN
                (setq W1   (entget (ssname ss 0))
                      W2   (entget (ssname ss 1))
                      W3   (entget (ssname ss 2))
                      ent1   (cdr (assoc 0 W1))
                      ent2   (cdr (assoc 0 W2))
                      ent3   (cdr (assoc 0 W3))
                      COL1   (cdr (assoc 62 W1))
                      COL2   (cdr (assoc 62 W2))
                      COL3   (cdr (assoc 62 W3))
                      LTY1   (cdr (assoc 6 W1))
                      LTY2   (cdr (assoc 6 W2))
                      LTY3   (cdr (assoc 6 W3))
                      cla1   (cdr (assoc 8 W1))
                      cla2   (cdr (assoc 8 W2))
                      cla3   (cdr (assoc 8 W3))
                      RAD1   (CDR (ASSOC 40 W1))
                      RAD2   (CDR (ASSOC 40 W2))
                      RAD3   (CDR (ASSOC 40 W3))
                      CEN1   (trans (CDR (ASSOC 10 W1)) 0 1)
                      CEN2   (trans (CDR (ASSOC 10 W2)) 0 1)
                      CEN3   (trans (CDR (ASSOC 10 W3)) 0 1)
                      DIST12 (DISTOF (RTOS (DISTANCE CEN1 CEN2) 2 3))
                      DIST13 (DISTOF (RTOS (DISTANCE CEN1 CEN3) 2 3))
                      DIST23 (DISTOF (RTOS (DISTANCE CEN2 CEN3) 2 3))
                )
                (IF (NULL LTY1)
                  (SETQ LTY1 "BYLAYER")
                )
                (IF (NULL LTY2)
                  (SETQ LTY2 "BYLAYER")
                )
                (IF (NULL LTY3)
                  (SETQ LTY3 "BYLAYER")
                )
                (IF (NULL COL1)
                  (SETQ COL1 256)
                )
                (IF (NULL COL2)
                  (SETQ COL2 256)
                )
                (IF (NULL COL3)
                  (SETQ COL3 256)
                )
                (setq ss_nam_list         (entget (ssname ss 0) (list "wl_length"))
                      insert_number_long (cadadr (assoc -3 ss_nam_list))
                )
                (if (not (null insert_number_long))
                  (setq deepth (rtos (cdr insert_number_long)))
                  (setq deepth "*")
                )
;;;;
                (setq ss_nam_list         (entget (ssname ss 1) (list "wl_length"))
                      insert_number_long (cadadr (assoc -3 ss_nam_list))
                )
                (if (not (null insert_number_long))
                  (setq deepth1 (rtos (cdr insert_number_long)))
                  (setq deepth1 "*")
                )
            )
            )
            (IF      (< 3 (SSLENGTH SS))
            (setq ent1 nil)
            )
;;;;;;;########

;;;;;;;########
            (if      (and (null (member CEN1 cen_sel)) (/= nil ent1))
            (progn
                (IF (AND (= ent1 "CIRCLE")
                         (= ent2 "CIRCLE")
                         (= ent3 NIL)
                         (= 0 DIST)
                  )
                  (PROGN
                  (SETQ SS1         (SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (LIST      (CONS 40 rad1)
                                                (CONS 0 "CIRCLE")
                                                (CONS 8 cla1)
                                                (CONS 6 LTY1)
                                                (CONS 62 COL1)
                                          )
                                 )
                        MI_textrad2
                        BIG_text rad1
                  )
                  (setq stringth_no (1+ stringth_no)
                        stringth    (nth stringth_no stringth_list)
                  )
                  (if      (not (null ss1))
                      (progn
                        (setq no      -1
                              LEN1    (SSLENGTH SS1)
                              SSCEN1(LIST)
                              TEXTNUM 0
                        )
                        (REPEAT      LEN1
                        (setq      no   (1+ no)
                              nam1 (ssname ss1 no)
                              W1   (entget nam1)
                              CEN1 (cdr (assoc 10 W1))
                              SS2(SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (list (CONS 0 "CIRCLE")
                                                (cons 10 CEN1)
                                                (CONS 40 rad2)
                                                (CONS 8 cla2)
                                                (CONS 6 LTY2)
                                                (CONS 62 COL2)
                                          )
                                     )
                              SS3(SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (LIST (cons 0 "CIRCLE")
                                                (cons 10 CEN1)
                                                (CONS -4 "/=")
                                                (CONS 40 rad1)
                                                (CONS -4 "/=")
                                                (CONS 40 rad2)
                                          )
                                     )
                        )
                        (setq      ss_nam_list         (entget nam1 (list "wl_length"))
                              insert_number_long (cadadr
                                                   (assoc -3 ss_nam_list)
                                                   )
                        )
                        (if (not (null insert_number_long))
                            (setq deepth_ref
                                 (rtos (cdr insert_number_long))
                            )
                            (setq deepth_ref "*")
                        )
                        (IF (and (not (null ss2))
                                 (null ss3)
                                 (null (member CEN1 SSCEN1))
                                 (= (read deepth_ref) (read deepth))
                              )
                            (chtext_point)
                        )
                        )
                        (setq cen_sel (append cen_sel SSCEN1))
                        (setvar "osmode" 64)
                        (SETQ PTO (polar PTO 4.712 (* 2 TXT)))
                        (IF (or      (= "HIDDEN" LTY1)
                              (= "HIDDEN2" LTY1)
                              (= "HIDDENX2" LTY1)
                              (= "DASHED" LTY1)
                              (= "DASHED2" LTY1)
                              (= "DASHEDX2" LTY1)
                            )
                        (SETQ      STR (STRCAT "%%u"
                                          stringth
                                          ": "
                                          (RTOS TEXTNUM 2 0)
                                          "-%%C"
                                          (RTOS (* 2 rad2) 2 2)
                                          "(钻通,%%C"
                                          (RTOS (* 2 rad1) 2 2)
                                          "背面沉孔,深度"
                                          DEEPTH
                                          ")"
                                    )
                        )
                        (SETQ      STR (STRCAT "%%u"
                                          stringth
                                          ": "
                                          (RTOS TEXTNUM 2 0)
                                          "-%%C"
                                          (RTOS (* 2 rad2) 2 2)
                                          " (钻通,%%C"
                                          (RTOS (* 2 rad1) 2 2)
                                          "正面沉孔,深度"
                                          DEEPTH
                                          ")"
                                    )
                        )
                        )
                        (setvar "osmode" 0)
                        (COMMAND "TEXT" "TL" PTO TXT "" STR "")
                      )
                      ;;(not (null ss1))
                  )
                  )
                  ;;ent="circle"
                )
;;;;;
                (IF (AND (= ent1 "ARC")
                         (= ent2 "CIRCLE")
                         (= ent3 NIL)
                         (= 0 DIST)
                  )
                  (PROGN
                  (SETQ SS1         (SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (LIST      (CONS 40 rad1)
                                                (CONS 0 "ARC")
                                                (CONS 8 CLA1)
                                                (CONS 6 LTY1)
                                                (CONS 62 COL1)
                                          )
                                 )
                        MI_textrad2
                        BIG_text rad1
                  )
                  (setq stringth_no (1+ stringth_no)
                        stringth    (nth stringth_no stringth_list)
                  )
                  (if      (not (null ss1))
                      (progn
                        (setq NO      -1
                              LEN1    (SSLENGTH SS1)
                              SSCEN1(LIST)
                              TEXTNUM 0
                        )
                        (REPEAT      LEN1
                        (setq      no   (1+ no)
                              nam1 (ssname ss1 no)
                              W1   (entget nam1)
                              CEN1 (cdr (assoc 10 W1))
                              SS2(SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (LIST (CONS 40 rad2)
                                                (cons 10 CEN1)
                                                (CONS 0 "CIRCLE")
                                                (CONS 8 CLA2)
                                                (CONS 6 LTY2)
                                                (CONS 62 COL2)
                                          )
                                     )
                        )
                        (IF (and (not (null ss2))
                                 (null (member CEN1 SSCEN1))
                              )
                            (chtext_point)
                        )
                        )
                        (setq cen_sel (append cen_sel SSCEN1))
                        (setvar "osmode" 64)
                        (SETQ PTO (polar PTO 4.712 (* 2 TXT)))
                        (COND ((and (<= 9.8 (* 2 rad1) 10.2)
                                    (<= 8.3 (* 2 rad2) 8.7)
                               )
                               (SETQ BSW "M10 攻穿")
                              )
                              ((and (<= 3.8 (* 2 rad1) 4.2)
                                    (<= 3.0 (* 2 rad2) 3.6)
                               )
                               (SETQ BSW "M4 攻穿")
                              )
                              ((and (<= 2.8 (* 2 rad1) 3.2)
                                    (<= 2.0 (* 2 rad2) 2.7)
                               )
                               (SETQ BSW "M3 攻穿")
                              )
                              ((and (<= 13.8 (* 2 rad1) 14.2)
                                    (<= 11.0 (* 2 rad2) 12.6)
                               )
                               (SETQ BSW "M14 攻穿")
                              )
                              ((and (<= 7.8 (* 2 rad1) 8.2)
                                    (<= 6.6 (* 2 rad2) 7.0)
                               )
                               (SETQ BSW "M8 攻穿")
                              )
                              ((and (<= 5.8 (* 2 rad1) 6.2)
                                    (<= 4.8 (* 2 rad2) 5.2)
                               )
                               (SETQ BSW "M6 攻穿")
                              )
                              ((and (<= 4.8 (* 2 rad1) 5.2)
                                    (<= 4.0 (* 2 rad2) 4.4)
                               )
                               (SETQ BSW "M5 攻穿")
                              )
                              ((and (<= 11.8 (* 2 rad1) 12.2)
                                    (<= 10.2 (* 2 rad2) 10.7)
                               )
                               (SETQ BSW "M12 攻穿")
                              )
                              ((and (<= 15.8 (* 2 rad1) 16.2)
                                    (<= 13.7 (* 2 rad2) 14.3)
                               )
                               (SETQ BSW "M16 攻穿")
                              )
                              (T (SETQ BSW "非标准螺丝"))
                        )
                        (SETQ STR (STRCAT "%%u"
                                          stringth
                                          ": "
                                          (RTOS TEXTNUM 2 0)
                                          "-"
                                          BSW
                                  )
                        )
                        (setvar "osmode" 0)
                        (COMMAND "TEXT" "TL" PTO TXT "" STR "")
                      )
                  )
                  )
                )
;;;;;;;***
                (IF (AND (= ent1 "ARC")
                         (= ent2 "ARC")
                         (= ent3 NIL)
                         (/= rad1 rad2)
                         (/= 0 DIST)
                  )
                  (PROGN
                  (SETQ ANGS1         (CDR (ASSOC 50 W1))
                        ANGE1         (CDR (ASSOC 51 W1))
                        ANGS2         (CDR (ASSOC 50 W2))
                        ANGE2         (CDR (ASSOC 51 W2))
                        POTS1         (POLAR CEN1 ANGS1 RAD1)
                        POTE1         (POLAR CEN1 ANGE1 RAD1)
                        POTS2         (POLAR CEN2 ANGS2 RAD2)
                        POTE2         (POLAR CEN2 ANGE2 RAD2)
                        MI_textrad1
                        BIG_text rad1
                  )
                  (setq stringth_no (1+ stringth_no)
                        stringth    (nth stringth_no stringth_list)
                  )
                  (SETQ SS1 (SSGET "C"
                                     aute_point1
                                     aute_point2
                                     (LIST (CONS 40 rad1)
                                           (CONS 0 "ARC")
                                           (CONS 8 CLA1)
                                           (CONS 6 LTY1)
                                           (CONS 62 COL1)
                                     )
                              )
                        SS2 (SSGET "C"
                                     aute_point1
                                     aute_point2
                                     (LIST (CONS 40 rad2)
                                           (CONS 0 "ARC")
                                           (CONS 8 CLA2)
                                           (CONS 6 LTY2)
                                           (CONS 62 COL2)
                                     )
                              )
                  )
                  (if      (and (not (null ss1)) (not (null ss2)))
                      (progn
                        (setq NO      -1
                              LEN1    (SSLENGTH SS1)
                              LEN2    (SSLENGTH SS2)
                              SSCEN2(LIST)
                              SSCEN1(LIST)
                              TEXTNUM 0
                        )
                        (REPEAT      LEN1
                        (setq      no   (1+ no)
                              nam1   (ssname ss1 no)
                              W1   (entget nam1)
                              CEN1   (cdr (assoc 10 W1))
                              SSCEN2 (CONS CEN1 SSCEN2)
                        )
                        )
                        (SETQ NO -1)
                        (REPEAT      LEN2
                        (setq      no   (1+ no)
                              nam2 (ssname ss2 no)
                              W2   (entget nam2)
                              CEN2 (cdr (assoc 10 W2))
                              NUM-1
                        )
                        (REPEAT LEN1
                            (setq NUM      (1+ NUM)
                                  CEN1      (NTH NUM SSCEN2)
                                  DIST1      (distance CEN1 CEN2)
                                  SS3      (SSGET "C"
                                             aute_point1
                                             aute_point2
                                             (LIST (cons -4 "<or")
                                                   (cons 0 "ARC")
                                                   (cons 0 "CIRCLE")
                                                   (cons -4 "or>")
                                                   (cons 10 CEN1)
                                                   (CONS -4 "/=")
                                                   (CONS 40 rad1)
                                             )
                                        )
                            )
                            (IF      (and (= DIST DIST1)
                                     (null ss3)
                                     (null (member CEN1 SSCEN1))
                              )
                              (chtext_point)
                            )
                        )
                        )
                        (setq cen_sel (append cen_sel SSCEN1))
                        (setvar "osmode" 64)
                        (SETQ PTO (polar PTO 4.712 (* 2 TXT)))
                        (cond
                        ((AND      (OR (<= 0 (distance POTS1 POTS2) 0.2)
                                    (<= 0 (distance POTS1 POTE2) 0.2)
                              )
                              (OR (<= 0 (distance POTE1 POTS2) 0.2)
                                    (<= 0 (distance POTE1 POTE2) 0.2)
                              )
                              (<= 1.5 (* 2 rad2) 3)
                           )
                           (SETQ BSW
                                  (STRCAT (RTOS (* 2 rad1) 2 2) " 导柱")
                           )
                        )
                        (T
                           (SETQ BSW (STRCAT (RTOS (* 2 rad1) 2 2)
                                             " 非标准导柱"
                                     )
                           )
                        )
                        )
                        (SETQ STR (STRCAT "%%u"
                                          stringth
                                          ": "
                                          (RTOS TEXTNUM 2 0)
                                          "-%%C"
                                          BSW
                                  )
                        )
                        (setvar "osmode" 0)
                        (COMMAND "TEXT" "TL" PTO txt "" STR "")
                      )
                  )
                  )
                )
;;;;;
                (IF (AND (= ent1 "CIRCLE")
                         (= ent2 "ARC")
                         (= ent3 NIL)
                         (= 0 DIST)
                  )
                  (PROGN
                  (SETQ SS1             (SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (LIST (CONS 40 rad1)
                                                (CONS 0 "CIRCLE")
                                                (CONS 8 CLA1)
                                                (CONS 6 LTY1)
                                                (CONS 62 COL1)
                                          )
                                     )
                        MI_text    1
                        BIG_text   rad1
                        ent2_ang50 (cdr (assoc 50 W2))
                        ent2_ang51 (cdr (assoc 51 W2))
                        ent2_po50(polar CEN2 ent2_ang50 rad2)
                        ent2_po51(polar CEN2 ent2_ang51 rad2)
                        ent2_dist(DISTOF
                                       (RTOS (distance ent2_po50 ent2_po51)
                                             2
                                             3
                                       )
                                     )
                  )
                  (setq stringth_no (1+ stringth_no)
                        stringth    (nth stringth_no stringth_list)
                  )
                  (IF      (< ent2_ang51 ent2_ang50)
                      (setq ent2_ang51 (+ (* 2 pi) ent2_ang51))
                  )
                  (setq
                      ent2_angl      (distof
                                  (rtos (- ent2_ang51 ent2_ang50) 2 3)
                              )
                  )
                  (if      (> ent2_angl (* 2 pi))
                      (setq angl_center      (- pi (/ ent2_angl 2))
                            dist_center      (+ rad2 (* rad2 (cos angl_center)))
                      )
                      (setq angl_center      (/ ent2_angl 2)
                            dist_center      (- rad2 (* rad2 (cos angl_center)))
                      )
                  )
                  (if      (not (null ss1))
                      (progn
                        (setq NO      -1
                              LEN1    (SSLENGTH SS1)
                              SSCEN1(LIST)
                              TEXTNUM 0
                        )
                        (REPEAT      LEN1
                        (setq      no          (1+ no)
                              nam1          (ssname ss1 no)
                              W1          (entget nam1)
                              CEN1          (cdr (assoc 10 W1))
                              ss3_ful          nil
                              pot_left(polar CEN1 2.4 (* 1.4 RAD1))
                              pot_right (polar CEN1 5.5 (* 1.4 RAD1))
                              SS2          (SSGET "C"
                                                 aute_point1
                                                 aute_point2
                                                 (LIST (CONS 40 rad2)
                                                       (cons 10 CEN1)
                                                       (CONS 0 "ARC")
                                                       (CONS 8 CLA2)
                                                       (CONS 6 LTY2)
                                                       (CONS 62 COL2)
                                                 )
                                          )
                              SS3          (SSGET "C"
                                                 pot_left
                                                 pot_right
                                                 (LIST (CONS -4 "<or")
                                                       (CONS 0 "CIRCLE")
                                                       (CONS 0 "ARC")
                                                       (CONS -4 "or>")
                                                       (CONS -4 "/=")
                                                       (CONS 40 RAD1)
                                                       (CONS -4 "/=")
                                                       (CONS 40 RAD2)
                                                 )
                                          )
                        )
                        (setq      ss_nam_list         (entget nam1 (list "wl_length"))
                              insert_number_long (cadadr
                                                   (assoc -3 ss_nam_list)
                                                   )
                        )
                        (if (not (null insert_number_long))
                            (setq deepth_ref
                                 (rtos (cdr insert_number_long))
                            )
                            (setq deepth_ref "*")
                        )
                        (if (not (null ss2))
                            (progn
                              (setq ss3no -1)
                              (repeat (sslength ss2)
                              (setq ss3no (1+ ss3no))
                              (setq ss3name(entget (ssname ss2 ss3no))
                                    ss3start (cdr (assoc 50 ss3name))
                                    ss3end   (cdr (assoc 51 ss3name))
                              )
                              (if (< ss3end ss3start)
                                  (setq ss3end (+ ss3end (* 2 pi)))
                              )
                              (setq ss3_angle
                                       (distof
                                       (rtos (- ss3end ss3start)
                                             2
                                             3
                                       )
                                       )
                              )
                              (if (/= ss3_angle ent2_angl)
                                  (setq ss3_ful (cons 3 ss3_ful))
                              )
                              )
                            )
                        )
                        (IF (and (not (null ss2))
                                 (null ss3)
                                 (null ss3_ful)
                                 (null (member CEN1 SSCEN1))
                                 (= (read deepth_ref) (read deepth))
                              )
                            (chtext_point)
                        )
                        )
                        (setq cen_sel (append cen_sel SSCEN1))
                        (setvar "osmode" 64)
                        (SETQ PTO (polar PTO 4.712 (* 2 TXT)))
                        (IF (or      (= "HIDDEN" LTY1)
                              (= "HIDDEN2" LTY1)
                              (= "HIDDENX2" LTY1)
                              (= "DASHED" LTY1)
                              (= "DASHED2" LTY1)
                              (= "DASHEDX2" LTY1)
                            )
                        (SETQ      STR (STRCAT "%%u"
                                          stringth
                                          ": "
                                          (RTOS TEXTNUM 2 0)
                                          "-%%C"
                                          (RTOS (* 2 rad2) 2 2)
                                          "X"
                                          (RTOS dist_center 2 2)
                                          " (%%C"
                                          (RTOS (* 2 rad1) 2 2)
                                          " 背面沉孔,深度"
                                          DEEPTH
                                          ")"
                                    )
                        )
                        (SETQ      STR (STRCAT "%%u"
                                          stringth
                                          ": "
                                          (RTOS TEXTNUM 2 0)
                                          "-%%C"
                                          (RTOS (* 2 rad2) 2 2)
                                          "X"
                                          (RTOS dist_center 2 2)
                                          " (%%C"
                                          (RTOS (* 2 rad1) 2 2)
                                          " 正面沉孔,深度"
                                          DEEPTH
                                          ")"
                                    )
                        )
                        )
                        (setvar "osmode" 0)
                        (COMMAND "TEXT" "TL" PTO TXT "" STR "")
                      )
                  )
                  )
                )
;;;;;;;***
                (IF (AND (= ent1 "CIRCLE") (= ent2 NIL) (= ent3 NIL))
                  (PROGN
                  (SETQ SS1         (SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (LIST      (CONS 40 RAD1)
                                                (CONS 0 "CIRCLE")
                                                (CONS 8 CLA1)
                                                (CONS 6 LTY1)
                                                (CONS 62 col1)
                                          )
                                 )
                        MI_textRAD1
                        BIG_text RAD1
                  )
                  (setq stringth_no (1+ stringth_no)
                        stringth    (nth stringth_no stringth_list)
                  )
                  (if      (not (null ss1))
                      (progn
                        (setq no      -1
                              LEN1    (SSLENGTH SS1)
                              SSCEN1(LIST)
                              TEXTNUM 0
                        )
                        (REPEAT      LEN1
                        (setq      no          (1+ no)
                              nam1          (ssname ss1 no)
                              W1          (entget nam1)
                              CEN1          (cdr (assoc 10 W1))
                                        ;CEN1x (DISTOF (RTOS (CAR CEN1) 2 3))
                                        ;CEN1y (DISTOF (RTOS (CADR CEN1) 2 3))
                                        ;CEN1z (DISTOF (RTOS (CADDR CEN1) 2 3))
                                        ;CEN1 (LIST CEN1x CEN1y CEN1z)
                              ss3_ful          nil
                              pot_left(polar CEN1 2.4 (* 1.4 RAD1))
                              pot_right (polar CEN1 5.5 (* 1.4 RAD1))
                              SS2          (SSGET "C"
                                                 aute_point1
                                                 aute_point2
                                                 (LIST (CONS 0 "CIRCLE")
                                                       (CONS 10 CEN1)
                                                       (CONS -4 "/=")
                                                       (CONS 40 RAD1)
                                                 )
                                          )
                              SS3          (SSGET "C"
                                                 aute_point1
                                                 aute_point2
                                                 (LIST (CONS 0 "ARC")
                                                       (CONS 10 CEN1)
                                                       (CONS -4 ">")
                                                       (CONS 40 RAD1)
                                                 )
                                          )
                              SS4          (SSGET "C"
                                                 pot_left
                                                 pot_right
                                                 (LIST (CONS 0 "ARC")
                                                       (CONS -4 "/=")
                                                       (CONS 40 RAD1)
                                                 )
                                          )
                        )
                        (setq      ss_nam_list         (entget nam1 (list "wl_length"))
                              insert_number_long (cadadr
                                                   (assoc -3 ss_nam_list)
                                                   )
                        )
                        (if (not (null insert_number_long))
                            (setq deepth_ref
                                 (rtos (cdr insert_number_long))
                            )
                            (setq deepth_ref "*")
                        )
                        (if (not (null ss3))
                            (progn
                              (setq ss3no -1)
                              (repeat (sslength ss3)
                              (setq ss3no (1+ ss3no))
                              (setq ss3name(entget (ssname ss3 ss3no))
                                    ss3start (cdr (assoc 50 ss3name))
                                    ss3end   (cdr (assoc 51 ss3name))
                              )
                              (if (< ss3end ss3start)
                                  (setq ss3end (+ ss3end (* 2 pi)))
                              )
                              (if (> 4.75 (- ss3end ss3start) 4.68)
                                  (setq ss3_ful (cons 3 ss3_ful))
                              )
                              )
                            )
                        )
                        (IF (and (null ss2)
                                 (null ss4)
                                 (null ss3_ful)
                                 (null (member CEN1 SSCEN1))
                                 (= (read deepth_ref) (read deepth))
                              )
                            (chtext_point)
                        )
                        )
                        (setq cen_sel (append cen_sel SSCEN1))
                        (setvar "osmode" 64)
                        (SETQ PTO (polar PTO 4.712 (* 2 TXT)))
                        (COND ((equal 0.00002
                                    (- (ATOF (RTOS (* 2 RAD1) 2 5))
                                       (ATOF (RTOS (* 2 RAD1) 2 3))
                                    )
                                    0.000001
                               )
                               (SETQ STR (STRCAT "%%u"
                                                 stringth
                                                 ": "
                                                 (RTOS TEXTNUM 2 0)
                                                 "-%%C"
                                                 (RTOS (* 2 RAD1) 2 0)
                                                 " 固定销"
                                       )
                               )
                              )
                              ((equal 0.00004
                                    (- (ATOF (RTOS (* 2 RAD1) 2 5))
                                       (ATOF (RTOS (* 2 RAD1) 2 3))
                                    )
                                    0.000001
                               )
                               (SETQ STR (STRCAT "%%u"
                                                 stringth
                                                 ": "
                                                 (RTOS TEXTNUM 2 0)
                                                 "-%%C"
                                                 (RTOS (* 2 RAD1) 2 0)
                                                 " 浮升销"
                                       )
                               )
                              )
                              ((equal 0.00006
                                    (- (ATOF (RTOS (* 2 RAD1) 2 5))
                                       (ATOF (RTOS (* 2 RAD1) 2 3))
                                    )
                                    0.000001
                               )
                               (SETQ STR (STRCAT "%%u"
                                                 stringth
                                                 ": "
                                                 (RTOS TEXTNUM 2 0)
                                                 "-%%C"
                                                 (RTOS (* 2 RAD1) 2 0)
                                                 " 顶料销"
                                       )
                               )
                              )
                              ((equal 0.00008
                                    (- (ATOF (RTOS (* 2 RAD1) 2 5))
                                       (ATOF (RTOS (* 2 RAD1) 2 3))
                                    )
                                    0.000001
                               )
                               (SETQ STR (STRCAT "%%u"
                                                 stringth
                                                 ": "
                                                 (RTOS TEXTNUM 2 0)
                                                 "-%%C"
                                                 (RTOS (* 2 RAD1) 2 0)
                                                 " 弹簧"
                                       )
                               )
                              )
                              ((or (= "HIDDEN" LTY1)
                                 (= "HIDDEN2" LTY1)
                                 (= "HIDDENX2" LTY1)
                                 (= "DASHED" LTY1)
                                 (= "DASHED2" LTY1)
                                 (= "DASHEDX2" LTY1)
                               )
                               (SETQ STR (STRCAT "%%u"
                                                 stringth
                                                 ": "
                                                 (RTOS TEXTNUM 2 0)
                                                 "-%%C"
                                                 (RTOS (* 2 RAD1) 2 2)
                                                 " (背面沉孔,深度"
                                                 deepth
                                                 ")"
                                       )
                               )
                              )
                              ((/= deepth "*")
                               (SETQ STR (STRCAT "%%u"
                                                 stringth
                                                 ": "
                                                 (RTOS TEXTNUM 2 0)
                                                 "-%%C"
                                                 (RTOS (* 2 RAD1) 2 2)
                                                 " (正面沉孔,深度"
                                                 deepth
                                                 ")"
                                       )
                               )
                              )
                              (T
                               (SETQ STR (STRCAT "%%u"
                                                 stringth
                                                 ": "
                                                 (RTOS TEXTNUM 2 0)
                                                 "-%%C"
                                                 (RTOS (* 2 RAD1) 2 2)
                                       )
                               )
                              )
                        )
                        (setvar "osmode" 0)
                        (COMMAND "TEXT" "TL" PTO TXT "" STR "")
                      )
                  )
                  )
                )
;;;;;;;;;$$$$$$$$$$$$$$$$$$
;;;;;;;;;$$$$$$$$$$$$$$$$$$
                (IF (AND (= ent1 "CIRCLE")
                         (= ent2 "CIRCLE")
                         (= ent3 "CIRCLE")
                         (= 0 DIST12 DIST13 DIST23)
                  )
                  (PROGN
                  (SETQ SS1         (SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (LIST      (CONS 40 rad1)
                                                (CONS 0 "CIRCLE")
                                                (CONS 8 cla1)
                                                (CONS 6 LTY1)
                                                (CONS 62 COL1)
                                          )
                                 )
                        MI_textrad3
                        BIG_text rad1
                  )
                  (setq stringth_no (1+ stringth_no)
                        stringth    (nth stringth_no stringth_list)
                  )
                  (if      (not (null ss1))
                      (progn
                        (setq no      -1
                              LEN1    (SSLENGTH SS1)
                              SSCEN1(LIST)
                              TEXTNUM 0
                        )
                        (REPEAT      LEN1
                        (setq      no   (1+ no)
                              nam1 (ssname ss1 no)
                              W1   (entget nam1)
                              CEN1 (cdr (assoc 10 W1))
                              SS2(SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (list (CONS 0 "CIRCLE")
                                                (cons 10 CEN1)
                                                (CONS 40 rad2)
                                                (CONS 8 cla2)
                                                (CONS 6 LTY2)
                                                (CONS 62 COL2)
                                          )
                                     )
                              SS3(SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (list (CONS 0 "CIRCLE")
                                                (cons 10 CEN1)
                                                (CONS 40 rad3)
                                                (CONS 8 cla3)
                                                (CONS 6 LTY3)
                                                (CONS 62 COL3)
                                          )
                                     )
                        )
                        (IF (and (not (null ss2))
                                 (not (null ss3))
                                 (null (member CEN1 SSCEN1))
                              )
                            (chtext_point)
                        )
                        )
                        (setq cen_sel (append cen_sel SSCEN1))
                        (setvar "osmode" 64)
                        (SETQ PTO (polar PTO 4.712 (* 2 TXT)))
                        (IF (or      (= "HIDDEN" LTY2)
                              (= "HIDDEN2" LTY2)
                              (= "HIDDENX2" LTY2)
                              (= "DASHED" LTY2)
                              (= "DASHED2" LTY2)
                              (= "DASHEDX2" LTY2)
                            )
                        (setq      str_ent2 (strcat " (%%C"
                                                 (RTOS (* 2 rad2) 2 2)
                                                 " 背面沉孔,深度"
                                                 DEEPTH1
                                                 ")"
                                       )
                        )
                        (setq      str_ent2 (strcat " (%%C"
                                                 (RTOS (* 2 rad2) 2 2)
                                                 " 正面沉孔,深度"
                                                 DEEPTH1
                                                 ")"
                                       )
                        )
                        )
                        (IF (or      (= "HIDDEN" LTY1)
                              (= "HIDDEN2" LTY1)
                              (= "HIDDENX2" LTY1)
                              (= "DASHED" LTY1)
                              (= "DASHED2" LTY1)
                              (= "DASHEDX2" LTY1)
                            )
                        (setq      str_ent1 (strcat " (%%C"
                                                 (RTOS (* 2 rad1) 2 2)
                                                 " 背面沉孔,深度"
                                                 DEEPTH
                                                 ")"
                                       )
                        )
                        (setq      str_ent1 (strcat " (%%C"
                                                 (RTOS (* 2 rad1) 2 2)
                                                 " 正面沉孔,深度"
                                                 DEEPTH
                                                 ")"
                                       )
                        )
                        )
                        (SETQ STR (STRCAT "%%u"
                                          stringth
                                          ": "
                                          (RTOS TEXTNUM 2 0)
                                          "-%%C"
                                          (RTOS (* 2 rad3) 2 2)
                                          str_ent2
                                          str_ent1
                                  )
                        )
                        (setvar "osmode" 0)
                        (COMMAND "TEXT" "TL" PTO TXT "" STR "")
                      )
                      ;;(not (null ss1))
                  )
                  )
                  ;;ent="circle"
                )
;;;;;;;;;
                (IF (AND (= ent1 "CIRCLE")
                         (= ent2 "ARC")
                         (= ent3 "ARC")
                         (= 0 DIST12 DIST13 DIST23)
                  )
                  (PROGN
                  (SETQ SS1             (SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (LIST (CONS 40 rad1)
                                                (CONS 0 "CIRCLE")
                                                (CONS 8 cla1)
                                                (CONS 6 LTY1)
                                                (CONS 62 COL1)
                                          )
                                     )
                        MI_text    1
                        BIG_text   rad1
                        ent2_ang50 (cdr (assoc 50 W2))
                        ent2_ang51 (cdr (assoc 51 W2))
                        ent2_po50(polar CEN2 ent2_ang50 rad2)
                        ent2_po51(polar CEN2 ent2_ang51 rad2)
                        ent2_dist(DISTOF
                                       (RTOS (distance ent2_po50 ent2_po51)
                                             2
                                             3
                                       )
                                     )
                  )
                  (setq stringth_no (1+ stringth_no)
                        stringth    (nth stringth_no stringth_list)
                  )
                  (if      (not (null ss1))
                      (progn
                        (setq no      -1
                              LEN1    (SSLENGTH SS1)
                              SSCEN1(LIST)
                              TEXTNUM 0
                        )
                        (REPEAT      LEN1
                        (setq      no      (1+ no)
                              nam1      (ssname ss1 no)
                              ss3_ful      nil
                              W1      (entget nam1)
                              CEN1      (cdr (assoc 10 W1))
                              SS2      (SSGET "C"
                                             aute_point1
                                             aute_point2
                                             (list (CONS 0 "ARC")
                                                   (cons 10 CEN1)
                                                   (CONS 40 rad2)
                                                   (CONS 8 cla2)
                                                   (CONS 6 LTY2)
                                                   (CONS 62 COL2)
                                             )
                                        )
                        )
                        (if (not (null SS2))
                            (progn
                              (setq ss3no -1)
                              (repeat (sslength SS2)
                              (setq ss3no (1+ ss3no))
                              (setq ss3name(entget (ssname SS2 ss3no))
                                    ss3start (cdr (assoc 50 ss3name))
                                    ss3end   (cdr (assoc 51 ss3name))
                                    ss3po50(polar CEN1 ss3start rad2)
                                    ss3po51(polar CEN1 ss3end rad2)
                              )
                              (if
                                  (/=
                                    (DISTOF (RTOS
                                              (distance ss3po50 ss3po51)
                                              2
                                              3
                                          )
                                    )
                                    ent2_dist
                                  )
                                 (setq ss3_ful (cons 3 ss3_ful))
                              )
                              )
                            )
                        )
                        (IF (and (not (null SS2))
                                 (null ss3_ful)
                                 (>= (sslength SS2) 2)
                                 (null (member CEN1 SSCEN1))
                              )
                            (chtext_point)
                        )
                        )
                        (setq cen_sel (append cen_sel SSCEN1))
                        (setvar "osmode" 64)
                        (SETQ PTO (polar PTO 4.712 (* 2 TXT)))
                        (IF (or      (= "HIDDEN" LTY1)
                              (= "HIDDEN2" LTY1)
                              (= "HIDDENX2" LTY1)
                              (= "DASHED" LTY1)
                              (= "DASHED2" LTY1)
                              (= "DASHEDX2" LTY1)
                            )
                        (setq      str_ent1 (strcat " (%%C"
                                                 (RTOS (* 2 rad1) 2 2)
                                                 " 背面沉孔,深度"
                                                 DEEPTH
                                                 ")"
                                       )
                        )
                        (setq      str_ent1 (strcat " (%%C"
                                                 (RTOS (* 2 rad1) 2 2)
                                                 " 正面沉孔,深度"
                                                 DEEPTH
                                                 ")"
                                       )
                        )
                        )
                        (SETQ STR (STRCAT "%%u"
                                          stringth
                                          ": "
                                          (RTOS TEXTNUM 2 0)
                                          "-%%C"
                                          (RTOS (* 2 rad2) 2 2)
                                          "X"
                                          (RTOS ent2_dist 2 2)
                                          str_ent1
                                  )
                        )
                        (setvar "osmode" 0)
                        (COMMAND "TEXT" "TL" PTO TXT "" STR "")
                      )
                      ;;(not (null ss1))
                  )
                  )
                  ;;ent="circle"
                )
;;;;;;;;;
                (IF (AND (= ent1 "CIRCLE")
                         (= ent2 "ARC")
                         (= ent3 "ARC")
                         (/= 0 DIST12)
                         (/= 0 DIST13)
                         (/= 0 DIST23)
                  )
                  (PROGN
                  (SETQ SS1             (SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (LIST (CONS 40 rad1)
                                                (CONS 0 "CIRCLE")
                                                (CONS 8 cla1)
                                                (CONS 6 LTY1)
                                                (CONS 62 COL1)
                                          )
                                     )
                        MI_text    1
                        BIG_text   rad1
                        ent2_ang50 (cdr (assoc 50 W2))
                        ent2_ang51 (cdr (assoc 51 W2))
                        ent2_po50(polar CEN2 ent2_ang50 rad2)
                        ent2_po51(polar CEN2 ent2_ang51 rad2)
                        ent2_dist(DISTOF
                                       (RTOS (distance ent2_po50 ent2_po51)
                                             2
                                             3
                                       )
                                     )
                  )
                  (setq stringth_no (1+ stringth_no)
                        stringth    (nth stringth_no stringth_list)
                  )
                  (if      (not (null ss1))
                      (progn
                        (setq no      -1
                              LEN1    (SSLENGTH SS1)
                              SSCEN1(LIST)
                              TEXTNUM 0
                        )
                        (REPEAT      LEN1
                        (setq      no          (1+ no)
                              nam1          (ssname ss1 no)
                              ss3_ful          nil
                              W1          (entget nam1)
                              CEN1          (cdr (assoc 10 W1))
                              pot_left(polar CEN1 2.4 (* 1.4 RAD1))
                              pot_right (polar CEN1 5.5 (* 1.4 RAD1))
                              SS2          (SSGET "C"
                                                 pot_left
                                                 pot_right
                                                 (list (CONS 0 "ARC")
                                                       (CONS 40 rad2)
                                                       (CONS 8 cla2)
                                                       (CONS 6 LTY2)
                                                       (CONS 62 COL2)
                                                 )
                                          )
                        )
                        (if (not (null SS2))
                            (progn
                              (setq ss3no -1)
                              (repeat (sslength SS2)
                              (setq ss3no (1+ ss3no))
                              (setq ss3name(entget (ssname SS2 ss3no))
                                    ss3cen1(cdr (assoc 10 ss3name))
                                    ss3start (cdr (assoc 50 ss3name))
                                    ss3end   (cdr (assoc 51 ss3name))
                                    ss3po50(polar ss3cen1 ss3start rad2)
                                    ss3po51(polar ss3cen1 ss3end rad2)
                              )
                              (if
                                  (or
                                    (/=
                                    (DISTOF
                                        (RTOS (distance ss3po50 ss3po51)
                                              2
                                              3
                                        )
                                    )
                                    ent2_dist
                                    )
                                    (/=      (DISTOF      (RTOS
                                                (distance ss3cen1 CEN1)
                                                2
                                                3
                                                )
                                        )
                                        DIST12
                                    )
                                  )
                                 (setq ss3_ful (cons 3 ss3_ful))
                              )
                              )
                            )
                        )
                        (IF (and (not (null SS2))
                                 (null ss3_ful)
                                 (>= (sslength SS2) 2)
                                 (null (member CEN1 SSCEN1))
                              )
                            (chtext_point)
                        )
                        )
                        (setq cen_sel (append cen_sel SSCEN1))
                        (setvar "osmode" 64)
                        (SETQ PTO (polar PTO 4.712 (* 2 TXT)))
                        (IF (or      (= "HIDDEN" LTY1)
                              (= "HIDDEN2" LTY1)
                              (= "HIDDENX2" LTY1)
                              (= "DASHED" LTY1)
                              (= "DASHED2" LTY1)
                              (= "DASHEDX2" LTY1)
                            )
                        (setq      str_ent1 (strcat " (%%C"
                                                 (RTOS (* 2 rad1) 2 2)
                                                 " 背面沉孔,深度"
                                                 DEEPTH
                                                 ")"
                                       )
                        )
                        (setq      str_ent1 (strcat " (%%C"
                                                 (RTOS (* 2 rad1) 2 2)
                                                 " 正面沉孔,深度"
                                                 DEEPTH
                                                 ")"
                                       )
                        )
                        )
                        (SETQ
                        STR (STRCAT "%%u"
                                    stringth
                                    ": "
                                    (RTOS TEXTNUM 2 0)
                                    "-"
                                    (RTOS (+ (* 2 rad2) dist23) 2 2)
                                    "X"
                                    (RTOS ent2_dist 2 2)
                                    str_ent1
                              )
                        )
                        (setvar "osmode" 0)
                        (COMMAND "TEXT" "TL" PTO TXT "" STR "")
                      )
                      ;;(not (null ss1))
                  )
                  )
                  ;;ent="circle"
                )
;;;;;;;;;
                (IF (AND (= ent1 "CIRCLE")
                         (= ent2 "ARC")
                         (= ent3 "ARC")
                         (= 0 DIST12)
                         (/= 0 DIST13)
                         (/= 0 DIST23)
                  )
                  (PROGN
                  (setq deepth "5")
                  (SETQ SS1             (SSGET "C"
                                          aute_point1
                                          aute_point2
                                          (LIST (CONS 40 rad1)
                                                (CONS 0 "CIRCLE")
                                                (CONS 8 cla1)
                                                (CONS 6 LTY1)
                                                (CONS 62 COL1)
                                          )
                                     )
                        MI_text    rad2
                        BIG_text   rad1
                        ent2_ang50 (cdr (assoc 50 W2))
                        ent2_ang51 (cdr (assoc 51 W2))
                        ent2_po50(polar CEN2 ent2_ang50 rad2)
                        ent2_po51(polar CEN2 ent2_ang51 rad2)
                        ent2_dist(DISTOF
                                       (RTOS (distance ent2_po50 ent2_po51)
                                             2
                                             3
                                       )
                                     )
                  )
                  (setq stringth_no (1+ stringth_no)
                        stringth    (nth stringth_no stringth_list)
                  )
                  (if      (not (null ss1))
                      (progn
                        (setq no      -1
                              LEN1    (SSLENGTH SS1)
                              SSCEN1(LIST)
                              TEXTNUM 0
                        )
                        (REPEAT      LEN1
                        (setq      no          (1+ no)
                              nam1          (ssname ss1 no)
                              ss3_ful          nil
                              W1          (entget nam1)
                              CEN1          (cdr (assoc 10 W1))
                              pot_left(polar CEN1 2.4 (* 1.4 RAD1))
                              pot_right (polar CEN1 5.5 (* 1.4 RAD1))
                              SS2          (SSGET "C"
                                                 aute_point1
                                                 aute_point2
                                                 (list (CONS 0 "ARC")
                                                       (CONS 10 CEN1)
                                                       (CONS 40 rad2)
                                                       (CONS 8 cla2)
                                                       (CONS 6 LTY2)
                                                       (CONS 62 COL2)
                                                 )
                                          )
                              SS3          (SSGET "C"
                                                 pot_left
                                                 pot_right
                                                 (list (CONS 0 "ARC")
                                                       (CONS 40 rad3)
                                                       (CONS 8 cla3)
                                                       (CONS 6 LTY3)
                                                       (CONS 62 COL3)
                                                 )
                                          )
                        )
                        (if (not (null SS2))
                            (progn
                              (setq ss3no -1)
                              (repeat (sslength SS2)
                              (setq ss3no (1+ ss3no))
                              (setq ss3name(entget (ssname SS2 ss3no))
                                    ss3start (cdr (assoc 50 ss3name))
                                    ss3end   (cdr (assoc 51 ss3name))
                                    ss3po50(polar CEN1 ss3start rad2)
                                    ss3po51(polar CEN1 ss3end rad2)
                              )
                              (if
                                  (/=
                                    (DISTOF (RTOS
                                              (distance ss3po50 ss3po51)
                                              2
                                              3
                                          )
                                    )
                                    ent2_dist
                                  )
                                 (setq ss3_ful (cons 3 ss3_ful))
                              )
                              )
                            )
                        )
                        (IF (and (not (null SS3))
                                 (not (null SS2))
                                 (null ss3_ful)
                                 (null (member CEN1 SSCEN1))
                              )
                            (chtext_point)
                        )
                        )
                        (setq cen_sel (append cen_sel SSCEN1))
                        (setvar "osmode" 64)
                        (SETQ PTO (polar PTO 4.712 (* 2 TXT)))
                        (IF (or      (= "HIDDEN" LTY1)
                              (= "HIDDEN2" LTY1)
                              (= "HIDDENX2" LTY1)
                              (= "DASHED" LTY1)
                              (= "DASHED2" LTY1)
                              (= "DASHEDX2" LTY1)
                            )
                        (setq      str_ent1 (strcat " (%%C"
                                                 (RTOS (* 2 rad1) 2 2)
                                                 " 背面沉孔,深度"
                                                 DEEPTH
                                                 ")"
                                       )
                        )
                        (setq      str_ent1 (strcat " (%%C"
                                                 (RTOS (* 2 rad1) 2 2)
                                                 " 正面沉孔,深度"
                                                 DEEPTH
                                                 ")"
                                       )
                        )
                        )
                        (SETQ STR (STRCAT "%%u"
                                          stringth
                                          ": "
                                          (RTOS TEXTNUM 2 0)
                                          "-%%C"
                                          (RTOS (* 2 rad2) 2 2)
                                          " 导柱"
                                          str_ent1
                                  )
                        )
                        (setvar "osmode" 0)
                        (COMMAND "TEXT" "TL" PTO TXT "" STR "")
                      )
                      ;;(not (null ss1))
                  )
                  )
                  ;;ent="circle"
                )
            )
            ;;(if (null (member cen1 cen_sel)))
            )
          )
          ;;(repeat (sslength cen_all))
      )
;;;(if (not (null SS_all)
      )
;;;;;;;***
      (SETQ ss_ins (SSGET "c"
                        aute_point1
                        aute_point2
                        (list (cons 0 "INSERT"))
                   )
      )
      (if (not (null ss_ins))
      (progn
          (setq      no      -1
                cen_all      (list)
          )
          (repeat (sslength ss_ins)
            (setq no         (1+ no)
                  cen_ss (cdr (assoc 10 (entget (ssname ss_ins no))))
            )
            (if      (null (member cen_ss cen_all))
            (setq cen_all (cons cen_ss cen_all))
            )
          )
          (setq      no_list      -1
                cen_sel      (list)
          )
          (repeat (length cen_all)
            (setq no_list   (1+ no_list)
                  cen_no_list (nth no_list cen_all)
            )
            (if      (null (member cen_no_list cen_sel))
            (progn
                (setq stringth_no (1+ stringth_no)
                      stringth          (nth stringth_no stringth_list)
                      SSCEN1          (LIST)
                      TEXTNUM          0
                      no          -1
                )
                (setq ss_no_list       (SSGET "c"
                                              aute_point1
                                              aute_point2
                                              (list (cons 0 "INSERT")
                                                    (cons 10 cen_no_list)
                                              )
                                       )
                      nam_no_list      (cdr
                                       (assoc 2 (entget (ssname ss_no_list 0)))
                                       )
                      ss_no_select   (SSGET "c"
                                              aute_point1
                                              aute_point2
                                              (list
                                                (cons 0 "INSERT")
                                                (cons 2 nam_no_list)
                                              )
                                       )
                      str_no_list      (substr nam_no_list 1 4)
                      insert_wl_length (entget (ssname ss_no_list 0)
                                             (list "wl_length")
                                       )
                      insert_3               (cadadr (assoc -3 insert_wl_length))
                )
                (if (not (null insert_3))
                  (setq      insert_3 (rtos (cdr insert_3))
                  )
                  (setq      insert_3 "*"
                  )

                )
                (cond ((= "LSPM" (strcase str_no_list))
                     (setq str_ent1 " 内六角螺丝牙孔(攻牙)"
                           str_ent2 "-M"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text MI_text
                     )
                      )
                      ((= "LSPN" (strcase str_no_list))
                     (setq str_ent1 " 塞打螺丝(MSB)"
                           str_ent2 "-M"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text MI_text
                     )
                      )
                      ((= "LSPZ" (strcase str_no_list))
                     (setq str_ent1 " 子母螺丝(MSW)"
                           str_ent2 "-M"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text MI_text
                     )
                      )
                      ((= "LSPP" (strcase str_no_list))
                     (setq str_ent1 " 导柱孔(线割,单边%%P0)"
                           str_ent2 "-%%C"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text MI_text
                     )
                      )
                      ((= "LSPF" (strcase str_no_list))
                     (setq str_ent1 " 导套孔(线割,单边%%P0,%%c背面沉深3.5)"
                           str_ent2 "-%%C"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text (+ 5 MI_text)
                     )
                      )
                      ((= "LSPD" (strcase str_no_list))
                     (setq str_ent1 " 定位销孔(线割,单边+0.00)"
                           str_ent2 "-%%C"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text MI_text
                     )
                      )
                      ((= "LSPG" (strcase str_no_list))
                     (setq str_ent1 " 浮升销孔(线割,单边+0.01)"
                           str_ent2 "-%%C"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text MI_text
                     )
                      )
                      ((= "LSPL" (strcase str_no_list))
                     (setq str_ent1 " 顶料销孔(线割,单边+0.01)"
                           str_ent2 "-%%C"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text MI_text
                     )
                      )
                      ((= "LSPS" (strcase str_no_list))
                     (setq str_ent1 " 弹簧孔(钻通)"
                           str_ent2 "-%%C"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text MI_text
                     )
                      )
                      ((= "LSPH" (strcase str_no_list))
                     (setq str_ent1 " 导正销孔(线割,单边+0.005,%%C正面沉深*)"
                           str_ent2 "-%%C"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text MI_text
                     )
                      )
                      ((= "LSPA" (strcase str_no_list))
                     (setq str_ent1 " 冲子(TA)"
                           str_ent2 "-%%C"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text (+ 1.5 MI_text)
                     )
                     (if (> (atof str_ent3) 18)
                         (setq str_ent3      (strcat      (substr nam_no_list 5 1)
                                                "."
                                                (substr nam_no_list 6)
                                        )
                               MI_text      (/ (atof str_ent3) 2)
                               BIG_text      (+ 1.5 MI_text)
                         )
                     )
                      )
                      ((= "LSPC" (strcase str_no_list))
                     (setq str_ent1 " 冲子(SH)"
                           str_ent2 "-%%C"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text (+ 1.5 MI_text)
                     )
                     (if (> (atof str_ent3) 18)
                         (setq str_ent3      (strcat      (substr nam_no_list 5 1)
                                                "."
                                                (substr nam_no_list 6)
                                        )
                               MI_text      (/ (atof str_ent3) 2)
                               BIG_text      (+ 1.5 MI_text)
                         )
                     )
                      )
                      ((= "LSPE" (strcase str_no_list))
                     (setq str_ent1 " 抽牙冲子(TE)"
                           str_ent2 "-%%C"
                           str_ent3 (substr nam_no_list 5)
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text (+ 1.5 MI_text)
                     )
                     (if (> (atof str_ent3) 18)
                         (setq str_ent3      (strcat      (substr nam_no_list 5 1)
                                                "."
                                                (substr nam_no_list 6)
                                        )
                               MI_text      (/ (atof str_ent3) 2)
                               BIG_text      (+ 1.5 MI_text)
                         )
                     )
                      )
                      ((= "LSPW" (strcase str_no_list))
                     (setq str_ent1 "的异形孔(线割,单边+0.00)"
                           str_ent2 "-穿丝孔为%%C"
                           str_ent3 (strcat (substr nam_no_list 5 1)
                                              "."
                                              (substr nam_no_list 6 1)
                                    )
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text MI_text
                     )
                      )
                      ((= "LSPR" (strcase str_no_list))
                     (setq str_ent3 (substr nam_no_list 5)
                           str_ent1 (strcat " 螺丝沉头孔(正面沉头深度*) "
                                              insert_3
                                    )
                           str_ent2 "-M"
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text (+ 2 MI_text)
                     )
                      )
                      ((= "LSPB" (strcase str_no_list))
                     (setq str_ent3 (substr nam_no_list 5)
                           str_ent1 (strcat " 螺丝沉头孔(背面沉头深度*) "
                                              insert_3
                                    )
                           str_ent2 "-M"
                           MI_text(/ (atof (substr nam_no_list 5)) 2)
                           BIG_text (+ 2 MI_text)
                     )
                      )
                      (t
                     (setq str_ent1 nam_no_list
                           str_ent2 "-"
                           str_ent3 "(线割,单边+0.00)"
                           MI_text4
                           BIG_text 6
                     )
                      )
                )
                (repeat      (sslength ss_no_select)
                  (setq      no   (1+ no)
                        cen1 (cdr
                               (assoc 10 (entget (ssname ss_no_select no)))
                           )
                  )
                  (setq      insert_wl_length (entget (ssname ss_no_select no)
                                                 (list "wl_length")
                                       )
                        insert_3add         (cadadr (assoc -3 insert_wl_length))
                  )
                  (if (not (null insert_3add))
                  (setq insert_3add
                           (rtos (cdr insert_3add))
                  )
                  (setq insert_3add
                           "*"
                  )

                  )

                  (if (and (null (member cen1 SSCEN1))
                           (= insert_3add insert_3)
                      )
                  (chtext_point)
                  )
                )
                (setq cen_sel (append cen_sel SSCEN1))
                (setvar "osmode" 64)
                (SETQ PTO (polar PTO 4.712 (* 2 TXT)))
                (SETQ STR (STRCAT "%%u"
                                  stringth
                                  ": "
                                  (RTOS TEXTNUM 2 0)
                                  str_ent2
                                  str_ent3
                                  str_ent1
                        )
                )
                (setvar "osmode" 0)
                (COMMAND "TEXT" "TL" PTO TXT "" STR "")
            )
            )
;;;;(if (null (member cen_no_list cen_sel)
;;;;;;;;
          )
;;;(repeat (length cen_all)
;;;;;;;;
      )
      )
;;;(if (not (null ss_ins)


;;;;;;;***
      (setvar "osmode" 183)
      (COMMAND "UCS" "P")
    )
    (prompt "对不起!试用期巳过,请安装正版!")
)
)

;;;;;;;;
;;;(defun chtext_point ()
;;;(setq SSCEN1 (CONS CEN1 SSCEN1))
;;;(if (> (/ (* MI_text 2) txt) 3)
;;;    (setq PTB (polar CEN1 4 (/ MI_text 2)))
;;;    (setq PTB (polar CEN1 4 (+ BIG_text (/ (* txt 3) 4))))
;;;)
;;;(SETQ      DIST3 (DISTANCE CEN1 PTB)
;;;      PTB1(polar CEN1 5.4 DIST3)
;;;      PTB2(polar CEN1 0.87 DIST3)
;;;      PTB3(polar CEN1 2.27 DIST3)
;;;)
;;;(COND      ((NULL (SSGET "C"
;;;                      (polar ptb 0.87 (/ txt 2))
;;;                      (polar ptb 4 (/ txt 2))
;;;               )
;;;         )
;;;         (SETQ PTB PTB)
;;;      )
;;;      ((NULL (SSGET "C"
;;;                      (polar ptb1 0.87 (/ txt 2))
;;;                      (polar ptb1 4 (/ txt 2))
;;;               )
;;;         )
;;;         (SETQ PTB PTB1)
;;;      )
;;;      ((NULL (SSGET "C"
;;;                      (polar ptb2 0.87 (/ txt 2))
;;;                      (polar ptb2 4 (/ txt 2))
;;;               )
;;;         )
;;;         (SETQ PTB PTB2)
;;;      )
;;;      ((NULL (SSGET "C"
;;;                      (polar ptb3 0.87 (/ txt 2))
;;;                      (polar ptb3 4 (/ txt 2))
;;;               )
;;;         )
;;;         (SETQ PTB PTB3)
;;;      )
;;;      (T (SETQ PTB PTB))
;;;)
;;;(setvar "osmode" 0)
;;;(command "TEXT" "MC" PTB TXT "" stringth "")
;;;(SETQ TEXTNUM (1+ TEXTNUM))
;;;)
;;;;;;;;;;
(defun check (number)
(set_tile "error" "")
(if (<= (distof (get_tile number)) 0)
    (progn
      (set_tile "error" "error value")
      (mode_tile number 2)
      (mode_tile number 3)
      nil
    )
    (distof (get_tile number))
)
)
;;;;;;

;;;;;;;;
(defun chtext_point (/ txt1 ptb ptb1 ptb2 ptb3 ptb11)
(setq txt1 (* 1.1 (/ TXT (getvar "DIMSCALE"))))
(setq SSCEN1 (CONS CEN1 SSCEN1))
(if (> (/ (* MI_text 2) TXT1) 3)
    (setq PTB (polar CEN1 3.92699 (/ MI_text 2)))
    (setq PTB (polar CEN1 3.92699 (+ BIG_text (/ (* TXT1 3) 4))))
)
(SETQ      DIST3 (DISTANCE CEN1 PTB)
      PTB1(polar CEN1 5.49779 DIST3)
      PTB2(polar CEN1 0.785398 DIST3)
      PTB3(polar CEN1 2.35619 DIST3)
)
(if (>= (nth 1 (CAR SSCEN1))
          (/ (+ (nth 1 aute_point1) (nth 1 aute_point2)) 2)
      )
    (progn
      (SETQ PTB11 PTB
            PTB          PTB2
            PTB2PTB11
      )
    )
    (progn
      (SETQ PTB11 PTB
            PTB          PTB1
            PTB1PTB11
      )
    )
)

(COND      ((NULL (SSGET "C"
                      (polar ptb 0.785398 (/ TXT1 2))
                      (polar ptb 3.92699 (/ TXT1 2))
               )
         )
         (SETQ PTB PTB)
      )
      ((NULL (SSGET "C"
                      (polar ptb1 0.785398 (/ TXT1 2))
                      (polar ptb1 3.92699 (/ TXT1 2))
               )
         )
         (SETQ PTB PTB1)
      )
      ((NULL (SSGET "C"
                      (polar ptb2 0.785398 (/ TXT1 2))
                      (polar ptb2 3.92699 (/ TXT1 2))
               )
         )
         (SETQ PTB PTB2)
      )
      ((NULL (SSGET "C"
                      (polar ptb3 0.785398 (/ TXT1 2))
                      (polar ptb3 3.92699 (/ TXT1 2))
               )
         )
         (SETQ PTB PTB3)
      )
      (T (SETQ PTB PTB))
)
(setvar "osmode" 0)
(if (or (= print_note_list "Y") (= print_note_list "y"))
    (command "TEXT"
             "MC"
             PTB
             TXT
             ""
             (strcat stringth (itoa (1+ TEXTNUM)))
    )
    (command "TEXT" "MC" PTB TXT "" stringth)
)
(SETQ TEXTNUM (1+ TEXTNUM))
)

♂此处空白♂ 发表于 2014-12-15 15:00:44

这个应该是冲压模外挂吧

gys2010 发表于 2014-12-15 15:10:45

♂此处空白♂ 发表于 2014-12-15 15:00 static/image/common/back.gif
这个应该是冲压模外挂吧

是啊,你能帮忙改吗

emk 发表于 2014-12-20 10:16:55

好长的代码,纯支持

jxy308 发表于 2014-12-20 16:28:10

gys2010 发表于 2014-12-21 09:25:23

请版主们,帮忙下,谢谢

冒个烟圈 发表于 2015-5-23 19:35:50

我也做冲压连续拉伸,可惜没能力修改你的程序

F4164789 发表于 2015-6-15 18:26:06

我也是冲压绘图,在富士康用的FOXPRESS,现在辞职了,现在画模完全手工画,手动拆模,手动写加工注解,手工标注,真是累啊!

F4164789 发表于 2015-6-15 18:29:54

再请教下怎么样才能使自己画的圆孔,和沉头孔带属性,不是用的增强属性图块,

前生 发表于 2015-6-16 01:06:54

太长了,看了头晕。
把这个程序反到我的邮箱,看看是否可以帮到你吧。
admin@sh-fhmj.com
页: [1] 2
查看完整版本: 如何在加工注解输出前,在代码中加入提示,输入字体高度和字体类型和颜色