DCL wtf?

DCL wtf?

Anonymous
Not applicable
2,161 Views
9 Replies
Message 1 of 10

DCL wtf?

Anonymous
Not applicable

Hi all!

 

I just started to learn DCL.

 

https://www.afralisp.net/dialog-control-language/tutorials/getting-started-part-1.php

 

Im doing this tutorial. 

 

I copied the dcl code into a dcl file. I copied the lisp code into an lsp file. I named them the same. (test_dcl1) and i put them in the same (trusted) directory.

 

I loaded the lsp, get the prompt.

I entered test_dcl1 and it ends with: 

 

; error: quit / exit abort

 

Can someone try this? Is it working?

What am i doing wrong?

 

Do i have to download something to use DCL? I didnt see anything regarding i would have to download anything....

 

Thanks in advance

 

0 Likes
Accepted solutions (1)
2,162 Views
9 Replies
Replies (9)
Message 2 of 10

_Tharwat
Advisor
Advisor

Try this updated lisp for you to know where the problem resides if it took a place.

 

(defun C:TEST_DCL1 (/ dcl_id )
 (if (and (or (findfile "test_dcl1.dcl")
              (alert "Dcl file < test_dcl1.dcl > was not found")
              )
          (setq dcl_id (load_dialog "test_dcl1.dcl"))
          (or (< 0 dcl_id)
              (alert "Dcl file could not be loaded")
              )
          (or (new_dialog "test_dcl1" dcl_id)
              (alert "Press Ok to exit safely")
              )
          )
   (progn
     (action_tile "accept" "(done_dialog)")
     (start_dialog)
     (unload_dialog dcl_id)
     )
   )
  (princ) 
)

 

 

 

Message 3 of 10

Anonymous
Not applicable

I tried it, the first one is the problem. Ive got the alert message about the DCL file was not found.

 

I dont understand why because its in the same directory and named the same as the lsp file. 😞

0 Likes
Message 4 of 10

_Tharwat
Advisor
Advisor
Accepted solution

What you think is trusted was not trusted. 😉

Move the DCL file into your AutoCAD Support folder and that should guarantee the file to be found.

Message 5 of 10

Anonymous
Not applicable

And really this helped 😮 Thanks very much!

 

And this is insane. Now i loaded the file from the original directory again and now its working that one also... And i havent changed anything... 😄

0 Likes
Message 6 of 10

_Tharwat
Advisor
Advisor

@Anonymous wrote:

And really this helped 😮 Thanks very much!


You're welcome anytime.


@Anonymous wrote:

And this is insane. Now i loaded the file from the original directory again and now its working that one also... And i havent changed anything... 😄


No worries, this should happen from time to time so be prepared for more. 😄

Happy coding.

0 Likes
Message 7 of 10

john.uhden
Mentor
Mentor

I have the opinion that you should not comingle your custom code in with all the AutoCAD code.

Instead:

1.  Make a directory, say c:\Custom.

2.  In Options -> Support File Search Path, add C:\Custom

3.  Run this, just once...

     (setvar "trustedpaths" (strcat (getvar "trustedpaths") ";C:\\Custom"))

 

Now you won't have to worry about AutoCAD needing a path to your custom files.  In fact you won't need to supply any path at all, provided your files are uniquely named.

If you have an acaddoc.lsp file, or want to create one, put it in the c:\Custom folder.  AutoCAD will find and load it automatically.

If you are in doubt as to whether a file name is unique, at the command prompt enter (findfile "<myfilename.dcl>").  AutoCAD will return either the name of the file including path (if found) or nil (if not found).

Enjoy, or else!

John F. Uhden

0 Likes
Message 8 of 10

Sea-Haven
Mentor
Mentor

Nice idea John explaining how to add paths has many scratching their heads, a copy and paste to add C:\custom.

 

(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-Acad-object))))
(vla-put-SupportPath *files* (strcat "c:\\Custom;"(vla-get-SupportPath *files*) ))
(setvar "trustedpaths" (strcat (getvar "trustedpaths") ";C:\\Custom"))

0 Likes
Message 9 of 10

john.uhden
Mentor
Mentor

@Sea-Haven

True.  I did not say where to add the path.

I see that you are suggesting to put it first in the list.

Other than that, there really ain't no diff.

John F. Uhden

0 Likes
Message 10 of 10

Anonymous
Not applicable

Thanks very much! 🙂

0 Likes