Jump to content

dcl start up


aloy

Recommended Posts

Hi everyone,

I have problem in getting one dcl versions started in my drawing. The AfraLISP version starts very well when lsp function is run. However Terrycad version given below does not work well although a dialog is created when tested separately. It appears the terrycad version ultimately leads to better pixel control to give a better appearance. What can be the reason?. Here are the two files:

 

cl_settings : default_dcl_settings { audit_level = 3; }
//---------------------------------------------------------------------------------------------------------
// MyFirst
//---------------------------------------------------------------------------------------------------------
MyFirst : dialog {
 label = " Hello World";
 spacer;
 : text {
   label = "This is my first dialog.";
   alignment = centered;
 }
 spacer;
 ok_only;
}//MyFirst

(defun c:MyFirst (/ Dcl_Id%)
 (princ "\nMyFirst")(princ)
 ; Load Dialog
 (setq Dcl_Id% (load_dialog "MyFirst.dcl"))
 (new_dialog "MyFirst" Dcl_Id%)
 ; Dialog Actions
 (start_dialog)
 ; Unload Dialog
 (unload_dialog Dcl_Id%)
 (princ)
);defun c:MyFirst

 

Is there a way the dialog could made to appear after running the lisp?.

 

My ultimate aim is to give a better appearance to the dialog shown below:

 

Thanking in advance

Aloy1Dialog.jpg

Edited by rkmcswain
added [CODE] tags
Link to comment
Share on other sites

  • Replies 151
  • Created
  • Last Reply

Top Posters In This Topic

  • aloy

    72

  • rlx

    67

  • Lee Mac

    6

  • stevesfr

    3

Top Posters In This Topic

Posted Images

Hi Aloy, I'm not sure if I understand what it is you want

 

Is there a way the dialog could made to appear after running the lisp?.

 

I gues you can start a dcl and right after you started your dialog do nothing further after (start-dialog) and exit the lisp program but what would be the point? I gues you want something like a floating status window? Maybe a table would do the trick? (never used / made one myself though , never found a use for it you know , not for the things i use in my work)

 

My ultimate aim is to give a better appearance to the dialog shown below:

 

You're talking about the layout of your dialog?

 

I would use 2 rows , each row containing 4 columns , 1 column for text , 1 for edit boxes , 1 again for text and 1 again for edit boxes. That way all your boxes align. Or you can use 1 row and 4 colums.

 

Gr. Rlx

Link to comment
Share on other sites

rlx,

My second aim is to continue on the TerryCad course so that I can give a good appearance to my dialog that is appearing in my first post. As you would see the text boxes are slightly dis-oriented giving it a messy appearance. It seems in TerryCad's course they teach how to control pixels better; as you know all screens are made of pixels. Perhaps I should go direct to their website and pose the question.

Best Regards,

Aloy

Link to comment
Share on other sites

BIGAL,

Yes, the "helloo" appear when (alert "helloo") inserted in the lisp, however what I am trying to get is the "Hello world" to appear from dcl. As for the dcl (for one box column) I think there is slight improvement as shown bellow, but not 100%. Perhaps an optical illusion:

 

Thanks

Capture1.PNG

Link to comment
Share on other sites

You probably use the label option for your edit boxes. What I mean is , leave them blank and use : text in a separate column. That way all your text's can have the same alignments. Ditto for your edit boxes. You can also use the (children) fixed_width = true for your columns / edit boxes.

 

Gr. Rlx

Link to comment
Share on other sites

Hi rlx,

As regards my aims, your first quote is correct. I want a dialog to appear as shown below after I run the lisp instead of nothing:

 

I don't think what you want can be done with lisp , to create something like a dockable dialog. For that you would need .Net , VBA or something like that (I think). Though I did some programming in C many (many) years ago , I decided it was digital sm. Things have improved since then , but it is still is more complex than visual lisp. Maybe Visual Studio with autocad library is the way to go.

 

http://usa.autodesk.com/adsk/servlet/index?id=18162650&siteID=123112

 

gr. Rlx

Link to comment
Share on other sites

Hi rlx,

Here is the dcl for the above dialog.

 


aloy1 : dialog {
 label = "Partially Full Pipe Flow Calculations - S.I. Units" ;

 : column {

 : row {

       : text {label = "Inputs:";}
       
       : text {label = "                           Calculations:";}

 }

 : row {

         : text {label = "Pipe Size, (mm)   = ";}

         : edit_box {key = eb11; width = 3; fixed_width = true; value = "0000"; alignment = "Right";}
         
         
         : text {label = "Depth of flow,(mm) = ";}

         : edit_box {key = eb12; width = 3;fixed_width = true; value = "0000"; alignment = "Right";}
         

         

  }

  : row {
         

         : text {label = "Manning's n     (full), = ";}

         : edit_box {key = eb21; width = 5; value = "0.000"; alignment = "Right";}

         : text {label = "    Central Angle, rad.        = ";}

         : edit_box {key = eb22; width = 4; value = "0.00"; alignment = "Right";}
 }

 : row {

        : text {label = "Flow, Q (l/s)         = ";}

        :edit_box {key = eb31; width = 5; fixed_width = true; value = "000.0"; alignment = "Right";}

        : text {label = "Full bore flow, (l/s) = ";}

        :edit_box {key = eb32; width = 5; fixed_width = true; value = "000.0"; alignment = "Right";}
 }

 : row {

         : text {label = "Slope %,         S  = ";}

         : edit_box {key = eb41; width = 4; fixed_width = true; value = "0.00"; alignment = "Right";}

         : text {label = "Full bore vel., m/s = ";}

         : edit_box {key = eb42; width = 4; fixed_width = true; value = "0.00"; alignment = "Right";}
 }

 : row {

         : text {label = "Calculations:";}

 }

 : row {

         : text {label = "Radius: mm         =       ";}

         : edit_box {key = eb51; width = 5; fixed_width = true; value = "000.0"; alignment = "Right";}

         : text {label = "Cross Sect. Area mm^2: ";}

         : edit_box {key = eb52; width = 8; fixed_width = true; value = "000000.0"; alignment = "Right";}
 }
         

 : row {

         : text {label = "Wetted peri.mm =";}

         : edit_box {key = eb61; width = 5; fixed_width = true; value = "000.0"; alignment = "Right";}

         : text {label = "% pipe full  =";}

         : edit_box {key = eb62; width = 4; fixed_width = true; value = "00.0"; alignment = "Right";}
 }

 : row {

         : text {label = "Hydra. radi.: mm =  ";}

         : edit_box {key = eb71; width = 5; fixed_width = true;  value = "000.0"; alignment = "Right";}

         : text {label = "Ave. Velocity: m/s";}

         : edit_box {key = eb72; width = 4; fixed_width = true;  value = "0.00"; alignment = "Right";}
 }

 : row {

         : text {label = "n/nfull                 = ";}

         : edit_box {key = eb81; width = 4; fixed_width = true;  value = "0.00"; alignment = "Right";}

         : text {label = " roughness, n =";}

         : edit_box {key = eb82; width = 5; fixed_width = true;  value = "0.000"; alignment = "Right";}

 }

 }

 

         
 ok_only;

}

 

 

I understand what you mean. I too, am familiar with C#, Java, .net etc. as I obtained Java's SUN certification many many years ago Creation of dialogs is very easy with them. I think there is need for interfacing with something like ObjectArx to implement dialogs with C# in AutoCAD which appears messy to me. Hence my attempt to go along dcl. I have the dialog of a digital terrain modeling with the program itself (dcl & lsp), sent to me by a contributor to this forum, which means what I am attempting can be done via dcl.

Regards,

Aloy

Aloy

Edited by rkmcswain
added [CODE] tags
Link to comment
Share on other sites

Aloysius,

 

I suggest you read about "Nested Dialog" on Afralisp http://www.afralisp.net/dialog-control-language/tutorials/nesting-dialog-boxes.php.

 

Your alignment problem is cause by the width of your edit box tile being insufficient for the label and edit box. Normal way would be to have " alignment = right;", and the label left justified. So in other word the whole edit tile is aligned right but the label within the tile is left aligned by default. That is unless you have set fixed_width too small.

 

Not sure but I believe you want to input values and have the calculation updated every time you change any of the input. Upon pressing OK the dialog and program would be exited. This is possible with standard DCL

 

However a real floating window is not possible as rlx already told you.

 

ymg

Link to comment
Share on other sites

I've created some examples for you. Just to show what you can do

 

 

you can call them with aloy2 and aloy3 in the lisp file

 

have fun

 

p.s. I would give the edit boxes a more readable name.

 

gr.Rlx

 

aloy.DCL

 

aloy.lsp

aloy2.jpg

aloy3.jpg

Edited by rlx
Link to comment
Share on other sites

ymg3,

Thanks very much for the advice. Flipping between the dialog and the model space may be the way forward to mimic the "Advanced Road Design CIV3D" (for sewerage) given by BIGAL in another recent thread.

Best Regards,

 

Aloy

Link to comment
Share on other sites

rlx,

I was able to slightly modify your code to get the attached dialog. However I could only see it in the preview. When the lisp is run. it is hidden somewhere; same as the TerryCad one given in my original posting in the thread. I also want to add a picture to explain the user what all there parameters mean as in the link link given for a free calculator:

https://www.engineersedge.com/fluid_flow/partially_full_pipe_flow_calculation/partiallyfullpipeflow_calculation.htm

Thanks

NewDialog.PNG

Edited by aloy
Link to comment
Share on other sites

:DHi Aloy,

 

I've created a few quick examples in aloy.lsp. How to init your edit boxes , to do something with your editboxes without closing the dialog (updating)

 

Just type something in for example pipe-size edit box or depth of flow and your edit boxes wil be updated (whith some bogus values)

 

The real calculations you have to do yourself of course. Point is how to asign a action to an editbox. Maybe study some examples on terrycad.

 

The values change when you type something in editbox and then go to another editbox (to trigger the action-tile) or press enter will do the job (as long as your ok button doesn't have dcl property allow_accept = true). Another way could be to add a botton 'recalculate' instead of only ok.

 

If you type 0 , 1 , 10 in slope edit box some other edit boxes will be updated , if you just click in one of the calculation editboxes upperright , all boxes will be updated , just for example. Current programm is purely example, no error checking , has no variables to store values for your edit boxes but i hope you dont hope i write the entire program haha

 

Pretty bussy for me this week , big shutdown in the plant I work , so you have to do some work too :D

 

btw, this is just tutorial as to how not to hide the dialog and how to use action_tile. Next step would be to create a function 'recalculate_dialog that would take the form (action_tile "eb_pipe-size" "(setq pipe-size $value)(recalculate_dialog)")

 

This way you can have 1 function to do all your calculations for all your edit boxes.

gr. Rlx

aloy.lsp

aloy.DCL

Edited by rlx
Link to comment
Share on other sites

Hi rlx,

Thanks for all the help. I will not be able to work on it as I am feeling unwell today. Will get back after testing your codes. Actually the lisp program I intend using here was used in a project with data fed in at command prompt. However I told the authorities that data can be fed from a dialog. Hence my attempt here. But it is not mandatory for me to do it. Therefore I can take time.

Good luck on your assignment.

Regards,

Aloy

Link to comment
Share on other sites

Hi rlx,

Thanks for all the help. I will not be able to work on it as I am feeling unwell today. Will get back after testing your codes. Actually the lisp program I intend using here was used in a project with data fed in at command prompt. However I told the authorities that data can be fed from a dialog. Hence my attempt here. But it is not mandatory for me to do it. Therefore I can take time.

Good luck on your assignment.

Regards,

Aloy

 

 

Don't worry , just get better first:cry:

 

 

Motto here is don't work harder , work smarter and my appie to generate loops and onelines from an excel list works , well , excellent. Just wish I could say the same for the list's themself they give me. But so far I'm on top.

 

 

Mean while concentrate on getting well and the rest will come later.

 

 

gr. Rlx

Edited by rlx
Link to comment
Share on other sites

Hi rlx,

OK already. But first things first. I haven't been able to run the lisp and get the dialog from my very first posting. I can only get the dialog in the dcl preview. Can you test it on your computer( the lisp in my first posting) and let me know please?.

Link to comment
Share on other sites

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...