OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: hanslammerts on March 28, 2018, 01:49:43 PM

Title: Help with turning DCL to ODCL
Post by: hanslammerts on March 28, 2018, 01:49:43 PM
Hi
I am not so very good at programming but i want programmer
to redesig a existing DCL dialog into a ODCL variant.
The first i did was to give the buttons the same name.
Could use some hint how to get the dialog started. Thanks upfront


ORIGINAL DCL :

HI_menu : dialog
{
        label = " ";

       
:row {
: boxed_column
             {


    : row {
          : button {
            label = "KW - millimeter ";
            alignment = left;
            key = "SET_mm";
            width = 8;
            is_default = true;
          }
    }
    : row {
          : button {
            label = "TBB - millimeter";
            alignment = left;
            key = "SET_tbb";
            width = 8;
            is_default = true;
          }
    }
    : row {
          : button {
            label = "WE - meter    ";
            alignment = left;
            key = "SET_m";
            width = 8;
            is_default = true;
          }
    }
    : row {
          : button {
            label = "GEO - meter  ";
            alignment = left;
            key = "SET_geo";
            width = 8;
            is_default = true;
          }
    }
    }
    }
   
 
  : spacer { width = 2; }

  : button {
      label = "Cancel";
      key = "cancel";
is_cancel = true;
      width = 4;
      fixed_width = true;
       
    }
  }



LISP CODE  PART:


(vl-load-com)

(setvar 'cmdecho 0)
(vl-cmdf "_Opendcl")
(setvar 'cmdecho 1)


(defun c:HI_menu (/ OLDERR)
    (graphscr)
    (setq SETMS NIL
          SETMMS NIL
          SETGEOS NIL
          SETTBBS NIL
          CANCEL nil
    ) ;_ end of setq
    (SETMMMENU)
    (if SETMS
        (cond ((= SEL 1) (SET_M)))
    )
    (if SETMMS
        (cond ((= SEL 2) (SET_MM)))
    )
    (if SETGEOS
        (cond ((= SEL 3) (SET_GEO)))
    )
    (if SETTBBS
        (cond ((= SEL 4) (SET_TBB)))
    )
    (if CANCEL
        (princ "\nPROGRAM CANCELLED!")
    ) ;_ end of if
    (princ)
)


(defun SETMMMENU ()
    (dcl-LoadProject "HI_MENU")
    (action_tile "SET_m" "(SET_m) (done_dialog 1)")
    (action_tile "SET_mm" "(SET_mm) (done_dialog 1)")
    (action_tile "SET_geo" "(SET_geo) (done_dialog 1)")
    (action_tile "SET_tbb" "(SET_tbb) (done_dialog 1)")
    (action_tile "cancel" "(setq cancel t)(done_dialog)")
    (start_dialog)
)

; ETC.










Title: Re: Help with turning DCL to ODCL
Post by: Peter2 on April 03, 2018, 12:35:24 AM
Hi Hans

I don't think that a "1:1 translation" from DCL to ODCL is a good way.

I would analyse
- what the old DCL code does
- what you currently want and need (maybe more features, maybe others, maybe less)
- how to implement it with ODCL

In ODCL you have
- more dialogues (palettes, modeless, ..)
- more (and easier) controls (list, toggles, image buttons, ..)
- other and better handling of "Cancel" ..
- and much more.

Take DCL only as inspiration and create your software (the dialogue part) completely new ..
Title: Re: Help with turning DCL to ODCL
Post by: hanslammerts on April 08, 2018, 01:33:39 PM
Not a super-duper programming wizard speaking here.
Just your daliy AutoCAD designer trying to keep some of his tools working and making them even better. With some help ;-)

Right now i'm having some real problems in AutoCAD Civil3D.
One of them is that DCL dialogs don't run. (begining with nasty BASE.DCL not found warnings).
Being investigated, but taking long and i see opendcl has more to offer.

I just would like to get have 'blueprint'of code to get a simple 'button dialog' run in ODCL.
Just a few buttons activating a command. See att. I use something similar in DCL but none of it works any more.





Title: Re: Help with turning DCL to ODCL
Post by: Peter2 on April 08, 2018, 01:45:09 PM
a) Base.dcl not found
Maybe a problem of the AutoCAd-installation or of the settings. Try to "repair Autocad Installation" and / or try to start Autocad with the standard configuration.

b) Help in OpenDCL:
Type "opendcldemo" in Autocad - you will see a palette where you can see and try all the functions of ODCL - from simple button to more complex examples. And all these examples have the LSP (with a lot of explaining comments) and ODCL code installed on your hard drive.
Title: Re: Help with turning DCL to ODCL
Post by: hanslammerts on April 09, 2018, 02:24:33 PM
a) Workaround for this problem finally arrived
b) I looked at the modeless dialog of 'Mover'  Made this up. Almost there, this message appears...

Can you take a look?


Title: Re: Help with turning DCL to ODCL
Post by: Peter2 on April 15, 2018, 11:42:14 AM
Maybe I can look deeper tomorrow, but at the moment (only from lsp): are you sure that there is no confusion with code with same name?

- The subroutines (set_mm), (set_m) and others are not defined in this snippets.
- There is although nothing with defines something with "rectangle" - so where does the error-message comes from?