-------------------ACAD newsletter--------------------- Newsletter about AutoCAD and AutoLISP ------------------------------------------------------- Vol 1, No 3 March 2001 ------------------------------------------------------- --------------------------- Welcome to ACAD Newsletter! --------------------------- Greetings from Malaysia! At last. The rainy season is over. It started last year in November. Then, in December and in January we had a lot of rain. Talking about rain I'm not talking about a drizzle. A lot of water came down, every day. It was raining for at least one hour. Sometimes it was raining a whole afternoon. Or a whole night. That has happened. There is a sewage system. But that cannot handle the rain that comes down. There were all the time a lot of puddles in the road. They could be very deep. They could be so deep that cars couldn't pass them. The beginning of December I was in the South of Thailand. I wanted to travel by train from the border to Hat Yai. But there were no trains that day. I had been raining for two days in a row. The track was flooded. The water must have been very high. The train couldn't pass . The rainy season has a big advantage. There is no sun and it's not hot. If you're outside the house you're not sweating right away. Yes, people. Life is hard in Malaysia. Especially for a Westerner living here. Still I keep on going. No rain, no sun is getting me down. ------------------------------------------------- For best viewing maximize the window to full size ------------------------------------------------- In this issue we have prepared for you.... 1. Top Sponsor Section 2. Notes from the Editor. 3. Creating 3D solids 4. AutoLISP Program for Drawing Blanks - Part 3 5. Feedback 6. Privacy Policy, Legal Stuff and Advertising Info 7. Contact Information ---------------------- 1. Top Sponsor Section ---------------------- Are they still nuts? Yes. They're even nutter now. There was the 5-for-1 action. That action has been skipped. It's now the 3-for-1 action. All subscribers of the ACAD Newsletter can participate. If they find three new subscribers they can get an AutoCAD book for FREE. Maybe you find friends who are interested in AutoCAD and AutoLISP. Maybe you know people working with AutoCAD. Tell them about the ACAD Newsletter. Ask them to subscribe to the newsletter. You know how that's done. With a blank e-mail to: mailto:acadnewsletter-subscribe@topica.com Sure. You could also go to your closest Internet contacts. Go to your address book and send them an e- mail telling them about the ACAD Newsletter. This is how it works. Let the people you know subscribe to the ACAD newsletter. They do that in the normal way by sending an e-mail to: mailto:acadnewsletter-subscribe@topica.com Send an e-mail to the publisher of the ACAD newsletter and let him know the people that subscribed to the ACAD newsletter. He can be reached at: mailto:josvandoorn@zwallet.com Also let the editor know what AutoCAD e-book you would like to receive. These are the available titles: - Autocad 14 - Base Course - Autocad 14 - 3D Course - Autocad 2000 - Base Course - Autocad 2000 and Databases Course - Autocad Dialog Boxes Course - Autolisp Course -------------------- 2. Publisher's Notes: -------------------- Welcome old subscribers. And welcome new subscribers. We're getting a lot of new subscribers. So we must not forget them. First things first. We have had a mutation. Erik no longer is editor of the ACAD Newsletter. He's too busy with his studies. We're looking for a new editor. Erik is very much in AutoCAD. I hope the new editor too. He can do the writing about AutoCAD. Is somebody interested in becoming the editor for the ACAD Newsletter? Do you know somebody who might be interested? If so please let me know. I hope you like this newsletter. Please take a minute and forward this to a friend. Go to your e-mail program and have a look at your address book. You'll find a lot of AutoCAD and AutoLISP stuff. You'll find stuff about drawing in 3D. The BLANK program part III is there. We had a lot of feedback this month. Look at the first e-mail we received from Eric. He was really p..... off. If you know what I mean. Eric wanted a complete listing of the BLANK program. It wasn't in the last ACAD Newsletter. He was upset about it. But everything is OK now. See our answer. Maybe you want to read about other subjects. Feel free to send us an email. Just tell us about what subject you want to read. And we'll make an article about it. We're doing AutoLISP programs. But maybe there are programs you want. Just let's know and we'll start working on them. We can make the program that you want. Of course we'll publish that program in the ACAD Newsletter. We'll give an explanation about the program. Also we're thinking of moving to a bi-weekly schedule meaning you'll get an issue once every two week.. Any drawbacks on this? Let me know... Jos ******************************************************* Advertise_Online is a weekly ezine dedicated to keeping you abreast of the hottest tips, tools, techniques and trends for building and marketing your online business. Keep ahead of your competition...subscribe FREE today! mailto:advertise_online-subscribe@egroups.com Or visit our home site: http://www.powerpromoplus.com ******************************************************* FREE FUN DELIVERED TO YOUR MAILBOX! * Jokes <--- * News <--- * Computers! <--- * Quotes <--- * Recipes <--- * Books! <--- * Riddles <--- * Freebies <--- * Crafts! <--- * Cartoons <--- * Business <--- * Work @ home!<--- Fresh FREE Newsletters on these topics and others only @ FunEzines.com! It's Free Fun and Addictive it FunEzines.com! Visit: http://www.funezines.com/index.cgi?referrer=josvan ******************************************************* --------------------- 3. Creating 3D solids --------------------- There are two ways to create a 3D solid. First I explain the way which uses polyline and the EXTRUDE command. Start your drawing by creating a 2D polyline-figure. Type PLINE at the command prompt or go to DRAW on the menu bar and POLYLINE on the pull-down menu. Make sure the figure is closed otherwise the extrude command won't work. The following prompt is then displayed: Unable to extrude the selected object. After the 2D figure has been drawn select the extrude command. Type EXTRUDE at the command prompt. You can also go to DRAW on the menu bar. On the pull-down menu is clicked on SOLIDS. A pop-up menu appears. On the pop-up menu click on EXTRUDE to get the extrude command started. After you have invoked the EXTRUDE command the following prompts are displayed: 1. Select objects: 2. Specify height of extrusion or [Path]: 3. Specify angle of taper for extrusion <0>: At the first prompt the 2D polyline-figure is selected. If necessary other 2D polyline-figures are selected to continue. Press ESC or right click to terminate selection. The height of extrusion is entered at the second prompt. Press ENTER after entering the height. The angle of taper for extrusion is entered at the third prompt. The default value is 0. The solid is created under the degrees that are entered here. At the second prompt you can also select to enter a path. Then P is entered at the prompt. The following prompt is displayed: Select extrusion path: A line can be selected as the extrusion path. The start point and the endpoint of the line must have different Z values. Also an arc could be selected as a path. But again the Z value of the starting point and the ending point must be different. The taper of the 3D figure is determined by the angle of the line. After selecting a line for the path no taper can be entered. This is an interesting technique. It's a technique that can be used to turn a 2D drawing into a 3D drawing. Turn lines into polylines and .. Use the 3D orbit command to view the result. Type 3DORBIT at the command prompt or go to VIEW on the menu bar and 3D ORBIT on the pull-down menu. The 3D solid can now be moved. Press the left mouse button and hold it down. Move the cursor. The 3D solid moves. You can also right click. A shortcut-menu is displayed then. Go to PRESET VIEWS and select SW ISOMETRICS on the new shortcut-menu. To end the 3D ORBIT command the ESC key or the ENTER key is pressed. You can also select EXIT on the shortcut menu. What you now have seen is a method of making a solid out of a 2D drawing with lines. Important is that all lines are closed. The PEDIT command is used to turn the lines into a POLYLINE. With the EXTRUDE command a height and an angle of taper can be entered. Circles are not turned into a POLYLINE. The EXTRUDE command can directly be used on circles. They are turned in solids right away. The 3DORBIT command is an AutoCAD 2000 command. AutoCAD 14 doesn't have that command. There go to VUEW in the menu bar and 3D VIEWPOINT on the pull-down menu. The other way to create solid models is a lot faster if you need to create a solid made on basic figures (box, sphere, wedge, etc.). There are about 6 basic figures but I will explain only box and sphere because using the other figures is almost the same. To create a box go to DRAW on the menu bar and SOLIDS on the pull-down menu. Click on BOX on the pop-up menu. After you have selected BOX the following prompts are displayed: 1. Specify corner point of box: 2. Specify length of box: 3. Specify width of box or [Cube]: 4. Specify height of box: 5. Specify rotation angle of box about the Z axis: At the first prompt the corner of the box is selected. The length, the width, and the height of the box is specified at the second, the third, and the fourth prompt. The rotation angle about the Z axis is specified at the fifth prompt. If you want to create a cube enter C at the third prompt. You know what a cube is? A cube has the same length, width, and height. To create a sphere go to DRAW on the menu bar and SOLIDS on the pull-down menu. Click on SPHERE on the pop-up menu After you have selected the sphere the following prompts are displayed: 1. Specify center point of sphere: 2. Specify radius of sphere or [Diameter]: 3. Enter number of longitudinal segments for surface of sphere <16>: 4. Enter number of latitudinal segments for surface of sphere <16>: The center point of the sphere is specified at the first prompt. The radius of the sphere is specified at the second prompt. To specify the diameter of the sphere D is entered at this prompt. The number of longitudinal segments for surface of the sphere can be entered at the third prompt. The default value is 16. The ENTER key is pressed to accept the default value. The same goes for the latitudinal segments for surface of the sphere. Again the default value is 16. In the following newsletters much more about solid modeling. ******************************************************* * Writer of this article is Erik Slingerland. He is * * a civil engineering student at a college in The * * Hague, The Netherlands. He was editor of the ACAD * * ACAD newsletter. To contact Erik: * * * * mailto:ecs@dds.nl * * * * To subscribe for free to the ACAD newsletter: * * * * mailto:acadnewsletter-subscribe@topica.com * ******************************************************* ******************************************************* HIGHEST PAYOUT OF ANY AFFILIATE PROGRAM FOR EZINES! *** Get up to 8$ for Each Visitor! *** Get 3$ for each affiliate you refer + 10% for life! *** Get HUGE monthly bonuses just for performing! FunEzines.com is paying you all that and MUCH more! For more information and to join us for free visit: http://www.funezines.com/affiliates_signup.cgi?referrer =josvan ******************************************************* Get paid to surf. Easy money. Join now. Visit: http://www.quickprofitclub.com/joinform.asp?ID=7852 ******************************************************* ----------------------------------------------- 4. AutoLISP Program for Drawing Blanks - Part 3 ----------------------------------------------- In the layer function the name of the layer on which the blanks are to be drawn is entered. If the layer exists it's set. Otherwise the layer is created and set. This is the listing of the layer function: (defun setla (/ ct la) (setq ct T) (while ct (setq la (getstring "\Layer: ")) (if (= la "") (progn (setq ct T) (princ "\nEnter layer name!") ) (setq ct nil) ) ) (if (tblsearch "layer" la) (command "layer" "s" la "") (command "layer" "m" la "C" "1" "" "") ) ) The function starts with the use of the dummy variable CT. That variable is used for the WHILE function. As long as the value of that variable is T or true a loop is created. In the WHILE function a name of the layer is entered. The IF function checks whether a layer name is entered. If not then "Enter layer name" is displayed at the command prompt. If a layer name is entered then the variable CT gets the value NIL. The loop of the WHILE function terminates. And the existence of the layer can be checked. The existence of the layer is checked by the TBLSEARCH function. The function looks for the layer in the layer table. If found a list is returned by the function. If a list is returned then the first line in the IF function is executed. In that line the LAYER command is invoked and the entered layer is set. All blanks will be drawn on that layer. If the layer is not found then NIL is returned by the TBLSEARCH function. The second line in the IF function is then executed. Again the layer command is invoked. In the second line the LAYER command creates a layer with the given name. The layer is automatically set. There's no need to set the layer after creating it. When the function has been executed command is returned to the main program. The draw blank function is executed and a blank is drawn. **************************************************** * Writer of this article is Jos van Doorn. He is * * an AutoCAD specialist, AutoLISP programmer and * * ACAD newsletter publisher. The newsletter is * * for people who want to learn more about AutoCAD * * and AutoLISP. It's FREE. To subscribe: * * * * mailto:acadnewsletter-subscribe@topica.com * * * * He has written six AutoCAD books. Interested in * * the books. Let him know. Send an e-mail to: * * * * mailto:josvandoorn@zwallet.com * **************************************************** ******************************************************* Earn a dime every time you receive email! Sign up FREE at: http://www.MintMail.com/?m=156987 ******************************************************* Free Internet Business Training gives you lots of easy-to-understand online marketing tips, tricks and techniques that you can use to start or build your Internet business. Go to: http://NicholsOnline.com/team/2160 Hurry! ******************************************************* ---------------------------------------------------- 5. Feedback ---------------------------------------------------- We received an e-mail from Eric Boehlke. This is what he wrote: At 07:55 PM 1/31/2001, you wrote: (defun c:bl (/ p1 tx) (setvar "cmdecho" 0) (setla) (while (setq p1 (getpoint "\nFirst point: ")) (setq tx (getstring T "\nText blank: ")) (drwbl p1 tx) (setvar "cmdecho" 1) (princ) ) Dear Jos, Where the fuck are the setla & drwbl defined? Why are you teaching a AutoLISP program that will not work by itself? The newsletter is looking good but be careful. Eric This our reply: Dear Eric, The SETLA function will be shown in the third issue of the newsletter. The FRWBL function can be found in the fourth issue of the newsletter. You're in a hurry. Have I got news for you. The complete listing is on: mailto:acad_newsletter@getresponse.com Jos Note: The complete listing of the BLANK program can be found on an autoresponder. The e-mail address of the autoresponder is mentioned in the answer to Eric. We thought of mentioning this when we're publishing the last part of the BLANK program. Maybe that wasn't wise. Mea cupa. Mea cupa. Mea maxima cupa. After our reply Eric send us an other e-mail. This time it was a program he made for one of his customers. His e-mail reads: Dear Jos, I had some client's DWGs that has lots of text with an extra space at the end (like "ABC "). Here's what I wrote. You may publish and explain this. Maybe how to modify it to change all TEXTs to uppercase with strcase, etc. Eric In his e-mail Eric gave the listing of the program he wrote. It was a long and extensive program. And it did what he said it would do. This time we gave Eric a much longer reply. We had a look at the program he gave us. And we made some changes. We wrote it new. This is our reply: Look what I found. I had a good look at your program. But first I've put it into the VLISP editor. I did some tabbing. This came out: ;;;By Eric Boehlke ;;;removes trailing space from all TEXTs (defun dxf (code elist) ;finds the association pair, ;strips 1st element (cdr (assoc code elist)) ) ;defun (defun c:stripspace (/ newst txtset total test ename alist test next oldtxt len ) (defun update (which) (setq alist (subst (cons which newst) (assoc which alist) alist)) (entmod alist) ; (entupd ename) ;add if you don't want to regen ;after (setq test (1+ test) ename (ssname txtset test) ) (if ename (setq alist (entget ename)))) (prompt "\nRemoving trailing space from all TEXTs...\n") (if (setq txtset (ssget "X" (list (cons 0 "TEXT") (cons 1 "* ")))) (progn (setq total (sslength txtset) test 0 ename (ssname txtset 0) alist (entget ename) ) (while (< test total) (setq oldtxt (dxf 1 alist) len (strlen oldtxt) newst (substr oldtxt 1 (1- len)) ) (update 1) (prompt (strcat "'" oldtxt "', ") ) ) ) (prompt "\nNo text needed fixed.") ) (princ) ) Your program works fine as long as there is only one space at the end of a text. If there are more then these are not affected. I think the program would be better if all spaces at the end would have been removed. Then you would have a general purpose program. Another thing. I found your program very complicated. Why is there a DEFUN statement in a DEFUN statement? I made some changes. Look at the program I made. Isn't it very simple? And it works perfectly. It removes all the spaces at the end of a text. (defun c:strip () (setq ss (ssget "X" (list (cons 0 "TEXT"))) ct 0 ) (if ss (while (setq et (ssname ss ct)) (setq el (entget et) tx (cdr (assoc 1 el)) ) (princ tx) (terpri) (setq ln (strlen tx)) (while (= (substr tx ln) " ") (setq tx (substr tx 1 (1- ln)) ln (1- ln) ) ) (setq el (subst (cons 1 tx) (assoc 1 el) el)) (entmod el) (setq ct (1+ ct)) ) ) (princ) ) One more thing. That's the naming of the variables. I talk about it in one of the future ACAD Newsletters. I never use a name longer than two characters. Still I want to thank you for your contribution to the newsletter. I can use it for a further explanation of AutoLISP. You gave me a good idea. Jos ---------------------------------------------------- 6. Privacy policy, Advertising Info, and Legal Stuff ---------------------------------------------------- This newsletter is only sent on request. Our list of subscribers is strictly confidential. That means that your details have never been and never will be passed on to any third party. Your privacy is greatly respected. Should you ever wish to unsubscribe, full instructions are always provided. To subscribe: mailto:acadnewsletter-subscribe@topica.com To unsubscribe: mailto:acadnewsletter-unsubscribe@topica.com Previous issues of the newsletter can be seen at: http://www.topica.com/lists/acadnewsletter/read But you must first register with Topica. Advertising info: If you wish to advertise in this newsletter, you shouldn't wait a second longer. Ad rates now are the lowest for the season. The ad rates are: Top sponsor message: 10$ per issue Ad in the sponsors section: 5$ per issue Exclusive sponsor mailing: 35$ per mailing The ad guidelines are: Ads have to be up to 8 lines including a URL and a mail to tag. Each line can have up to 60 chars. Exclusive mailing can have up to 75 lines 60 chars per line. Legal stuff: ACAD newsletter publishes original content and tips that are distributed by readers. ALL of our articles are original and copyrighted 2001 and on by Jos van Doorn and any other contributing publishers. If you wish to publish any of the content here in your newsletter please contact Jos van Doorn at mailto:josvandoorn@zwallet.com He's the editor of this newsletter. Reprinting or reproducing this newsletter can be done only if you keep it all together. You may NOT reproduce any part of this newsletter in a way without a written permission from the list owner. The signatures are to be kept intact. ------------------------------------------------------- Disclaimer: ACAD newsletter accepts no responsibility whatsoever for the content or legality of any customer's advertisement shown in any e-mailing. It is the advertisers' responsibility to check and abide by the Local, State, Federal and International laws pertaining to the products, services or business opportunities they advertise, as well as all laws pertaining to the products, services and/or business opportunities promotions. All offers in this publication, are void where prohibited by law! ---------------------------------------------------- 7. Contact Information ---------------------------------------------------- ----------------josvandoorn@zwallet.com---------------- Jos van Doorn - publisher ACAD newsletter Jalan Watan 12 CA-4-24 68000 Bandar Baru Ampang Malaysia (03) 42706214 ------------------------------------------------------- -- Jos N. van Doorn. AutoCAD specialist, AutoLISP programmer. Also publisher of ACAD newsletter. Subscribe for FREE. To subscribe to ACAD Newsletter: mailto:acadnewsletter-subscribe@topica.com ______________________________________________________ Get Paid... With Your Free Email at http://www.zwallet.com/index.html?user=josvandoorn