明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1864|回复: 1

[源码] 【文字offset】可用于写说明,自己几年前刚学lisp时编的

[复制链接]
发表于 2013-8-29 14:21:17 | 显示全部楼层 |阅读模式
;;;;;;;;;Offset Text;;;;;;;;;
(defun inivar()
(setq old_os (getvar "osmode"))
(setvar "osmode" 0)
(princ)
)
(defun resvar()
(setvar "osmode" old_os)
(princ)
)
;;;;;;;;;
(defun c:ot(/ ot_dis1 ss s0 s0data p0 ang0 p1 p2 ang1 kk i j)
(if (/= ot_dis nil)
(progn
  (setq ot_dis1 (getreal (strcat "\n请输入偏移尺寸<" (rtos ot_dis) ">:")) )
  (if (null ot_dis1) (setq ot_dis ot_dis) (setq ot_dis ot_dis1)  )
);;;end progn
  (setq ot_dis (getreal"\n请输入偏移尺寸:") )
);;;end if
  (setq ss (entsel"\n选择需偏移的文字:"))
  (setq s0 (car ss))
  (redraw s0 3)
  (setq s0data (entget s0))
  (setq p0 (cdr (assoc 10 s0data)) )
  (setq ang0(cdr (assoc 50 s0data)) )
(setq i 0 j 0)
(while i
  (setq p2 (getpoint"\n请输入偏移方向:"))
  (redraw s0 4)
  (setq ang1 (- (angle p0 p2) ang0))
  (setq kk (sin ang1))
  (inivar)
(cond
((> kk 0)
  (progn
  (setq p1 (polar p0 (+ (/ PI 2) ang0) (* (+ 1 i) ot_dis) ) )
  (command "copy" s0 "" p0 p1)
  (setq i (+ 1 i))
  (resvar)
  );;;end progn1
)
((< kk 0)
  (progn
  (setq p1 (polar p0 (+ (/ PI 2) ang0) (* (+ 1 j) ot_dis) ) )
  (command "copy" s0 "" p1 p0)
  (setq j (+ 1 j))
  (resvar)
  );;;end progn2
)
(t (progn(resvar)(exit)))
);;;end cond
);;;end while
  (setvar "cmdecho" 0)
  (princ)
)
发表于 2014-9-22 23:29:52 来自手机 | 显示全部楼层
What??????c7g3
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-24 04:00 , Processed in 0.170341 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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