I am creating stiffeners for a bridge deck - I do this by:
divide curve - edge of deck
project points - across deck to other edge
simple line - a to b
When one of these is within a tolerance of the crank (one side of the deck splays out at each end) I require this to be at the crank (and not its current position).
When this is above the tolerance I need both stiffeners.
I can tackle this but I can only see a very clumsy, untidy way of doing. Can anyone suggest a smart way of doing this? (attached image should help if question isn’t clear)
edit: I think drawing the line at the crank, running a check against the rest of the stiffeners to find the nearest stiffener (min delta X value), eval x < tol, true: remove item index from (can’t think of this component) false: nothing
I managed to do it using distance and then evaluate. This provided a data tree with two lists (I was running two check points through the list). Then I added these to give (0,0,0…1,0,0) as an input for sift pattern.
Rather than creating curves first, then checking if end points are within a tolerance to another point, you’d be better off thinking about it in reverse order. If you start with your end conditions in mind (no additional lines within 300mm of a line at a crank) you can start off by plotting points at the cranks, then generating your series of additional points, checking which ones are within your tolerance, and culling those points. Merge your culled list with your list of crank points and you’ve got the final list of points you want. All you need do the is use these points to generate lines between the two edge curves at these points:
You can also do this another way. The above method will give you evenly spaced stiffeners along the full length of your bridge, which is then interrupted by the stiffeners at the cranks. Instead, in my second method, I’ve found the crank points, then found how many points in between adjacent crank points I’d want to give me evenly spaced stiffeners. I then generate that many points evenly spaced, and use those to generate the lines. That way I get a much more even stiffener distribution:
A few general points for you:
Don’t hide all your wires, it makes it a nightmare to follow what you’re doing. If you find the wires make it messy, that’s probably a sign you have too many wires i.e. (components) and the logic is a little cluttered than the wires themselves are the issue.
On that note, you have a lot of repetition, which I think is largely down to the fact that you’re only using lists and not data trees. Since you’re designing a bridge here I’m going to guess you’re a structural engineer (as am I). Data trees are your best friend for scripts used in structural design as there is quite often lots of relatively simple repetition. Once you crack data trees your scripts will improve massively.
My solution actually does what you described. Essentially make a list of the end points - cull those within tolerance - project across the deck - draw lines. I culled pts using sift pattern.
Thanks a lot for the 2nd solution - that is quite elegant.
I have a macro component with a toggle for wire - so I can flick between a state globally across the script. Its on the far left of my canvas.
Yes - my first gh script so you may notice some areas for improvement. I didn’t aim for the minimal number of components, rather something I can understand how its working wherever I am. . As I have gained an understanding of data trees I have really come to appreciate them - a long way to go though still. I will keep you comments in mind in future.