明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2300|回复: 4

选择的问题

[复制链接]
发表于 2012-6-10 20:19:09 | 显示全部楼层 |阅读模式
用OPENDCL 制作了个面板控件,从面板切换到CAD选择是总是提示
无法重复进入 LISP。
*无效选择*
需要单个对象。
不知道问题出在哪里?
程序如下:

  1. (defun C:Point_Repair ()
  2.   ;;确保加载ObjectDcl动态连接库
  3.   (if (not (member "OpenDCL.16.arx" (arx)))
  4.     (arxload "C:\\Program Files\\徐光工具\\system\\OpenDCL.16.arx")
  5.     ("加载OpenDCL.16.arx 失败.")
  6.   )
  7.   ;;加载对话框odc文件
  8. (dcl_Project_Load "PointRepair.odcl")
  9.   ;;显示DclForm1对话框
  10.   (dcl_Form_Show PointRepair_Form1)
  11.   (princ)
  12. )


  13. (defun c:PointRepair_Form1_TextButton1_OnClicked (/)
  14.   (setq ent (ssget "x" '((0 . "INSERT")(2 . "Point_mk"))))
  15.   (setq n 0)
  16.   (repeat (sslength ent)
  17.     (setq ent1(entget (ssname ent n)))
  18.     (setq ss (entget (ssname ent n) (list "US_XGGJ"))) ;取实体数据表US_XGGJ
  19.     ;;点号
  20.     (if  (/= (assoc -3 ss) nil)
  21.       (progn (setq dm (cdr (nth 2 (cadr (assoc -3 ss)))))
  22.        (if (= dm nil)
  23.          (setq dm " ")
  24.        )
  25.       )
  26.       (setq dm " ")
  27.     )
  28.     ;;X坐标
  29.     (setq coordinates_x(rtos (nth 0 (trans (cdr(assoc 10 ent1)) 0 1)) 2 3))
  30.     ;;y坐标
  31.     (setq coordinates_y(rtos (nth 1 (trans (cdr(assoc 10 ent1)) 0 1)) 2 3))
  32.      ;;y坐标
  33.     (setq coordinates_z(rtos (nth 2 (trans (cdr(assoc 10 ent1)) 0 1)) 2 3))
  34.     (setq n (1+ n))
  35.     (setq str (strcat (itoa n) "\t" dm "\t" coordinates_x "\t" coordinates_y "\t" coordinates_z))
  36.     (dcl_Grid_AddString PointRepair_Form1_格1 str)
  37.   )
  38.   (alert (strcat "共读入测量点数据" (itoa n) "个"))
  39. )

  40. ;;双击将选择的点名称文字加入到扩展数据
  41. (defun PointRepair_Form1_格1_OnDblClicked (Row Column /)
  42.   (setq mm (dcl_Grid_GetCurCell PointRepair_Form1_格1))
  43.   (setq l (getvar "ltscale"))
  44.   (if (= (cadr mm) -1)
  45.     (progn (dcl_Control_SetKeepFocus PointRepair_Form1 False)
  46.      (setq x (dcl_Grid_GetCellText PointRepair_Form1_格1 (car mm) 2))
  47.      (setq y (dcl_Grid_GetCellText PointRepair_Form1_格1 (car mm) 3))
  48.      (setq coord (list (atof x) (atof y)))
  49.      (command "zoom" "c" coord (* 20 l))
  50.      (setq p1 (polar (polar coord (UcsRotationAngle) (* l 0.5))
  51.          (+ (/ pi 2) (UcsRotationAngle))
  52.          (* l 0.5)
  53.         )
  54.      )
  55.      (setq p2 (polar p1 (+ pi (UcsRotationAngle)) (* l 1)))
  56.      (setq p3 (polar p2 (+ (/ (* pi 3) 2) (UcsRotationAngle)) (* l 1)))
  57.      (setq p4 (polar p3 (UcsRotationAngle) (* l 1)))
  58.      (grdraw p1 p2 1)
  59.      (grdraw p2 p3 1)
  60.      (grdraw p3 p4 1)
  61.      (grdraw p4 p1 1)
  62.      ;;在ENT选择集里查找对象
  63.      (setq coordinates_x ""
  64.      coordinates_y ""
  65.      n 0
  66.      )
  67.      (while (and (/= x coordinates_x) (/= y coordinates_y) (< n (sslength ent)))
  68.        (setq ent1 (entget (ssname ent n)))
  69.        (setq ent1_name (cdr (assoc -1 ent1)))
  70.        (setq coordinates_x (rtos (nth 1 (assoc 10 ent1)) 2 3))
  71.        (setq coordinates_y (rtos (nth 2 (assoc 10 ent1)) 2 3))
  72.        (setq n (1+ n))
  73.      )
  74.      (setq ss (ssadd ent1_name))
  75.      (sssetfirst ss ss)
  76.      (setq en (nentselp "\n请选择为该点名称的文字或多行文字:"))
  77.      (setq stbmx (itoa 510001))
  78.      (setq pb (entget ent1_name))
  79.      (setq xb
  80.       (append
  81.         pb
  82.         (list
  83.           (list '-3
  84.           (list "US_XGGJ" (cons 1000 stbmx) (cons 1000 (cdr (assoc 1 (entget (car en))))))
  85.           )
  86.         )
  87.       )
  88.      )
  89.      (entmod xb)
  90.      (dcl_Grid_SetCellText PointRepair_Form1_格1 (car mm) 1 (cdr (assoc 1 (entget (car en)))))
  91.      (prompt "\n 已经把点名加入了扩展数据!")
  92.      (dcl_Control_SetKeepFocus PointRepair_Form1 true)
  93.     )
  94.   )
  95.   (princ)
  96. )

  97. ;;关闭窗口
  98. (defun c:PointRepair_Form1_TextButton3_OnClicked (/)
  99.   (dcl_Form_Close PointRepair_Form1)
  100. )

  101. (defun c:PointRepair_Form1_格1_OnMouseUp (Button Flags X Y /)
  102.   (dcl_Control_SetText PointRepair_Form1_TextBox1 "双击序号列可以进入点编辑状态")
  103. )
ODCL文件



请看动画里命令行提示,不知道错误到底出在那儿。

本帖子中包含更多资源

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

x
"觉得好,就打赏"
还没有人打赏,支持一下
 楼主| 发表于 2012-6-11 00:24:58 | 显示全部楼层
谁见过这样的文字

本帖子中包含更多资源

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

x
发表于 2012-6-16 11:19:16 | 显示全部楼层
我见过
我的问题原因是:LISP提请等待用户输入过程中,无法执行其他任何LISP函数,直到用户输入完毕。
例如:点击ODCL后,执行getpoint函数,当鼠标从ODCL移到绘图区时,该动作会触发MouseMovedOff事件,事件响应函数OnMouseMovedOff中肯定需要用AutoLISP定义一些动作,如(princ),此时会出现“无法重复进入 LISP”错误。解决办法:去除ODCL中MouseMovedOff事件
希望对你是否有帮助
 楼主| 发表于 2012-6-16 14:52:37 | 显示全部楼层
谢谢,我知道了什么原因,程序没有问题,是鼠标的左键有点问题。单击左键有时候会出现双击的现象。
发表于 2014-1-6 13:05:31 | 显示全部楼层
遇到了类似问题载入程序后,单击按钮调用外部LISP文件,提示“无法重复进入 LISP”。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-5-26 02:58 , Processed in 0.186896 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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