Handling with Opendcl with modeless dialogue

Handling with Opendcl with modeless dialogue

S_S_SS
Advocate Advocate
663 Views
12 Replies
Message 1 of 13

Handling with Opendcl with modeless dialogue

S_S_SS
Advocate
Advocate

Hello every one 
i work with OpenCL to make modeless dialogue 
but I've a problem in using (command ....) any AutoCAD commands don't work with the OpenCL
then i tried to make entmake but it make the AutoCAD give error and closed 
can any one help me with example how to handle with the command inside the OpenCL??
thanks in advance 
and see the attached dcl file and lisp and dwg .. 

0 Likes
664 Views
12 Replies
Replies (12)
Message 2 of 13

Moshe-A
Mentor
Mentor

@S_S_SS  hi,

 

i do not have openDCl installed here (can not check) but you can not use (command) function while dialog box is open (same as using dcl) so (entmake) is good approach.

 

inside (secleader) function there is free string???  put it on remark

the rest of the code seems working 😀

 

Moshe

 

 

(defun secledger (blockName insPoint rotation / )
"Function to insert a block with given parameters."
;; التحقق من وجود البلوك في الرسم
(if (not (tblsearch "BLOCK" blockName))
(alert (strcat "Block \"" blockName "\" not found!"))
(progn

Message 3 of 13

S_S_SS
Advocate
Advocate
thanks sir
but enmake make the AutoCAD gives error and terminal closes
0 Likes
Message 4 of 13

Moshe-A
Mentor
Mentor

As i said do not have openDCL installed.

if you manually call from VLIDE console  or command line (secledger) function does it work?

 

 

0 Likes
Message 5 of 13

S_S_SS
Advocate
Advocate
unfortunately it doesn't work
0 Likes
Message 6 of 13

Moshe-A
Mentor
Mentor

post the error you are getting

0 Likes
Message 7 of 13

S_S_SS
Advocate
Advocate

S_S_SS_0-1736078045104.pngS_S_SS_1-1736078388273.png

 

0 Likes
Message 8 of 13

Moshe-A
Mentor
Mentor

it look like you did not understand what is ask you to do

i want you to copy & paste (to a new lsp file) the function (secledger) load it into memory and manually run the following 2 lines

(from VLIDE console or AutoCAD command line)

 

(setq pt1 (getpoint "\nSelect insertion point: "))

(secledger "cuplock plan" pt1 0)

 

on my computer it works

 

Moshe

 

0 Likes
Message 9 of 13

S_S_SS
Advocate
Advocate
I understand you now
this function secledger works but it ask me to get point and then i should press enter to execute the insert
even the insert command don't ask me to press enter to execute the insert
and it make error in insert the other items
I'll record a video to show you what i see
0 Likes
Message 10 of 13

Moshe-A
Mentor
Mentor

@S_S_SS,

 

To trap the error, you must isolate the part of code that trigger it.

i do not think it comes from (entmake) but from the call before or after.

 

Moshe

 

 

0 Likes
Message 11 of 13

S_S_SS
Advocate
Advocate

Hello sir 
see this code it's work correctly 

 

(defun c:hh (/)
        (setq pt3 (getpoint "\nSelect insertion point: "))

       (entmake
        (list
          '(0 . "INSERT")                        
          (cons 2 "cuplock plan")                    
          (cons 10 pt3)                     
          (cons 41 1)                           
          (cons 42 1)                            
          (cons 43 1)                            
          (cons 50 (* pi (/ 0 180.0)))    
        )
      )
  
)

 

 
and when i put it in the opendcl  like this it make AutoCAD closed immediately 

 

(defun c:Untitled/Form2/TextButton2#OnClicked (/)

  
  
        (setq pt3 (getpoint "\nSelect insertion point: "))

       (entmake
        (list
          '(0 . "INSERT")                       
          (cons 2 "cuplock plan")                   
          (cons 10 pt3)                   
          (cons 41 1)                           
          (cons 42 1)                            
          (cons 43 1)                           
          (cons 50 3)   
        )
      )
  
)

 

see the video here 
thanks in advance 

0 Likes
Message 12 of 13

Sea-Haven
Mentor
Mentor
Message 13 of 13

daniel_cadext
Advisor
Advisor

The error shows that you need to lock the document

https://opendcl.com/forum/index.php?topic=1232.0

 

I have no idea how to do this in Lisp though.

https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-RefGuide-AcApDocManager__lockDocument_AcApDo...

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes