明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 5959|回复: 10

最精简的多文档管理标签[不用下载的源码]

[复制链接]
发表于 2013-5-6 05:57:34 | 显示全部楼层 |阅读模式
本帖最后由 yxp 于 2013-5-6 06:02 编辑


不需要下载代码了,lisp 和 Odcl 已经合并了,直接从下面复制即可。
;;如果设置一下CAD的启动组,让CAD启动的时候自动加载代码,效果较好。
;;AutoCAD多文档标签管理工具
(vl-load-com)
(defun mul-dwg()
(if (dcl_Form_IsActive muldwg_Form1)
     (dcl_Form_Close muldwg_Form1))
(dcl_project_import (odcl-code) nil nil)
; (dcl_project_load "muldwg.odcl")
(dcl_form_show muldwg_Form1)
(princ)
)
;;双击 listbox 时切换CAD文档
(defun c:muldwg_Form1_ListBox1_OnDblClicked (/ ss )
(setq ss (dcl_ListBox_GetItemText muldwg_Form1_ListBox1
          (dcl_ListBox_GetCurSel muldwg_Form1_ListBox1))
       ss1 (strcat "E:\\" (rtos (getvar "date") 2 9) ".sld"))
  (if (assoc ss mul-dwg-filename)
      (setq mul-dwg-filename (subst (list ss ss1) (assoc ss mul-dwg-filename) mul-dwg-filename))
      (setq mul-dwg-filename (cons (list ss ss1) mul-dwg-filename)))
;(command "mslide" ss1)  ;;这里试图生成当前CAD文件的缩略图,但是代码通不过,请教高手!!!!
(vla-Activate (cadr(assoc ss (dwgname-list))))
)
;;listbox改变时显示CAD缩略图
(defun c:muldwg_Form1_ListBox1_OnSelChanged (ItemIndexOrCount Value /)
(dcl_SlideView_Load muldwg_Form1_SlideView1 (cadr (assoc value mul-dwg-filename)))
)
;;主界面初始化
(defun c:muldwg_Form1_OnInitialize (/ ss curobj k hn)
(setq ss (mapcar '(lambda(x) (car x)) (dwgname-list))
       curObj (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq k (vl-position curObj (muldwg-getalldocs)))
(dcl_ListBox_Clear muldwg_Form1_ListBox1)      ;;清空列表框
(dcl_ListBox_AddList muldwg_Form1_ListBox1 ss)  ;;初始化列表框
(dcl_ListBox_SetCurSel muldwg_Form1_ListBox1 k)  ;;选择当前文档
(setq hn (fix (cadr (getvar "SCREENSIZE"))))
(dcl_Control_SetHeight muldwg_Form1 hn)
(dcl_Control_SetHeight muldwg_Form1_ListBox1 (- hn 100))
(dcl_Control_SetTop muldwg_Form1_SlideView1 (- hn 97))
)
;;返回文档对象表
(defun muldwg-getalldocs (/ d)
(vlax-map-collection (vla-get-Documents (vlax-get-acad-object))
(function (lambda (x) (setq d (cons x d)))))
(reverse d)
)
;;返回文件名和对象
(defun dwgname-list(/ n s1 docname)
(setq obj-list (muldwg-getalldocs) n 0)
(repeat (length obj-list)
    (setq s1 (vl-filename-base (vla-get-name (nth n obj-list)))
          docname (cons (list s1 (nth n obj-list)) docname)
          n (1+ n))
)  (reverse docname)
)
;;和窗口的宽度同步
(defun c:muldwg_Form1_OnSize (NewWidth NewHeight /)
(dcl_Control_SetWidth muldwg_Form1_ListBox1 (- NewWidth 4))
(dcl_Control_SetWidth muldwg_Form1_SlideView1 (- NewWidth 2))
)
(defun odcl-code()
'("YWt6A58KAAAeeBJzBuLD6DUxLT9quYFpNEWobDNtAhA2upbY9+qMFun8WFQm6zr9T7+s6PlqNmr7"
"arvbEaPfJYlAbWH392UpxI19hn/ydJD2Dz9DTQOy4wFy+h7Cs6KwEbCy4ueNtKMsJFffrPxtxvJ8"
"DOa/dkJ+4T2+2ESX9s5b9fL2zDa0BXZ3uq5YgygKNlH/H5rbu65bTFPxtwYZ2+G6f+dJUl03yunr"
"67RFyLeCKAeZm0EgJe1ORZgbWlnD8tKX7kdPlm1a2nO10TUED80BcIum0kmrWUixcFZxCytsL70f"
"Mp9cWDrpxPweO56XO9Q2IlyAPEKdjpBSLI7lE24oqV6s5rpvFx3m6OjvJx1WtLOqPaSLUA+uDQeo"
"70nT08vB1Jdd3Cs1KjLcMF8uY6xILanTl8D0GaoFSr6J1nG6L0WB6Yoqw2kOmhHToo4VnEm60faJ"
"RrB1k2TG77HwQOB1MPk4mZmqWTl0y6HQ4OkYPF/SRQRau9/eBLtO6bpjebsezURegBzeRNakHwK4"
"h9Pzbc64Trg1JYcHs1e1RUsJvEuwdZzpuh8McGUBrMcw2jFCo1ITKgIj7iFNBJpDfIuw4B0v4aWZ"
"ynuTynusDXZvOTHt49Fr1G3o0RSgKEgOEwDikO/egzGsABMK0QgkgeOiwumoYcnC0pEN8vzW6cbx"
"hlYP7LC1H8jxmsDOVRQQCkzKG4tym15SmRLxqs18xDPrthwiQuT9FN40juJUuy2cGbox9nXLBeaN"
"1Q+c96TDwhtjSS1awT4C+IjBPUI+wgudCJRJz6BTT+FvZFell2KXJ9KH0bJViKK4ATUK8WF2R6I8"
"lQEkxZbpV02l2x3MWL8bWKIRwubtzePogcKiEyPbmGXrZG2MF3SnKzT3x5wk21o02/U1/NF6Zojr"
"/hUOLaS2KTenOeDlzDihOC0IY1cUNCj6PNrvhiHZpG6PMxww4wW6yfaH3f8t80FcEG2hWQDOONTg"
"W4CxV9jhQcTFC2g=")
)
(mul-dwg)(princ)

本帖子中包含更多资源

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

x

评分

参与人数 1明经币 +3 收起 理由
Gu_xl + 3 赞一个!

查看全部评分

"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2013-5-6 06:04:16 | 显示全部楼层
早上好!!
 楼主| 发表于 2013-5-6 06:06:36 | 显示全部楼层
本帖最后由 yxp 于 2013-5-6 06:22 编辑

谁有 base64 的Lsp转换程序,我看 odcl 代码的转换很不错,可用来进行简单的数据加密
明经班长老大们,高手中的高手,发挥一下你们的聪明才智吧。

我只能把数据转换到这种程度,字母越多压缩率应该越高吧
35352FDDCFCAB5C6B1C0D92F2D7B76792D5151513A61515E3A63525F362D35352FDDCFCAB5C6B1C0D92F2D352FDDCFCAB5DACEC3B1D4CA2F2D353E2D2FDCFBD1CCD0F5D7G3697F697B697F697BBFDBCCC9CCBEBFF9D3D7D0F3B0C7697F697B697F697BE4F7CCE4C7D2B0C7697F697B697F697BC2E5D0F3C0B9E1E5CCE5E3D3B0C72F362D353F2D403D362D35402D3E3D362D35412D453D362D35422D7B7679362D35432D7B7679362D35442D35352F3E2F2D2FE2C0DDE1DACE2F2D2F3F3D3B3D3D2F2D2F3E453B3D3D2F2D2F3E3D3B3D3D2F2D2F403D3B3D2F2D2F413D3B3D2F2D2FD8BBDACEC7DCD8F02F3636362D35452D35352F3E2F2D2F3F3B3D3D2F2D2F3E3B423D2F2D2F3D3B423D2F2D2F3E423B3D2F2D2F3E403D2F362D352F3F2F2D2F3F3B3D3D2F2D2F3E3B423D2F2D2F3D3B423D2F2D2F3E423B3D2F2D2F3E403D2F362D352F402F2D2F3F3B3D3D2F2D2F3E3B423D2F2D2F3D3B423D2F2D2F3E423B3D2F2D2F3E403D2F362D352F412F2D2F3F3B3D3D2F2D2F3E3B423D2F2D2F3D3B423D2F2D2F3E423B3D2F2D2F3E403D2F362D352F422F2D2F3F3B3D3D2F2D2F3E3B423D2F2D2F3D3B423D2F2D2F3E423B3D2F2D2F3E403D2F362D352F432F2D2F3F3B3D3D2F2D2F3E3B423D2F2D2F3D3B423D2F2D2F3E423B3D2F2D2F3E403D2F3636362D35462D353E3B3D2D3E2D2F3D3B42
发表于 2013-5-6 11:51:21 | 显示全部楼层
将窗体的Event Invoke的属性设置为1 !
发表于 2013-5-6 12:35:07 | 显示全部楼层
可惜我不用odcl
发表于 2013-5-6 12:40:13 | 显示全部楼层
这个怎么个用法这个~
 楼主| 发表于 2013-5-6 19:27:08 | 显示全部楼层
本帖最后由 yxp 于 2013-5-6 19:30 编辑
Gu_xl 发表于 2013-5-6 11:51
将窗体的Event Invoke的属性设置为1 !

感谢!
event invoke 设置为1仍然出现以下错误,估计还是异步处理的问题
错误: invalid AutoCAD command: nil

想加入一个文档反应器,在文档更名、窗口切换的时候刷新一下 list_box 窗口,
奈何看了半天反应器函数没搞出来

这里有lsp和odcl代码分开的包:

本帖子中包含更多资源

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

x
发表于 2013-5-6 21:37:48 | 显示全部楼层
yxp 发表于 2013-5-6 19:27
感谢!
event invoke 设置为1仍然出现以下错误,估计还是异步处理的问题
错误: invalid AutoCAD comman ...

一般来说,Event Invoke设为0,用dcl_sendstring替代command,就不会出错了!
发表于 2013-5-6 23:42:11 | 显示全部楼层
错误: no function definition: DCL_LISTBOX_GETCURSEL
 楼主| 发表于 2013-5-7 19:02:59 | 显示全部楼层
sicky111 发表于 2013-5-6 23:42
错误: no function definition: DCL_LISTBOX_GETCURSEL

DCL_LISTBOX_GETCURSEL 是Odcl的内部函数,你连 OpenDCL.**.arx 都没有?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-23 18:46 , Processed in 0.189044 second(s), 32 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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