An Engineer friend that I work with has ask me if I could write an AutoLISP program to draw an elevation view of a pole shaft. I have modified the dialog that Trevor suggested in one of the threads and came up with this preliminary lisp file and dialog file. The math seams a bit complicated, but my friend assures me that we can work through it together. Here is what I have developed so far. I'd appreciate any suggestions on how I should proceed to make the program better. Keep in mind that this is a work in progress until finished. I appreciate all your help.
Thanks,
Justin
Justin,
You’re off to a good start. The only thing I would suggest is to allow the dimensions to be entered in architectural or real numbers. You might also want to update the dimensions in the edit_box tiles to real numbers to be compatible with AutoCAD users using metric standards as well as those using architectural standards.
So, how soon do we get to test it out?
I only get to work on my programs once in a while. So I'm not sure when it'll be ready for testing. Does anyone have an example of how to update these edit boxes?
Thanks for your help and advice.
Justin
Justin,
You might be able to use a function to convert the value from the edit_box into a string real number and just update the edit_box tile with the new value. There was a similar discussion in the following thread. ..\Forum2\F2T28P1.htm#4
Here is a slight modification to the one I previously posted. It converts a string number in any format into a string of the real number.
I have modified the dialog that Trevor suggested in one of the threads and came up with this preliminary lisp file
and dialog file.
Thanks for giving me some of the credit, but I think most of it should go to Bennett and J Briggs. They've help me out a lot.
You're most likely going to need sub-functions for updating the tiles and checking the values. I think Bennett suggested this somewhere, when the commands become too long to add to the end of an action_tile.
I noticed you used an early version of mine to setq a variable to an item in a popup_list. I've found a shorter version that you might want to use instead.
Does anyone have an example of how to update these edit boxes?
You can combine the realstring function that Quick Silver submitted into a sub-function to update your edit boxes.
Here's the basics of what you'll need. You might want to include error checking for 0 and negative values.
Bennett
Code:
;In the action_tile section:
(action_tile "Edit2" "(Update_Dim)");etc.
;You can use the same sub-function for all your edit boxes,
;by putting the $key, tile name, in a cond statement:
(defun Update_Dim ()
(cond
((= $key "Edit2")
(setq *Edit2 (realstring $value))
(set_tile "Edit2" *Edit2)
)
;etc.
)
)
I appreciate all your help and suggestions. I had a little time to work my program this week and here's the latest. I'll start working on the math and the draw part next week, but I just wanted to keep you up to date. I am very happy the way the edit boxes allow you to enter in the dimensions in different ways. We're used to having a calculator handy to convert the dimensions for the dialog into inches. Quick Silver, thanks for the code for RealString. It works great!
Justin
I have been testing my PoleShaft program for a few days now. It draws the elevation view of pole shafts using your input information. You can enter the dimension values in feet and inches or as real numbers for metric users. The math wasn’t so hard after all.
Give it a try and let me know what you think.
Justin
Note: The dcl file is the same one as in the first post.
Justin,
I just ran it and it works like a charm. I also tested entering architectural and real numbers in the edit boxes. This should be a great time saver at your work.
I helped a friend load your program on his computer. He's not into programming so he couldn't understand that he also needed to copy and paste the code from your PoleShaft.dcl into a text file and save it into the folder with his AutoLISP routines. I got it working for him, and he thinks it's pretty cool. It sure beats drawing it up the conventional way.
Trevor