# Automate Better Washer Creation

## Recommended Posts

Many of the parts that I mesh contain a significant number of bolt holes. In order to make the highest quality mesh possible, I have found that it is far better to imprint a square around the hole rather than a circle. This square (with a hole in the middle) gets divided into four sections. The number of elements along each edge depends on the size of the hole, but for most of the holes I am dealing with, I can use two elements along the edge of the hole (making for 8 elements total around the hole), two elements on the "spokes" between the edge of the hole and the edge of the square, and three elements on each half of the edges of the square. As can be seen in the images below (associated model can be found here: Washer Mesh Comparison.hm), this allows for a mesh of far higher quality than a simple washer permits.

The obvious downside is that it is much more tedious to produce. Therefore, I would very much like to find a means of automating this procedure. As such, I have the following questions:

1. Is anyone aware of something that has already been written to do this so I don't have to write it myself?
2. Given a line ID, is it possible to identify the planar surface associated with it? (Note: I want to distinctly identify the planar surface and not the cylindrical surface since I don't care about the cylindrical surface.)
3. Given a surface ID, is it possible to get a list of lines that define the boundaries of that surface?
4. Given two line IDs, is it possible to get the shortest distance between the two lines?
5. Given two line IDs, is it possible to split the first line at the point nearest to the second line?

I am fairly comfortable in TCL at this point, so that isn't an issue. Also, I'm well aware that doing things like determining the shortest distance between a circle and a straight line are relatively straightforward geometry calculations, but I'm primarily asking if there are built in functions to accomplish these things so I don't have to write the code myself.

Sorry for all the questions, but if you can answer just one of them, I'd greatly appreciate it. Thanks!

##### Share on other sites

I have a proc to generate that mesh pattern, but you have to input center node and 2 nodes on circle to orient the mesh (not automatic).

2 => it is possible (from previous versions you can use hm_getplanarface but from v13 maybe you have to compare surface's normal at some positions)

3 => hm_getsurfaceloops

4 => hm_getclosestpointsbetweentwolines

5 => once you get closest point, use *linesplitatpoint

##### Share on other sites
10 hours ago, tinh said:

I have a proc to generate that mesh pattern, but you have to input center node and 2 nodes on circle to orient the mesh (not automatic).

Nice! I'd be interested to see your proc, if you don't mind sharing. My approach to automating the process may be making too many assumptions about the orientation for the surface splits that I would normally create, and even if I'm not, it would certainly be useful for generating the pattern after I figure out the orientation.

11 hours ago, tinh said:

2 => it is possible (from previous versions you can use hm_getplanarface but from v13 maybe you have to compare surface's normal at some positions)

3 => hm_getsurfaceloops﻿﻿

4 => hm_getclosestpointsbetweentwolines﻿﻿

5 => once you get closest point, use *linesplitatpoint﻿﻿﻿

When I do a search for hm_getsurfaceloops﻿﻿, nothing is returned (from either Altair's help documentation or from Google). This causes me to think that there was a typo of some kind, but searching for both "hm_getsurface" and for "loop" in Altair's help documentation didn't return anything that looks like it would accomplish what I'm looking for. Could you clarify what function you were referring to?

##### Share on other sites

I am sorry, the command is "hm_getsurfaceedges"

This is proc to create 12-elem pattern, suppose you have Nodeid1 as center, Nodeid2 and Nodeid3 as 2 nodes on circle, then invoke the proc as follow

p_Create12ElemWasher \$Nodeid1 \$Nodeid2 \$Nodeid3

mesh flow will be oriented by Nodeid1-Nodeid2

##### Share on other sites
9 hours ago, tinh said:

I am sorry, the command is "hm_getsurfaceedges﻿"

This is proc to create 12-elem pattern, suppose you have Nodeid1 as center, Nodeid2 and Nodeid3 as 2 nodes on circle, then invoke the proc as follow

p_Create12ElemWasher \$Nodeid1 \$Nodeid2 \$Nodeid3

mesh flow will be oriented by Nodeid1-Nodeid2

Ah! That works.

Thanks for the script! I'm sure it will be very helpful.

tinh likes this