| 
本帖最后由 zhangq_cai1 于 2013-9-11 09:58 编辑
×
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
    
 终于传上去了 (defun c:TextChange  ()
  (DEFUN *error*  (msg)
    (WHILE (< 0 (GETVAR "cmdactive")) (COMMAND))
    ;; do error stuff
    (IF  (DCL_FORM_ISACTIVE TextChange_Form1)
      (DCL_FORM_CLOSE TextChange_Form1)
      )
    (PRINC
      (STRCAT "\nApplication Error: "
        (ITOA (GETVAR "errno"))
        " :- "
        msg)
      )
    (PRINC)
    )
  (SETQ cmdecho (GETVAR "CMDECHO"))
  (SETVAR "CMDECHO" 0)
  (COMMAND "_OPENDCL")
  (SETVAR "CMDECHO" cmdecho)
  (DCL_PROJECT_LOAD "E:\\MYTOOLS\\lisp程序\\TextChange.odcl")
  (dcl_Form_Show TextChange_Form1)
  (princ)
  )
;;;原先odcl里文字调整改为TextChange后未替换出现不能初始化。
(defun c:TextChange_Form1_OnInitialize  (/)
  (setq dwgobj (vla-get-ActiveDocument (vlax-get-acad-object)))
  (setq mspace (vla-get-ModelSpace dwgobj))
  (setq stylesobj (vla-get-textstyles dwgobj))
  (setq stylist nil)
  (vlax-for sobj  stylesobj
    (setq styname (vla-get-name sobj))
    (setq stylist (cons styname stylist))
    )
  (setq stylist (acad_strlsort stylist))
  (dcl_ComboBox_Clear TextChange_Form1_ComboBox1)
  (dcl_ComboBox_AddList TextChange_Form1_ComboBox1 stylist)
  )
;;;(defun c:TextChange_Form1_ComboBox1_OnSelChanged (ItemIndexOrCount Value /)
;;;  (setq  TextStyle  Value)
;;;)
(defun c:TextChange_Form1_TextButton1_OnClicked (/)
  (if (= (dcl_Control_GetValue TextChange_Form1_CheckBox2) 1)
      (setq TextHeight (atoi(dcl_Control_GetText TextChange_Form1_TextBox1)))
   )
  (if (= (dcl_Control_GetValue TextChange_Form1_CheckBox3) 1)
      (setq TextWidthFactor (atof(dcl_Control_GetText TextChange_Form1_TextBox2)))
   )
  (if (= (dcl_Control_GetValue TextChange_Form1_CheckBox4) 1)
      (setq TextRotation (atof(dcl_Control_GetText TextChange_Form1_TextBox3)))
   )
  (if (= (dcl_Control_GetValue TextChange_Form1_CheckBox1) 1)
      (setq TextStyle (dcl_Control_GetText TextChange_Form1_ComboBox1))
  )
   (dcl_Form_Close TextChange_Form1 3)  
   (XD::Begin)
  (if (setq ss (ssget '((0 . "TEXT"))))
    (progn (xdrx_setsstodb ss 0)
     (while (setq e (xdrx_getentdata 0))
                 (if TextStyle (xdrx_text_setstyle e TextStyle))
           (if TextHeight (xdrx_text_SetHeight e TextHeight))
           (if TextWidthFactor (xdrx_text_SetWidthFactor e TextWidthFactor))
           (if TextRotation (xdrx_text_SetRotation e TextRotation))
     )
    )
  )
  (XD::End)
  (princ)
    )
 |