Hatch tolerance Dynamo

Hi All,

Thank you for the last inputs to the Dynamo script, want to thank you once again!

The case:

Last time I found some limitations in the Dynamo. I am trying to find a function that allows me to change the tolerance for the hatch gap in the Dynamo, then the export hatched areas to excel and manage values.

The Dynamo hatch block uses only the boundary options without the possibility to edit/adjust tolerance (hatch.ByGeometry or hatch.ByObject)
image

.
Maybe someone met that small issue before and found the solution?
Please see the small pic below:

I will be more than happy if we can find the solution!

Thanks in advance,

Cheers!
Adam

My only thoughts would be to convert the polycurves to verticies with pretty tight spacing and then creating a closed curve by using a minimum distance between points, lines between points, and closing them into a curve, kind of similar to how the code works in the popular “groupCurves” function works in archi-lab:

#join/group curves function
def groupCurves(Line_List): 
	ignore_distance = 0.1 # Assume points this close or closer to each other are touching 
	Grouped_Lines = [] 
	Queue = set() 
	while Line_List: 
		Shape = [] 
		Queue.add(Line_List.pop()) # Move a line from the Line_List to our queue 
		while Queue: 
			Current_Line = Queue.pop() 
			Shape.append(Current_Line) 
			for Potential_Match in Line_List: 
				Points = (Potential_Match.StartPoint, Potential_Match.EndPoint)
				for P1 in Points: 
					for P2 in (Current_Line.StartPoint, Current_Line.EndPoint): 
						distance = P1.DistanceTo(P2) 
						if distance <= ignore_distance: 
							Queue.add(Potential_Match) 
			Line_List = [item for item in Line_List if item not in Queue]
		Grouped_Lines.append(Shape) 
	return Grouped_Lines

OUT = groupCurves(inputCurves)

Creating code that would create a best fit hatch without a closed curve is a difficult thing to do. But probably possible. It looks like you can set a gap tolerance directly in AutoCAD.

This Mesh Toolkit looks really promising. I may try playing with it to see if it can provide a solution.
Dynamo Mesh Toolkit

3 Likes