明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1198|回复: 4

[求助]哪位老大有文字拟合的lisp程序啊

[复制链接]
发表于 2007-11-10 15:45:00 | 显示全部楼层 |阅读模式

哪位老大有文字拟合的lisp程序啊?就是可以随意改变文字宽度的,原来的AutoCAD14汉化包里有这个附加功能,可现在的高版本CAD没有这样的补丁了,最好有源码。

小弟急等用。

发表于 2007-11-10 20:50:00 | 显示全部楼层
本帖最后由 作者 于 2007-11-10 20:52:12 编辑

游客,本帖隐藏的内容需要发帖数高于 7 才可浏览,你当前发帖数只有 0

 楼主| 发表于 2007-11-10 21:34:00 | 显示全部楼层

非常感谢版主的帮助,但实在不好意思,我要的不是这个。请版主帮忙看看下边这段程序,这个就是我所说的功能,一般情况下是可以运行的,但有的时候提示错误 错误类型 "type_0" ,不知道什么原因,这是原R14汉化软件里的一段程序。

(Defun c:textfit (/    setsnapang      arg      LL-xyz   UR-x
    LL-y    LR-xy    ename    TextEnt  NewEnd   TMP
    START    NewPt    Val      LTC_%
   )
 (progn
 (defun setsnapang (arg /)
    (setvar "snapang" (angtof (angtos (cdr (assoc 50 arg)) 0 8) 0 ))
  );end defun setsnapang
  (Defun LL-xyz (arg)                             ;Lower Left xyz coord
     (CAR (TextBox arg))
  )
  (Defun UR-x (arg)                               ;Upper Right x coord
     (CAADR (TextBox arg))
  )
  (Defun LL-y (arg)                               ;Lower left y coord
     (CADAR (TextBox arg))
  )
  (Defun LR-xy (arg)                              ;Lower right xy coord
     (List (UR-x arg) (LL-y arg))
  )
  (Setq
      ename   (CAR
       (EntSel
  "\n选择文字 伸展/收缩:"
       )
     )

    Textent (If ename
       (EntGet ename)
     )
  )

  (If (= (CDR (Assoc 0 textent)) "TEXT")
    (Progn
      (initget 0 "Start")
      (Setq
 NewEnd (Distance
   (LR-xy Textent)
   (LL-xyz Textent)
        )
      )
      (setsnapang Textent)  ;set snap along text entity
      (setvar "ORTHOMODE" 1)  ;drag along the text
      (setq
 TMP (getpoint (cdr (assoc 10 Textent))
        "\n起始点/<选择新结束点>: "
     )
      )
      ;(setvar "snapang" 0)
      (cond
 ((= (type TMP) 'STR)
  ;;new starting point to be selected
  (setq Start (getpoint "\n选择新起始点: "))
  (if Start
    (progn
      (command "_UCS" "_E" (cdr (assoc -1 textent)))
      (setvar "ORTHOMODE" 1)
      (setq NewPt
      (if Start
        (getpoint (trans Start 0 1) "结束点: ")
        nil
      )
      )
      (if NewPt
        (setq NewPt (trans NewPt 1 0))
      )
      (setvar "ORTHOMODE" 0)
      (command "_UCS" "_W")
    )
  )
 )
 ((not (null TMP))
  ;;new ending point selected

  (setq Start (cdr (assoc 10 Textent))
        NewPt TMP
  )
 )
 (t
  (setq Start nil
        NewPt nil
  )
 )
      )
      (if (and Start NewPt)
 (progn
   (setq Val (Assoc 41 Textent)
  ;;current width factor
  Val (if Val
     (cdr Val)
     1.0
   )

  LTC_%
   (*
     (/
       (Distance Start NewPt)
       NewEnd
     )
     Val
   )
  textent (Subst (cons 41 LTC_%)
          (assoc 41 textent)
          textent
   )
  textent (subst (cons 10 Start)
          (assoc 10 textent)
          textent
   )
  textent (subst (cons 11 NewPt)
          (assoc 11 textent)
          textent
   )
   )
   (EntMod textent)
   (EntUpd (cdr (assoc -1 textent)))
 )
      )
      ;;end of points check
    )))) ;end defun

 楼主| 发表于 2007-11-11 20:01:00 | 显示全部楼层

请高手帮我看看上边的程序啊,错误在哪里啊??

发表于 2007-11-12 09:21:00 | 显示全部楼层
在2004中未见错误。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-6-20 04:05 , Processed in 0.146047 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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