aloy Posted September 3, 2015 Posted September 3, 2015 (edited) 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 Edited January 12, 2016 by rkmcswain added [CODE] tags Quote
rlx Posted September 5, 2015 Posted September 5, 2015 Hi Aloy, I'm not sure if I understand what it is you want Quote 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) Quote 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 Quote
aloy Posted September 6, 2015 Author Posted September 6, 2015 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: Quote
aloy Posted September 6, 2015 Author Posted September 6, 2015 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 Quote
BIGAL Posted September 6, 2015 Posted September 6, 2015 Is the DCL set up as two boxed columns ? maybe alignment = centered; use Right. Instead of nothing (alert "heelloooo") Quote
aloy Posted September 6, 2015 Author Posted September 6, 2015 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 Quote
rlx Posted September 6, 2015 Posted September 6, 2015 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 Quote
rlx Posted September 6, 2015 Posted September 6, 2015 aloy said: 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 Quote
aloy Posted September 6, 2015 Author Posted September 6, 2015 (edited) 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 January 12, 2016 by rkmcswain added [CODE] tags Quote
ymg3 Posted September 6, 2015 Posted September 6, 2015 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 Quote
rlx Posted September 6, 2015 Posted September 6, 2015 (edited) 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.DCLFetching info... aloy.lspFetching info... Edited September 6, 2015 by rlx Quote
aloy Posted September 6, 2015 Author Posted September 6, 2015 rlx, neat and very nice. Shows the power of dcl. Thanks very much Aloy Quote
aloy Posted September 6, 2015 Author Posted September 6, 2015 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 Quote
rlx Posted September 7, 2015 Posted September 7, 2015 aloy said: rlx,neat and very nice. Shows the power of dcl. Thanks very much Aloy You're welcome Aloy , gr. rlx Quote
aloy Posted September 7, 2015 Author Posted September 7, 2015 (edited) 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 Edited September 7, 2015 by aloy Quote
rlx Posted September 7, 2015 Posted September 7, 2015 (edited) :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 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.lspFetching info... aloy.DCLFetching info... Edited September 8, 2015 by rlx Quote
aloy Posted September 8, 2015 Author Posted September 8, 2015 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 Quote
rlx Posted September 8, 2015 Posted September 8, 2015 (edited) aloy said: 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 September 8, 2015 by rlx Quote
rlx Posted September 10, 2015 Posted September 10, 2015 Hi Aloy Hope you feeling better already:P Had to break away from my work for a moment and made a few updates for you. I hope it is usefull / learnfull for you. aloy.DCLFetching info... aloy.lspFetching info... Quote
aloy Posted September 10, 2015 Author Posted September 10, 2015 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?. Quote
Recommended Posts
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.