Jump to content

Recommended Posts

Posted

Dont know anything about programming, but i guess these files are called from inside .lsp routines right? I was browsing through some old folders on the office and i found some dcl files from old cad installations. Can i run them somehow without their lisps or cad environment dialogs, cause these things are legacy now and i dont even know where the original setups were or how they came about

Posted

hmm, thanx that is a step forward. When i do that i get the gui dialogs, but there buttons there are not linked with commands.

 

Is there any way to learn the relationship between buttons and commands

Posted

tough job a head of me. Are there any other tools, or dialogs i can invoke to help tis beautiful journey

Posted (edited)

try this :

 




; Preview Dcl written by Rlx on 30-jun-2017 for CadTutor

(defun c:RlxPreviewDcl ( / dcl-source-folder dcl-filenames dcl-dialognames key-list current-dcl-file)
 (RlxPreviewDcl_Init)
 (RlxPreviewDcl_StartMainDialog)
 (RlxPreviewDcl_Exit)
 (princ)
)
(defun RlxPreviewDcl_Init ()
 (vl-load-com)
)
(defun RlxPreviewDcl_Exit ()
 (princ "\ndone")
)
(defun RlxPreviewDcl_CreateMainDialog ( )
 (if (and (setq main-fn (vl-filename-mktemp ".dcl")) (setq main-fp (open  main-fn "w")))
   (write-line
     (strcat "RlxPreviewDialog:dialog{label=\"Rlx Preview Dialog - Rlx(2017)\";"
         ":boxed_row{label=\"Source Folder\";:edit_box{key=\"eb_dcl_source_folder\";edit_width=40;}"
           ":button{label=\" >> \";key=\"bt_dcl_source_folder\";}}spacer;"
         ":boxed_row{: list_box{label=\"Dcl Files\";key=\"lb_dcl_filenames\";height=12;}"
            ": list_box{label=\"Dialog Names\";key=\"lb_dcl_dialognames\";height=12;}}spacer;ok_cancel;}") main-fp))
 (if main-fp (close main-fp))(gc)
)
(defun RlxPreviewDcl_InitMainDialog ( / i )
 ; if previous 
 (if (and dcl-source-folder (vl-file-directory-p dcl-source-folder))
   (set_tile "eb_dcl_source_folder" dcl-source-folder))
 (if (vl-consp dcl-filenames)
   (progn (start_list "lb_dcl_filenames")(mapcar 'add_list dcl-filenames)(end_list)))
 (if (and current-dcl-file (setq i (vl-position current-dcl-file dcl-filenames)))
   (set_tile "lb_dcl_filenames" (itoa i))(set_tile "lb_dcl_filenames" (setq i "0")))
 (if (and current-dcl-file (findfile current-dcl-file))
   (RlxPreviewDcl_FindDialogs current-dcl-file))
)
;ment for cache option but it works good enough without
(defun RlxPreviewDcl_FindDialogs ( $fn / )
 (princ); for now do nothing
)
; test (RlxPreviewDcl_FindKeys ": toggle { label = \"Inspoint\"; key = \"tg_match_att_inspoint\";}")
; 34 = ascii code for "
(defun RlxPreviewDcl_FindKeys ( $str / str )
 (if (and (setq i1 (vl-string-search "key" (strcase $str t)))
      (setq i2 (vl-string-position 34 $str i1))(setq i3 (vl-string-position 34 $str (1+ i2))))
   (setq str (substr $str (+ i2 2) (- i3 i2 1))))
 str
)
(defun RlxPreviewDcl_MainDialogActions ()
 (action_tile "bt_dcl_source_folder" "(RlxPreviewDcl_SelectDclSourceFolder)")
   (action_tile "eb_dcl_source_folder" "(RlxPreviewDcl_CheckManualInputSourceFolder $value)")
     (action_tile "lb_dcl_filenames" "(RlxPreviewDcl_SelectDclSourceFile $value )")
       ;(action_tile "lb_dcl_dialognames" "(setq dialog-name (nth (atoi $value) dcl-dialognames))")
 (action_tile "lb_dcl_dialognames" "(RlxPreviewDcl_SelectDialogName (nth (atoi $value) dcl-dialognames))")
         (action_tile "accept" "(done_dialog 1)"))
(defun RlxPreviewDcl_StartMainDialog ( / main-fn main-fp main-dcl drv dialog-name)
 (RlxPreviewDcl_CreateMainDialog)
 (if (and (setq main-dcl (load_dialog main-fn)) (new_dialog "RlxPreviewDialog" main-dcl))
   (progn  (RlxPreviewDcl_InitMainDialog) (RlxPreviewDcl_MainDialogActions) (setq drv (start_dialog))))
 (if main-dcl (unload_dialog main-dcl)) (if (and main-fn (findfile main-fn))(vl-file-delete main-fn))
 (if (and (= drv 1) dialog-name (/= dialog-name ""))(RlxPreviewDcl_SelectDialogName dialog-name ))
)
(defun RlxPreviewDcl_SelectDclSourceFolder ( / dir)
 (if (setq dir (RlxPreviewDcl_SelectFolder "Select folder containing the .dcl files"))
   (progn (setq dcl-source-folder dir)(set_tile "eb_dcl_source_folder" dcl-source-folder)(RlxPreviewDcl_UpdateListBoxes))))
(defun RlxPreviewDcl_SelectFolder ( msg / sh objFolder objParentFolder strPath)
 (setq sh (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application" ))
 (setq objFolder (vlax-invoke sh 'BrowseForFolder 0 msg 0 ""))
 (if objFolder 
  (and
    (setq strTitle (vlax-get objFolder "Title"))
    (setq objParentFolder (vlax-get objFolder 'ParentFolder))
    (setq strPath (vlax-get (vlax-invoke objParentFolder "Parsename" strTitle) "Path"))
    (vlax-release-object objParentFolder)(vlax-release-object objFolder))
   (vlax-release-object sh)
 )
 (if strPath (strcase (vl-string-translate "\\" "/" strPath) t))
)
(defun RlxPreviewDcl_UpdateListBoxes ( / lst)
 (cond
   ((null dcl-source-folder))
   ((not (vl-file-directory-p dcl-source-folder)))
   (t
    (if (setq lst (vl-directory-files dcl-source-folder "*.dcl" 1))(setq dcl-filenames lst)(setq dcl-filenames '("No dcl files")))
    (start_list "lb_dcl_filenames")(mapcar 'add_list dcl-filenames)(end_list)
   )
 )
)

(defun RlxPreviewDcl_SelectDclSourceFile ( $index / fp-dcl txt key)
 (setq current-dcl-file (strcat dcl-source-folder "/" (nth (atoi $index) dcl-filenames)))
 ; reset dialog key & name list (for now) , later maybe create cache list
 (setq dcl-dialognames '() key-list '())
 ; dcl-filenames
 (if (setq fp-dcl (open current-dcl-file "r"))
   (while (setq txt (read-line fp-dcl))
     ; scan each line for buttons, boxes whatever and get key
     (if (setq key (RlxPreviewDcl_FindKeys txt)) (setq key-list (cons key key-list)))
     ; now search for dialog names
     (if (vl-string-search "dialog" (strcase txt t))
(progn
  (setq txt (SplitStr txt " "))
  (if (/= (car txt) "//")(setq dcl-dialognames (cons (car txt) dcl-dialognames))))
     )
   )
 )
 (if fp-dcl (close fp-dcl))
 (if (vl-consp dcl-dialognames)
   (progn
     (setq dcl-dialognames (reverse (vl-remove "" dcl-dialognames)))
     (start_list "lb_dcl_dialognames")(mapcar 'add_list dcl-dialognames)(end_list)))
)

(defun RlxPreviewDcl_SelectDialogName ($dialog-name / fn dialog tmp-dcl)
 ; you can print error per case with this construct
 (cond
   ((null $dialog-name))
   ((null current-dcl-file))
   ((null (setq fn (findfile current-dcl-file))))
   ((null (setq tmp-dcl (load_dialog fn))))
   ((null (new_dialog $dialog-name tmp-dcl)))
   (t (activate_action_tiles)(start_dialog)(if tmp-dcl (unload_dialog tmp-dcl)))
 ) 
)
; every dialog is different so how can I make sure I hit the right key... mmm , what would a dragon do?
; easy , i get all keys (RlxPreviewDcl_FindKeys) and let every key close the dialog
(defun activate_action_tiles ( / key )
 (foreach key key-list (action_tile key "(done_dialog)"))
 (action_tile "accept" "(done_dialog 1)")
 (action_tile "cancel" "(done_dialog 1)")
)
(defun SplitStr ( s d / p )(if (setq p (vl-string-search d s))(cons (substr s 1 p) (SplitStr (substr s (+ p 1 (strlen d))) d)) (list s)))

(c:RlxPreviewDcl)

gr.Rlx

Edited by rlx
Posted (edited)

I have updated my code (in post #6 from yesterday). This one should behave a little better.

 

Just select folder with dcl files. In the list box on the left you will find all the dcl files and when you select a file in the left listbox , in the right list box you will get all the dialog names. Just select dialog name and new dialog will appear. Any button will close it and right away you can select the next dialog name or other dcl file. Happy?

 

Gr. Rlx

 

attachment.php?attachmentid=61638&cid=1&stc=1

RlxPreviewDcl.jpg

Edited by rlx
Posted

Thank you very much my friend i appreciate your help. This really helps me call up every dialog that was available and see what was behind, but as i search through the installation folder, i couldnt find any .lsp files, only some .exe subroutines that must be the ones calling the dialogues and containing the functions, but it seems without the setup i cannot link those to the actual code..

Posted (edited)
Thank you very much my friend i appreciate your help. This really helps me call up every dialog that was available and see what was behind, but as i search through the installation folder, i couldnt find any .lsp files, only some .exe subroutines that must be the ones calling the dialogues and containing the functions, but it seems without the setup i cannot link those to the actual code..

 

 

Unfortunately like ziele_o2k said , cannot help you there because you must have the actual source code for that. Other reason for me to make this was that my autocad folder at my work is protected so I couldn't use the built in preview. For previewing many dcl files it is handy though :-) at least you have some indication what programs are (or where) present and how they once looked.

 

 

gr. Rlx

Edited by rlx
Posted

Yes indeed and i thank you for that my friend, take care

Posted

@rlx:

Take a look at the signature of the new_dialog function:

(new_dialog dlgname dcl_id [action [screen-pt]])

You can specify a default action here. No need for your RlxPreviewDcl_FindKeys etc. code.

Posted (edited)

thanx Grrr and thanx for the tip Roy, overlooked that option. Less code=more smilie.png

(unfortunately it does / did not work)

gr. Rlx

Edited by rlx
Posted
Thank you very much my friend i appreciate your help. This really helps me call up every dialog that was available and see what was behind, but as i search through the installation folder, i couldnt find any .lsp files, only some .exe subroutines that must be the ones calling the dialogues and containing the functions, but it seems without the setup i cannot link those to the actual code..

 

While .lsp files do not have to have the same name as the .dcl files they have to have the .dcl file name in then to load them. You can search the text of lisp files for the .dcl file name to find the matching lisp.

Posted
While .lsp files do not have to have the same name as the .dcl files they have to have the .dcl file name in then to load them. You can search the text of lisp files for the .dcl file name to find the matching lisp.

 

The Rock asked for

i found some dcl files from old cad installations. Can i run them somehow without their lisps
and thats what I delivered

smilie.png so I assume(d) he doesn't have the (original) lisp files any more , else of course you would be absolutely right :beer:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...