The Buzzard Posted June 4, 2010 Posted June 4, 2010 Tharwat, I want you to re-think your thinking on having a program for each angled elbow. The program below ELB.lsp is the same program that was made to make your 45 elbow. I only added an additional prompt to get the angle and a conditional with lists to supply the angles to draw each. I did not add anything else. See the attached code below and try it out. The command is ELB. You can draw four different angled elbows to any size you choose and turn them to left or right direction. Set default angle (or E::ANG$ (setq E::ANG$ "90")) Get angle at the prompt (initget "90 60 45 30") (setq E::ANG$ (cond ((getkword (strcat"\nSpecify elbow angle. [<90> <60> <45> <30>] <"E::ANG$">: ")))(T E::ANG$))) Conditional to supply the angle to create the elbow (cond ((and (= EANG$ "90")(= EDIR$ "L")(setq ANG# (list 90 90 0 0 180 270 0 270 270 0 180 90 90 180 0 270)))) ((and (= EANG$ "60")(= EDIR$ "L")(setq ANG# (list 90 90 330 330 150 270 0 240 270 330 150 90 90 150 330 270)))) ((and (= EANG$ "45")(= EDIR$ "L")(setq ANG# (list 90 90 315 315 135 270 0 225 270 315 135 90 90 135 315 270)))) ((and (= EANG$ "30")(= EDIR$ "L")(setq ANG# (list 90 90 300 300 120 270 0 210 270 300 120 90 90 120 300 270)))) ((and (= EANG$ "90")(= EDIR$ "R")(setq ANG# (list 270 270 0 0 180 90 0 90 90 0 180 270 270 180 0 90)))) ((and (= EANG$ "60")(= EDIR$ "R")(setq ANG# (list 270 270 30 30 210 90 0 120 90 30 210 270 270 210 30 90)))) ((and (= EANG$ "45")(= EDIR$ "R")(setq ANG# (list 270 270 45 45 225 90 0 135 90 45 225 270 270 225 45 90)))) ((and (= EANG$ "30")(= EDIR$ "R")(setq ANG# (list 270 270 60 60 240 90 0 150 90 60 240 270 270 240 60 90))))) Sorry, Just fixed the prompt for the angle selection. ELB.lsp Quote
Lee Mac Posted June 4, 2010 Posted June 4, 2010 In one statement: (initget "90 60 45 30") (setq E::ANG$ (cond ( (getkword (strcat "\nSpecify elbow turn direction [90/60/45/30] <" (setq E::ANG$ (cond ( E::ANG$ ) ( "90" ) ) ) "> : " ) ) ) ( E::ANG$ ) ) ) Quote
Tharwat Posted June 4, 2010 Author Posted June 4, 2010 Mr. Buzzard, I do agree with you that I should change my way of thinking to Lisp programs but I am performing as best as I could afford with the information that I have been getting and learning . So I promise you that I will do and work on that. I have looked in Elbows programs about the function that save entering data to the next invoke of the same command but unfortunately I colud not, So would you please indicate that function to me? In regard with your last lisp file Elb.lsp you did answer my questions before I asked you about, and that shows how experienced you are .... I am very proud of that.. Thanks again and again Mr. Buzzard Tharwat Quote
The Buzzard Posted June 4, 2010 Posted June 4, 2010 Mr. Buzzard,I do agree with you that I should change my way of thinking to Lisp programs but I am performing as best as I could afford with the information that I have been getting and learning . So I promise you that I will do and work on that. I have looked in Elbows programs about the function that save entering data to the next invoke of the same command but unfortunately I colud not, So would you please indicate that function to me? In regard with your last lisp file Elb.lsp you did answer my questions before I asked you about, and that shows how experienced you are .... I am very proud of that.. Thanks again and again Mr. Buzzard Tharwat Thanks, But I am still in a learning stage myself. I will put together some information for you and post later when I get some more time. Enjoy the code Quote
alanjt Posted June 4, 2010 Posted June 4, 2010 Hi Marco, I created it relatively recently, and, as it is not freeware, I didn't see the point of posting it on the forum since the code is not available - so this may be deemed as advertising I suppose. I would add that it is for sale, so those who are interested may contact me Lee I thought we weren't allowed to advertise like that or is it just make transactions? Quote
The Buzzard Posted June 4, 2010 Posted June 4, 2010 Tharwat, The attached code has a few more fixes, Sorry about that, I must have rushed it a bit. The entire Main Function is commented with explanations on what each line means. I hope this helps. You can find of course more information in ACAD Developer Help Section as well. They show samples to help clarify function usage. I will go into further detail if there is something you still may not understand. I am sure you can see that the code is much better by doing more with one lisp command. In addition to CADTutor you can also learn more from this site:http://www.afralisp.net/index.php They explain lisp programming very simple. ELB.lsp Quote
Tharwat Posted June 4, 2010 Author Posted June 4, 2010 Buzzard, What's this huge favor that you did to me, it is really undescripable and unaffordable to be return back one day. I can not find the right words to thank you for your hard work on the Elb.lsp file with all these specifications and descriptions with every line as well. I feel speachless about your marvellous and precious work that you did for me, And you have shorten my long way into Autolisp World too much. Thank you again and again Mr. Buzzard Your Sincerely Tharwat Quote
Tankman Posted June 4, 2010 Posted June 4, 2010 You gentlemen are just too good! Excellent work! I just tried the elb.lsp, wonderful. I added cylhatch.lsp (cylinder hatch) which I posted earlier. Playing with cylhatch.lsp. I didn't write the *.lsp, never wrote one, but, this is truly handy dandy stuff! Thanks guys! Quote
The Buzzard Posted June 4, 2010 Posted June 4, 2010 Tankman, Maybe you will invent something new that way and become rich and famous. Quote
The Buzzard Posted June 4, 2010 Posted June 4, 2010 Buzzard, What's this huge favor that you did to me, it is really undescripable and unaffordable to be return back one day. I can not find the right words to thank you for your hard work on the Elb.lsp file with all these specifications and descriptions with every line as well. I feel speachless about your marvellous and precious work that you did for me, And you have shorten my long way into Autolisp World too much. Thank you again and again Mr. Buzzard Your Sincerely Tharwat Tharwat, That was no problem. I just want you to get something from this experience. Someday you may return the favor to someone else. That is what makes this site what it is. Quote
Tankman Posted June 4, 2010 Posted June 4, 2010 Tankman, Maybe you will invent something new that way and become rich and famous. And right now aliens from Jupiter are having Woody Allen's (corned beef, hot pastrami, Jewish rye, deli mustard) at the Carnegie Deli on 7th Ave. :wink: Quote
The Buzzard Posted June 4, 2010 Posted June 4, 2010 And right now aliens from Jupiter are having Woody Allen's (corned beef, hot pastrami, Jewish rye, deli mustard) at the Carnegie Deli on 7th Ave. :wink: So you are using the program to make Woody Allen sandwiches for an alien restaurant you are starting? Quote
Tankman Posted June 4, 2010 Posted June 4, 2010 So you are using the program to make Woody Allen sandwiches for an alien restaurant you are starting? Well, I'm not. But a Woody Allen sandwich would go down the gullet very nicely 'bout now! Just had a few Manhattans, oysters (half-shell), back home. Geeezzzee, need more freezy cold Long Island Sound oysters. Back out to the sports bar, more oysters with horse radish, perhaps a crab cake for dessert. :wink: Quote
Tharwat Posted June 5, 2010 Author Posted June 5, 2010 Mr.Buzzard. Definitely I will do my best to give it back as best as I can. I have noticed in most of Autolisp files and yours as well changing from degrees to radians and sometimes radians to degrees. so what is the benefit of that conversion since AutoCAD dealing with degrees and we can depend on it alone. Besides that, Polar Function could understand angles in degrees. With all my respects. Tharwat Quote
The Buzzard Posted June 5, 2010 Posted June 5, 2010 Mr.Buzzard. Definitely I will do my best to give it back as best as I can. I have noticed in most of Autolisp files and yours as well changing from degrees to radians and sometimes radians to degrees. so what is the benefit of that conversion since AutoCAD dealing with degrees and we can depend on it alone. Besides that, Polar Function could understand angles in degrees. With all my respects. Tharwat Hi Tharwat, Because AutoCAD can only interpret angles in radians. For you or myself to interpret angles, We would rather do them in terms of degrees. It is much easier for you to direct the line work in degrees and convert that information to radians so AutoCAD knows what to do with it. Quote
The Buzzard Posted June 5, 2010 Posted June 5, 2010 Tharwat, Just to clarify my previous statement, When you use any command in AutoCAD that requires angular input, Of course we will supply it in degrees, However AutoCAD cannot use that information as is and internally converts that information to radians so it can proceed to finish out the command. Its just one of those things you cannot see until you start learning to program lisp for AutoCAD. When writing lisp we can supply all angular input in radians or to make it easier on ourselves, Supply it in degrees and then convert to radians in the same manner as AutoCAD does. I hope that clears some things up concerning angles. Quote
Tharwat Posted June 5, 2010 Author Posted June 5, 2010 Hi Mr.Buzzard, Thank you for your clarification tow times. I have not thought all over 9 years in dealing with AutoCAD that it is manipulating with me, for example when AutoCAD asking for user input and behaving something else in the background. (just for laugh) Thats great and strong informations to depend on with angular inputs. Many Thanks. Tharwat Quote
The Buzzard Posted June 5, 2010 Posted June 5, 2010 Hi Mr.Buzzard, Thank you for your clarification tow times. I have not thought all over 9 years in dealing with AutoCAD that it is manipulating with me, for example when AutoCAD asking for user input and behaving something else in the background. (just for laugh) Thats great and strong informations to depend on with angular inputs. Many Thanks. Tharwat I got a chuckle from that. But true, There is so much we can learn about AutoCAD through programming. We are kind of blind to that fact that it works kind of different behind our back. Quote
Tharwat Posted June 6, 2010 Author Posted June 6, 2010 Hello Mr.Buzzard, I have wrote tow different Autolisp files that are dealing with our main issue which is (polar function) and here they are attached - downstairs - within this Message. So which one of them is the perfect Autolisp file that dealing with polar although, both of them are giving the same result withno mistakes. May I know your opinion about them please? with all my respects. Tharwat bracket1.lsp bracket2.LSP 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.