Danfun87 Posted April 9, 2013 Share Posted April 9, 2013 Hi, can anyone help me write a program for autolisp that can draw equally spaced holes on a triangle that has points defined as h7, h8 and h9? any help will be much appreciated. thanks Quote Link to comment Share on other sites More sharing options...
SLW210 Posted April 9, 2013 Share Posted April 9, 2013 I moved your thread to the AutoLISP, Visual LISP & DCL forum. Please only post your question once. I deleted your duplicate thread. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 9, 2013 Share Posted April 9, 2013 Can you please be more specific to the point that you are after ? Quote Link to comment Share on other sites More sharing options...
Danfun87 Posted April 9, 2013 Author Share Posted April 9, 2013 hi tharwat, Ive designed a triangular shaped gasket and in the centre I have a triangle made from construction lines. I now want holes on these construction lines equally spaced and the diameter of each hole to be half the wall thickness of the gasket defined as w. the three points of the triangle are h7, h8 and h9. I can find information about doing this with a circular shaped gasket, but not a triangular one. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 9, 2013 Share Posted April 9, 2013 Can you upload a sample drawing showing your goal of the routine ? Quote Link to comment Share on other sites More sharing options...
Danfun87 Posted April 9, 2013 Author Share Posted April 9, 2013 here is an image of what the gasket is like at the moment, its the middle triangle i want holes on. thanks Quote Link to comment Share on other sites More sharing options...
Danfun87 Posted April 9, 2013 Author Share Posted April 9, 2013 i want the number of bolt holes per side to be user defined also Quote Link to comment Share on other sites More sharing options...
neophoible Posted April 9, 2013 Share Posted April 9, 2013 Hi, can anyone help me write a program for autolisp that can draw equally spaced holes on a triangle that has points defined as h7, h8 and h9? any help will be much appreciated.thanks How much help will you need? Have you already written a portion of the program? Perhaps you should post your progress thus far. Just what do the h#'s mean? Are they variables in your program? Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 10, 2013 Share Posted April 10, 2013 You may use the code from this previous thread to start from - it draws a gasket with 4 sides, but you can modify it to work with 3 as per your case. The OP had removed his/her files, but please check on second page that there is a fully commented version of it. Quote Link to comment Share on other sites More sharing options...
Danfun87 Posted April 10, 2013 Author Share Posted April 10, 2013 Thanks for your replies, the h's are variables yes and are points of the triangle i want the holes on, so far I only have written the code to make the triangles to a user defined size. how do you start a code for holes on a line? the previous link I looked at is similar. but what portion of this code is to do with the holes on a line? Quote Link to comment Share on other sites More sharing options...
Danfun87 Posted April 10, 2013 Author Share Posted April 10, 2013 (command "xline" h7 h8 h9 "") (command "xline" h9 h8 "") (setq numhole (getint " Enter number of bolt holes per side "));get number of bolt holes per side and save as "numhole" (setq holedia (* w 0.5)) ; Computes hole diameter at 50% of wallthickness and saves as holedia (terpri) ) Quote Link to comment Share on other sites More sharing options...
Danfun87 Posted April 10, 2013 Author Share Posted April 10, 2013 (edited) this is the end of the code for the gasket and now im trying to add a hole pattern on the xlines. i think maybe its a rectangular array i need Edited April 10, 2013 by Danfun87 Quote Link to comment Share on other sites More sharing options...
Danfun87 Posted April 10, 2013 Author Share Posted April 10, 2013 (setq numhole (getint " Enter number of bolt holes per side ")) (setq holedia (* w 0.5)) ; Computes hole diameter at 50% of wallthickness (terpri) (insert_hole_pattern numhole holedia L4); holes on L4, length of line h7 to h8 (princ) ) (defun insert_hole_pattern (numhole holediam L4 / count spacing)) (setq spacing (/ L4 numhole)) (setq count '1) (repeat number ; setup a loop for each hole (setq centre (polar origin (* count spacing) L4)); compute centre of new hole (command "circle" centre (/ diam 2)) ; create circle at this centre (setq count (1+ count)) ; increment counter for next hole ) Im getting a bad syntax error on this, im I heading in the right direction? Quote Link to comment Share on other sites More sharing options...
SLW210 Posted April 10, 2013 Share Posted April 10, 2013 Please read the CODE POSTING GUIDELINES and place your Code in Code Tags. Quote Link to comment Share on other sites More sharing options...
fabriciorby Posted April 10, 2013 Share Posted April 10, 2013 (edited) (setq numhole (getint " Enter number of bolt holes per side ")) (setq holedia (* w 0.5)) ; Computes hole diameter at 50% of wallthickness (terpri) (insert_hole_pattern numhole holedia L4); holes on L4, length of line h7 to h8 (princ) [color="red"]) ;where is this ")" from?[/color] (defun insert_hole_pattern (numhole holediam L4 / count spacing) [color="red"];take a look at your parentheses[/color] (setq spacing (/ L4 numhole)) (setq count [color="red"]1[/color])[color="red"] ;change here[/color] (repeat [i][color="red"]number[/color][/i] [color="red"] ; what number is this?[/color] (setq centre (polar [color="red"]origin[/color] (* count spacing) L4))[color="red"]; you need to get this point origin[/color] (command "circle" centre (/ diam 2)) ; create circle at this centre (setq count ([b][color="red"][u]+ 1[/u][/color][/b] count)) [color="red"]; be careful[/color] ) [color="red"])[/color] [color="lime"];add here[/color] Edited April 10, 2013 by fabriciorby Quote Link to comment Share on other sites More sharing options...
Danfun87 Posted April 12, 2013 Author Share Posted April 12, 2013 thanks fabricorby, I have managed to get circles on the line but in the wrong axis. do you know of a code that I can use for each line of the triangle to get equally spaced holes, between the two points of the line? Quote Link to comment Share on other sites More sharing options...
fabriciorby Posted April 12, 2013 Share Posted April 12, 2013 thanks fabricorby,I have managed to get circles on the line but in the wrong axis. do you know of a code that I can use for each line of the triangle to get equally spaced holes, between the two points of the line? I couldn't understand very well, could you please take a screenshot of the result you want? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 13, 2013 Share Posted April 13, 2013 Is not it the same thread with THIS ? Quote Link to comment Share on other sites More sharing options...
Danfun87 Posted April 13, 2013 Author Share Posted April 13, 2013 Yes, must be a guy from my class, thanks. I will try inputting the code into my program Quote Link to comment Share on other sites More sharing options...
neophoible Posted April 15, 2013 Share Posted April 15, 2013 From your program thus far, it appears you can figure out how to find the points to draw the inner and outer triangles. As you have shown, the holes are along a triangle as well. All you have to do is divide the side length of this third (middle) triangle by the number of holes along a side minus one to get your distances to the intermediate points. Be sure to subtract one, because the number of spaces is one less than the number of holes along a side. NOTE: You should go back and format your previously listed code. See SLW210's request in post #14. It makes it easier to read code. Of course, some indenting would help, too. Quote Link to comment Share on other sites More sharing options...
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.