alwtyp 发表于 2011-7-2 14:19:45

使用OPENDCL的大侠,请帮忙看下程序

初学OPENDCL,照着例子做了一个程序,目前是想把相关信息写入词典,好供其它程序调用。可是怎么也执行不了。各们前辈,请帮忙看一下附件的程序问题出在哪里?

wwwliuyu 发表于 2011-7-2 23:45:15

又是一个搞冲模的,忙你改了下,看下是不是你想要的。
(Defun C:Pri(/ )
(Setvar "Cmdecho" 0)
(Command "Opendcl")
(Setvar "Cmdecho" 1)

(Dcl_Project_Load "Pri.Odcl");加载对话框程序
(Dcl_Form_Show Pri_Pressinfo);显示对话框界面

(Princ)
)


(Defun C:Pri_Pressinfo_Oninitialize (/)
(If (= (Vlax-Ldata-Get "Die-Info" "Bz-Mohao") Nil)
                         (Dcl_Control_Settext Pri_Pressinfo_Mjbh (Vl-Filename-Base (Getvar "Dwgname")))
                           (Dcl_Control_Settext Pri_Pressinfo_Mjbh (Vlax-Ldata-Get "Die-Info" "Bz-Mohao"))
                       
                     )
(If (= (Vlax-Ldata-Get "Die-Info" "Clhd") Nil)
                         (Dcl_Control_Settext Pri_Pressinfo_Clhd "0.20")
                           (Dcl_Control_Settext Pri_Pressinfo_Clhd (Vlax-Ldata-Get "Die-Info" "Clkd")))

;(c:pri_PressInfo_OK_OnClicked)
)
(defun c:pri_PressInfo_OK_OnClicked (/)
(Setq Clhd (Dcl_Control_Gettext Pri_Pressinfo_Clhd))
(Setq Mjbh (Dcl_Control_Gettext Pri_Pressinfo_Mjbh))
(Setq Clkd (Dcl_Control_Gettext Pri_Pressinfo_Clkd))
(Setq Mjbj (Dcl_Control_Gettext Pri_Pressinfo_Mjbj))
(Setq Dkjx (Dcl_Control_Gettext Pri_Pressinfo_Dkjx))
(Setq Tljx (Dcl_Control_Gettext Pri_Pressinfo_Tljx))
(C:Pri_Pressinfo_Cencel_Onclicked)
(vlax-ldata-put "Die-Info" "Bz-Mohao" Mjbh)
(vlax-ldata-put "Die-Info" "Clhd" Clhd)
(vlax-ldata-put "Die-Info" "Clkd" Clkd)
(vlax-ldata-put "Die-Info" "Mjbj" Mjbj)
(vlax-ldata-put "Die-Info" "Dkjx" Dkjx)
(vlax-ldata-put "Die-Info" "Tljx" Tljx)
(dcl_Form_Close pri_PressInfo)
)

(Defun C:Pri_Pressinfo_Cencel_Onclicked (/)
(Dcl_Form_Close Pri_Pressinfo);关闭对话框界面
)

zhynt 发表于 2011-7-2 23:49:52


(Defun C:Pri (/)
(Setvar "Cmdecho" 0)
(Command "Opendcl")
(Setvar "Cmdecho" 1)

(Dcl_Project_Load "Pri.Odcl")                ;加载对话框程序
(Dcl_Form_Show Pri_Pressinfo)                ;显示对话框界面

(Princ)
)


(Defun C:Pri_Pressinfo_Oninitialize (/)
(If (= (Vlax-Ldata-Get "Die-Info" "Bz-Mohao") Nil)
    (Dcl_Control_Settext
      Pri_Pressinfo_Mjbh
      (Vl-Filename-Base (Getvar "Dwgname"))
    )
    (Dcl_Control_Settext
      Pri_Pressinfo_Mjbh
      (Vlax-Ldata-Get "Die-Info" "Bz-Mohao")
    )
)
(If (= (Vlax-Ldata-Get "Die-Info" "Clhd") Nil)
    (Dcl_Control_Settext Pri_Pressinfo_Clhd "0.20")
    (Dcl_Control_Settext
      Pri_Pressinfo_Clhd
      (Vlax-Ldata-Get "Die-Info" "Clkd")
    )
)
)

(defun c:pri_PressInfo_OK_OnClicked (/)
(C:Pri_Pressinfo_Cencel_Onclicked)
(vlax-ldata-put
    "Die-Info"
    "Bz-Mohao"
    (Dcl_Control_Gettext Pri_Pressinfo_Mjbh)
)
(vlax-ldata-put
    "Die-Info"
    "Clhd"
    (Dcl_Control_Gettext Pri_Pressinfo_Clhd)
)
(vlax-ldata-put
    "Die-Info"
    "Clkd"
    (Dcl_Control_Gettext Pri_Pressinfo_Clkd)
)
(vlax-ldata-put
    "Die-Info"
    "Mjbj"
    (Dcl_Control_Gettext Pri_Pressinfo_Mjbj)
)
(vlax-ldata-put
    "Die-Info"
    "Dkjx"
    (Dcl_Control_Gettext Pri_Pressinfo_Dkjx)
)
(vlax-ldata-put
    "Die-Info"
    "Tljx"
    (Dcl_Control_Gettext Pri_Pressinfo_Tljx)
)
(dcl_Form_Close pri_PressInfo)
)

(Defun C:Pri_Pressinfo_Cencel_Onclicked        (/)
(Dcl_Form_Close Pri_Pressinfo)        ;关闭对话框界面
)

alwtyp 发表于 2011-7-3 09:28:19

謝謝兩位。萬分感謝
页: [1]
查看完整版本: 使用OPENDCL的大侠,请帮忙看下程序