找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 740|回复: 0

[教学]:API应用示例二。

[复制链接]

已领礼包: 593个

财富等级: 财运亨通

发表于 2002-3-18 03:03:59 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×

                               
登录/注册后可看大图


  1. ;|
  2. xdrx_dragssmove、xdrx_dragssrotate示例|;
  3. (defun c:pot (/ zz tf p0 s s1 p an hi)
  4.   ;;标注到指定图层
  5.   (xdrx_begin "dlsx" "6")
  6.   (xdrx_ucson)
  7.   ;;tf控制循环
  8.   (setq tf T)
  9.   (initget 128)
  10.   ;;取当前字体
  11.   (setq zz (getvar "textstyle"))
  12.   ;;判断是否有"ro"字体,有则设置,没有则新建
  13.   (if (null (tblsearch "style" "RO"));;搜寻style字典定义
  14.     (command "style" "RO" "romans" "" "0.75" "" "" "" "")
  15.     (setvar "textstyle" "ro")
  16.   )
  17.   (while tf
  18.     ;;构造选择集 s 为实心三角,s1 为数字
  19.     (setq s  (ssadd)
  20.           s1 (ssadd)
  21.     )
  22.     ;;dimzin控制数字位数
  23.     (setvar "dimzin" 0)
  24.     (setq p0 (getpoint "\n标注点<回车退出>: "))
  25.     (if        (= (type p0) 'LIST)
  26.       (progn
  27.         ;;#hight为全局变量,即标高值
  28.         (setq hi (getreal (strcat "\n标  高:<"
  29.                                   (if (boundp '#hight)
  30.                                     (rtos #hight 2 2)
  31.                                     (setq #hight 0.00)
  32.                                   )
  33.                                   ">: "
  34.                           )
  35.                  )
  36.         )
  37.         ;;更新#hight
  38.         (if (OR (= HI NIL) (= hi ""))
  39.           (setq hi #hight)
  40.           (setq #hight hi)
  41.         )
  42.         ;;绘制三角并构造选择集s
  43.         (command ".pline"
  44.                  p0
  45.                  "w"
  46.                  "0"
  47.                  (* 3.5 BL)
  48.                  (polar p0 (* 0.5 pi) (* 2.5 bl))
  49.                  ""
  50.         )
  51.         (setq s (ssadd (entlast) s))
  52.         ;;写标高并构造选择集s1
  53.         (command ".text"
  54.                  (polar p0 (* 0.5 pi) (* 4 bl))
  55.                  (* 2.5 bl)
  56.                  0
  57.                  (rtos hi 2 2)
  58.         )
  59.         (setq s1 (ssadd (entlast) s1))
  60.         ;;xdrx_dragssrotate、xdrx_dragssmove示例
  61.         (if
  62.           (setq
  63.             an (xdrx_dragssrotate
  64.                  "\n如需旋转角度, 请点取要旋转的角度 <不调整>: "
  65.                  s
  66.                  p0
  67.                )
  68.           )
  69.            (command ".rotate" s "" p0 an)
  70.         )
  71.         (if
  72.           (setq
  73.             p (xdrx_dragssmove
  74.                 "\n如需调整位置, 请点取要移到的位置 <不调整>: "
  75.                 s1
  76.                 (polar p0 (* 0.5 pi) 4)        ;(* 4 bl))
  77.               )
  78.           )
  79.            (command ".move"
  80.                     s1
  81.                     ""
  82.                     (polar p0 (* 0.5 pi) 3 ;|(* 3 bl)|;)
  83.                     p
  84.            )
  85.         )
  86.         (setq s         nil
  87.               s1 nil
  88.         )
  89.       )
  90.       (setq tf nil)
  91.     )
  92.   )
  93.   ;;恢复字体
  94.   (setvar "textstyle" zz)
  95.   (xdrx_ucsoff)
  96.   (xdrx_end)
  97.   (princ)
  98. )
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-6-8 18:42 , Processed in 0.310762 second(s), 32 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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