明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 5722|回复: 16

[OpenDCL] 请教关于OPENDCL问题

  [复制链接]
发表于 2008-6-11 16:32 | 显示全部楼层 |阅读模式

在dcl控制程序中运行到自定义程序时出现这个错误:  错误 : invalid AutoCAD command: nil

哪位指教一下

 楼主| 发表于 2008-6-13 09:23 | 显示全部楼层

这里没有人用OPENDCL吗?

发表于 2008-6-13 09:36 | 显示全部楼层

告诉你了啊,CAD没有这个命令

发表于 2008-6-13 15:10 | 显示全部楼层
你不把程序贴上来怎么帮你看?我用的时候没发现这个错误。
 楼主| 发表于 2008-6-14 22:10 | 显示全部楼层
本帖最后由 作者 于 2008-6-14 22:11:50 编辑

(defun c:pls()
  (vl-load-com)
  (dcl_project_load "plus")
  (if (not (dcl_Form_IsActive plus_plus))
    (dcl_Form_Show plus_plus)
  )
)
(defun c:plus_plus_btnp_OnClicked ()
  (setq pt1 (getpoint " insert point1"))
  (setq pt2 (getpoint " insert point2"))
  (setq x1 (car pt1))
  (setq x2 (car pt2))
  (setq y1 (cadr pt1))
  (setq y2 (cadr pt2))
  (dcl_Control_SetText plus_plus_text1
          (itoa (fix (dist1 x1 y1 x2 y2))))
)
(defun dist1(x1 y1 x2 y2 / )
  (setq tt (sqrt (+ (* (- x2 x1) (- x2 x1)) (* (- y2 y1) (- y2 y1)))))
  (eval 'tt)
)

这么简单一个东西,不知道什么原因就是不算
发表于 2008-6-15 16:19 | 显示全部楼层
本帖最后由 作者 于 2008-6-15 16:21:52 编辑

你的窗体类型是什么?

c:plus_plus_btnp_OnClicked 好像是在图形界面执行的函数定义,能否执行 dcl_Control_SetText?

是否需要回到对话框界面在执行??

 楼主| 发表于 2008-6-16 08:50 | 显示全部楼层
窗体是Modeless,不是dcl_Control_SetText的问题,是这个dist1(x1 y1 x2 y2 )自定义的函数不运行,不知道怎么回事
发表于 2008-6-16 13:08 | 显示全部楼层
本帖最后由 作者 于 2008-6-16 13:22:32 编辑

这个也太汗了吧。。。这么求距离?

(defun c:pls ()
  (if (setq fn (findfile "plus.odcl"))
    (dcl_PROJECT_LOAD fn)
  )
  (if (and (setq pt1 (getpoint " insert point1"))
    (setq pt2 (getpoint pt1 " insert point2"))
      )
    (progn
      (if (not (dcl_Form_IsActive plus_plus))
 (dcl_Form_Show plus_plus)
      )
    )
  )
)

(defun c:plus_plus_btnp_OnClicked ()
  (setq dis (distance pt1 pt2))
  (dcl_Control_SetText
    plus_plus_text1
    (rtos dis 2 3)
  )
)


粗略修改了一下

 楼主| 发表于 2008-6-16 14:52 | 显示全部楼层
本帖最后由 作者 于 2008-6-16 14:54:51 编辑

楼上的大哥,我的目的不为求距离,我是想知道为什么不执行自定义的函数或程序。

或者说在c:plus_plus_btnp_OnClicked ()这个里面为什么不执行自定义的函数或程序。

 楼主| 发表于 2008-6-16 15:02 | 显示全部楼层
caoyin发表于2008-6-15 16:19:00你的窗体类型是什么?c:plus_plus_btnp_OnClicked 好像是在图形界面执行的函数定义,能否执行 dcl_Control_SetText?是否需要回到对话框界面在执行??

不需要回到对话框界面执行

我是在对话框里面输入几个参数,点击按钮之后执行一些操作,其中有用参数画图的自定义函数,当程序运行到自定义函数时就出错,不知道是怎么回事

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-25 10:21 , Processed in 0.235941 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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