CAD LISP语言求助,以下程序只能识别前缀为1个汉字,大神能帮忙改成可识别2个汉字的?后续2
(if(=re_call1)(selecttxt_gzl)));;;选出"HYA"、"GYT"、"GYF"文字数(defunselecttxt_dlcs()(setqtx...
(if (= re_call 1) (selecttxt_gzl))
)
;;;选出"HYA"、"GYT"、"GYF"文字数
(defun selecttxt_dlcs()
(setq txt_l (strlen txt0))
(if (> txt_l 3)
(if (or (= (substr txt0 1 3) "HYA") (= (substr txt0 1 3) "GYT") (= (substr txt0 1 3) "GYF"))
(ssadd temp nsset2))
)
)
;;;工作量与电缆程式对号
(defun gzl_duihao()
(setq duihao_ls1 nil)
(setq duihao_ls2 nil)
(setq nsset1_len (sslength nsset1))
(while (> nsset1_len 0)
(setq duihao_yes 0)
(setq nsset1_temp (ssname nsset1 (setq nsset1_len (1- nsset1_len))))
(setq nsset1_rd (cdr (assoc 50 (entget nsset1_temp))))
(setq nsset1_pt (cdr (assoc 10 (entget nsset1_temp))))
(setq nsset1_pt (list (car nsset1_pt) (cadr nsset1_pt)))
(setq nsset2_len (sslength nsset2))
(while (> nsset2_len 0)
(setq nsset2_temp (ssname nsset2 (setq nsset2_len (1- nsset2_len))))
(setq nsset2_rd (cdr (assoc 50 (entget nsset2_temp))))
(if (or (< (abs (- nsset1_rd nsset2_rd)) 0.1) (> (abs (- nsset1_rd nsset2_rd)) 6.2))
(progn
(setq nsset2_pt (cdr (assoc 10 (entget nsset2_temp))))
(setq nsset2_pt (list (car nsset2_pt) (cadr nsset2_pt)))
(setq dis_n1n2 (distance nsset1_pt nsset2_pt))
(if (< dis_n1n2 12) ;指定插入点间距范围
(progn
(setq n1n2_rd (- (angle nsset2_pt nsset1_pt) nsset1_rd))
(setq dis_yn1n2 (abs (* dis_n1n2 (sin n1n2_rd))))
(if (and (< dis_yn1n2 5) (>= n1n2_rd 0) (<= n1n2_rd Pi))
(progn
(setq duihao_yes 1)
(setq nsset2_temp1 nsset2_temp))
(if (and (< dis_yn1n2 5) (= duihao_yes 0))
(progn
(setq duihao_yes 1)
(setq nsset2_temp1 nsset2_temp))
))
))
)
)
)
(if (= duihao_yes 0)
(progn
(setq duihao_lstemp nil)
(setq duihao_lstemp (cdr (assoc 1 (entget nsset1_temp))))
(setq duihao_ls2 (cons duihao_lstemp duihao_ls2))
))
(if (= duihao_yes 1)
(progn
(setq duihao_lstemp nil)
(setq duihao_lstemp (cons (cdr (assoc 1 (entget nsset2_temp1))) (cdr (assoc 1 (entget nsset1_temp)))))
(setq duihao_ls1 (cons duihao_lstemp duihao_ls1))
(ssdel nsset2_temp1 nsset2)
))
)
)
;归类 展开
)
;;;选出"HYA"、"GYT"、"GYF"文字数
(defun selecttxt_dlcs()
(setq txt_l (strlen txt0))
(if (> txt_l 3)
(if (or (= (substr txt0 1 3) "HYA") (= (substr txt0 1 3) "GYT") (= (substr txt0 1 3) "GYF"))
(ssadd temp nsset2))
)
)
;;;工作量与电缆程式对号
(defun gzl_duihao()
(setq duihao_ls1 nil)
(setq duihao_ls2 nil)
(setq nsset1_len (sslength nsset1))
(while (> nsset1_len 0)
(setq duihao_yes 0)
(setq nsset1_temp (ssname nsset1 (setq nsset1_len (1- nsset1_len))))
(setq nsset1_rd (cdr (assoc 50 (entget nsset1_temp))))
(setq nsset1_pt (cdr (assoc 10 (entget nsset1_temp))))
(setq nsset1_pt (list (car nsset1_pt) (cadr nsset1_pt)))
(setq nsset2_len (sslength nsset2))
(while (> nsset2_len 0)
(setq nsset2_temp (ssname nsset2 (setq nsset2_len (1- nsset2_len))))
(setq nsset2_rd (cdr (assoc 50 (entget nsset2_temp))))
(if (or (< (abs (- nsset1_rd nsset2_rd)) 0.1) (> (abs (- nsset1_rd nsset2_rd)) 6.2))
(progn
(setq nsset2_pt (cdr (assoc 10 (entget nsset2_temp))))
(setq nsset2_pt (list (car nsset2_pt) (cadr nsset2_pt)))
(setq dis_n1n2 (distance nsset1_pt nsset2_pt))
(if (< dis_n1n2 12) ;指定插入点间距范围
(progn
(setq n1n2_rd (- (angle nsset2_pt nsset1_pt) nsset1_rd))
(setq dis_yn1n2 (abs (* dis_n1n2 (sin n1n2_rd))))
(if (and (< dis_yn1n2 5) (>= n1n2_rd 0) (<= n1n2_rd Pi))
(progn
(setq duihao_yes 1)
(setq nsset2_temp1 nsset2_temp))
(if (and (< dis_yn1n2 5) (= duihao_yes 0))
(progn
(setq duihao_yes 1)
(setq nsset2_temp1 nsset2_temp))
))
))
)
)
)
(if (= duihao_yes 0)
(progn
(setq duihao_lstemp nil)
(setq duihao_lstemp (cdr (assoc 1 (entget nsset1_temp))))
(setq duihao_ls2 (cons duihao_lstemp duihao_ls2))
))
(if (= duihao_yes 1)
(progn
(setq duihao_lstemp nil)
(setq duihao_lstemp (cons (cdr (assoc 1 (entget nsset2_temp1))) (cdr (assoc 1 (entget nsset1_temp)))))
(setq duihao_ls1 (cons duihao_lstemp duihao_ls1))
(ssdel nsset2_temp1 nsset2)
))
)
)
;归类 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询