2009-02-24 18:57 UTC
i don't know what's the problem with this code.
ENTMAKE returns error, i have to draw the line and save it LN var, then the code works fine.
see attached.
AutoCAD 2008
OpenDCL [5.0.1.6]
ENTMAKE returns error, i have to draw the line and save it LN var, then the code works fine.
see attached.
;;; Ensure the appropriate OpenDCL ARX file is loaded
(COMMAND "_OPENDCL")
(DEFUN C:mgrread ()
(dcl_Project_Load "modeless-grread" t)
(dcl_Form_Show modeless-grread_Form1)
(PRINC)
)
(defun c:modeless-grread_Form1_OnInitialize (/)
(dcl_Control_SetCaption modeless-grread_Form1_Label3 "0 , 0 , 0")
(dcl_Control_SetCaption modeless-grread_Form1_Label4 "0.00")
)
(defun c:modeless-grread_Form1_GraphicButton1_OnClicked (/ p1 cont grr)
(setq p1 (getpoint "\nFirst point: ")
cont t
)
;;; (ENTMAKE (LIST '(0 . "LINE") (CONS 10 p1) (CONS 11 p1))) <---- HERE IS THE PROBLEM
;;; (setq ln (vlax-ename->vla-object
;;; (entlast)
;;; )
;;; )
(while cont
(setq grr (grread t 14))
(cond
( (= 5 (car grr)) ;aqui solo mueve el cursor
(vla-put-endpoint ln (vlax-3d-point (cadr grr)))
(dcl_Control_SetCaption
modeless-grread_Form1_Label3
(strcat (rtos (caadr grr) 2 2) " , " (rtos (cadadr grr) 2 2) " , " (rtos (car (cddadr grr)) 2 2))
)
(dcl_Control_SetCaption
modeless-grread_Form1_Label4
(rtos (vla-get-Length ln) 2 2)
)
)
( (= 2 (car grr))
(if (= 13 (cadr grr))
(progn
(dcl_MessageBox "ENTER. \nMGRREAD ends" "MGRREAD Message")
(dcl_Form_Close modeless-grread_Form1)
(setq cont nil)
)
(dcl_MessageBox (strcat "Key: " (chr (cadr grr))) "MGRREAD Message")
)
)
( (= 3 (car grr))
(dcl_MessageBox "left click" "MGRREAD Message")
)
( (= 25 (car grr))
(dcl_MessageBox "right click" "MGRREAD Message")
)
)
)
)
AutoCAD 2008
OpenDCL [5.0.1.6]