明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: gduthy

[源码] 自动编号

[复制链接]
发表于 2020-6-13 23:00:38 | 显示全部楼层
; ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^  
;数字递增编号对话框版  2011年9月6日 21:00:20  by yanshengjiang
;对于打印A4图纸时候进行编号,效果还行
; ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^  
(defun c:bh()
     (vl-catch-all-apply
    '(lambda();出错处理
         (setvar "cmdecho" 0)
       (command "undo" "be")
  (bh-dcl_te_bh)
(setq qd(read qd)
       zl(read zl)
       )
(setq sxh1 (strcat (vl-princ-to-string qz) (vl-princ-to-string qd)) p1 (getpoint "\n请指定插入点: "))
  (while (/= p1 nil)
    (command "text" "m" p1 h 0 sxh1)
    (setq qd (+ qd zl)
          sxh1 (strcat  (vl-princ-to-string qz)  (vl-princ-to-string qd))
          p1 (getpoint "\n请指定下一插入点: "))
     )
       (command "undo" "e")
(vl-file-delete Dcl_File)
(unload_dialog dcl_id)
  ));出错处理
  (princ)
)

(defun bh-dcl_te_bh()
  (setq dcl_id (load_dialog (setq Dcl_File (bh-dclfottext_bh))))
  (new_dialog "text2" dcl_id)
  (set_tile "qz" "")
  (set_tile "qd" "1")
  (mode_tile "qd" 2)
  (set_tile "zl" "1")
  (set_tile "h" "10")
  (action_tile "accept" "(bh-ok_te_bh)(done_dialog 1)")
  (start_dialog)
)

(defun bh-ok_te_bh()
  (setq qz  (get_tile "qz"))
  (setq qd (get_tile "qd"))
  (setq zl (get_tile "zl"))
  (setq h (get_tile "h"))
)
;写dcl
(defun bh-dclfottext_bh()
(setq Dcl_File (vl-filename-mktemp nil nil))
  (setq lujin(vl-filename-directory Dcl_File))
  (setq Dcl_File (strcat lujin "\\递增编号.dcl"))
  (setq file (open Dcl_File "w"))
  (write-line "              text2:dialog{" file)
  (write-line "              label= \"递增编号\";" file)
  (write-line "              :edit_box{label=\"前    缀\";key=\"qz\";edit_width=10;" file)
  (write-line "              }" file)
  (write-line "              :edit_box{label=\"起始点号\";key=\"qd\";edit_width=10;" file)
  (write-line "              }" file)
  (write-line "              :edit_box{label= \"增    量\"; key= \"zl\";edit_width=10;}"  file)
  (write-line "              :edit_box{label= \"字    高\"; key=\"h\";edit_width=10;"  file)
  (write-line "              }" file)
  (write-line "                ok_cancel;" file)
  (write-line "              }" file)
   (close file)
  Dcl_File
  )
发表于 2023-4-19 10:09:52 | 显示全部楼层
来个介绍图片哈,,,,,,,,,,
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-27 10:26 , Processed in 0.164043 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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