明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2638|回复: 0

求完善!!!!!!!

[复制链接]
发表于 2012-2-20 21:45:42 | 显示全部楼层 |阅读模式
(defun c:kK()

(arxload "geomcal.arx")
  
(setq chk (tblsearch "layer" "1"))(if (= chk nil)

(command "-layer" "n" "1" ""))

(setq chk (tblsearch "layer" "00"))

(if (= chk nil)

(command "-layer" "n" "00" ""))

(command "-layer" "c" 1 "1" "")

(command "-layer" "c" 212 "00" "")

(setq ss (ssget '((0 . "LWPOLYLINE"))))

(setq xb_height (getreal "\n输入高度(mm): "))

(setq base_pt (getpoint "\n插入点: "))

(setq xb_jj (getreal "\n间距(mm) : "))

(setq dimx_pt (list (/ (- 0 xb_height) 2) 0 0))

(setq dimy_pt (list 0 (/ xb_height 10) 0))

(setq i 0)

( while (setq ssi (ssname ss i))
  
(setq i (+ i 1))
  
(setq ssi_list (entget ssi))
  
(setq  pt_list
   
(vl-remove-if-not '(lambda(num) (= (car num) 10)) ssi_list)
  
)
  
(setq pt_list (mapcar '(lambda(num) (cdr num)) pt_list))
  
(setq pt1 (car pt_list))
  
(setq pt2 (cadr pt_list))
  
(setq pt3 (caddr pt_list))
  
(setq pt4 (cadddr pt_list))
  
(setq l1 (distance pt1 pt2))
  
(setq l2 (distance pt1 pt3))
  
(setq xb_width (if (> l1 l2) l1 l2))
  
(setq xb_id (strcat "" (itoa i)))
  
(command "-layer" "s" "00" "")
  
(command "text" "j" "mc" (cal "( pt1 + pt3 ) / 2") (/ xb_height 5) "" xb_id)
  
(setq bl_pt base_pt)
  
(setq dt_pt (list xb_width xb_height 0))
  
(setq dtx_pt (list (+ xb_width xb_jj) 0 0))
  
(setq tr_pt (cal "base_pt + dt_pt"))
   
(command "-layer" "s" "00" "")
  
(command "text" "j" "mc" (cal "(bl_pt + tr_pt) / 2") (/  xb_height 5) "" xb_id)
  
(setq base_pt (cal "base_pt + dtx_pt"))
(command "-layer" "s" "1" "")
  
(command "rectangle" bl_pt tr_pt)


)
(princ)
)


求归位大师帮忙!!!
问题是,1)尺寸不准确,2)是否可以将文字固定大小。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 13:53 , Processed in 0.177413 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表