Opendcl 控件入门练习 [源码]
刚刚入手学习opendcl请各位大虾指点
;;加载lsp时自动加载OpenDCL.xx.arx链接库arx函数
(or dcl_getversionex (progn
(defun Load:Runtime ( / acadversion arxname dclarxfile)
(defun *error* (msg) (princ (strcat "\n 加载失败,找不到" arxname "文件,请确认该文件是否在搜索路径")))
(setq acadversion (substr (getvar "acadver") 1 2))
(setq arxname (strcat "OpenDCL." acadversion ".arx"))
(setq dclarxfile (findfile arxname))
(if (and (= (member arxname (arx) ) nil) (/= dclarxfile nil))
(arxload dclarxfile) (exit))
) (Load:Runtime))
)
;;主程序
(defun c:sld()
(dcl_Project_Load "sld.odcl")
(dcl_Form_Show sld_form1)
(dcl_Project_Unload "sld")
)
;;读入dwg图形BlockView
(defun c:sld_Form1_TextButton2_Clicked (/ ss)
(setq ss (GetFiled "打开文件" "" "dwg" 4))
(and ss (dcl_BlockView_LoadDwg sld_Form1_BlockView1 ss)
(dcl_Control_SetFocus sld_form1_BlockView1)
(dcl_Control_SetCaption sld_Form1_Label6 ss))
)
;;画线PictureBox
(defun c:sld_Form1_TextButton1_OnClicked (/)
(setq a1 (list (atoi (dcl_Control_GetText sld_Form1_TextBox1))
(atoi (dcl_Control_GetText sld_Form1_TextBox2))
(atoi (dcl_Control_GetText sld_Form1_TextBox6))
(atoi (dcl_Control_GetText sld_Form1_TextBox7))
(atoi (dcl_Control_GetText sld_Form1_TextBox5))
))
(dcl_PictureBox_DrawLine sld_Form1_PictureBox1 (list a1))
)
;;显示幻灯片
(defun c:sld_Form1_TextButton3_OnClicked (/)
(setq ss (GetFiled "打开文件" "" "sld" 4))
(if ss (dcl_SlideView_Load sld_Form1_SlideView1 ss)
(dcl_MessageBox "提示\r\r\n未读入幻灯片" "提示" 2 3))
)
;;填充SlideView
(defun c:sld_Form1_TextButton4_OnClicked (/)
(setq a1 (list (atoi (dcl_Control_GetText sld_Form1_TextBox1))
(atoi (dcl_Control_GetText sld_Form1_TextBox2))
(atoi (dcl_Control_GetText sld_Form1_TextBox3))
(atoi (dcl_Control_GetText sld_Form1_TextBox4))
(atoi (dcl_Control_GetText sld_Form1_TextBox5))
))
(dcl_SlideView_FillImage sld_form1_SlideView1 (list a1))
)
;;清除控件
(defun c:sld_Form1_TextButton5_OnClicked (/)
(dcl_SlideView_Clear sld_Form1_SlideView1)
(dcl_BlockView_Clear sld_Form1_BlockView1)
(dcl_PictureBox_Clear sld_Form1_PictureBox1)
)
以上基于CAD2004调试,相关arx支持文件下载地址
http://bbs.mjtd.com/thread-100560-1-1.html 经试用,效果不错,向你学习 请把64位系统的CAD考虑进去 不错,下载来学习 想不顶你都难!就凭你无私的人格! 本帖最后由 894560869 于 2018-7-7 04:38 编辑
仰慕,感谢分享 谢谢楼主的分享 楼主,你的这个代码好像没有考虑64位系统,格式为OPENDCL.X64.CAD版本。arx,会出现64位系统加载失败。找不到" arxname "文件
;;加载lsp时自动加载OpenDCL.xx.arx链接库arx函数
(or dcl_getversionex (progn
(defun Load:Runtime ( / acadversion arxname dclarxfile)
(defun *error* (msg) (princ (strcat "\n 加载失败,找不到" arxname "文件,请确认该文件是否在搜索路径")))
(setq acadversion (substr (getvar "acadver") 1 2))
(setq arxname (strcat "OpenDCL." acadversion ".arx"))
(setq dclarxfile (findfile arxname))
(if (and (= (member arxname (arx) ) nil) (/= dclarxfile nil))
(arxload dclarxfile) (exit))
) (Load:Runtime))
) 谢谢版主分享
页:
[1]