Jump to content

equally spaced holes around a triangle


Danfun87

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • Danfun87

    11

  • neophoible

    4

  • Tharwat

    3

  • SLW210

    2

Top Posters In This Topic

Posted Images

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.

Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

(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)

)

Link to comment
Share on other sites

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 by Danfun87
Link to comment
Share on other sites

(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?

Link to comment
Share on other sites


(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 by fabriciorby
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...