Trim Multiple Breps

Hi all,

For my graduation I’m making a truss generating script. The topology optimization is nicely done by several plugins, but making the details is something I have to script myself.

Anyway, the problem I have, is that I have a line-structure, along which I extrude some sections to create a realistic looking truss (see fig. 1). The problem is that at the intersection of the lines, the sections intersect as well creating a mess (see fig. 2).

It has been easy enough to trim the web (diagonal and vertical members) with the chords (see fig. 3) but I can’t seem to find a good way to solve the intersection of the web-members with themselves.
I’ve added the trimming part of my script in this post. Please note that this is just one configuration the truss can result in. So the cutting needs to be rigorous enough that when a different truss is presented, the trimming still works. I don’t really care which web-member is cut and which gets to be uninterrupted. As long as they don’t overlap anymore.

Does anyone have any suggestions? I’m also not too familiar with the different cutting options (Solid difference, split brep, trim solid) so far, solid difference seems to work best for me.

Thank you very much in advance


fig. 1: overview truss structure

fig. 2: extruded members cause mess at nodes

succesfull_cut web with chord
fig. 3: successful cut web with chords

fig. 4: unsuccessful trimming of web-members with each other

Cutting multiple (28.5 KB)
comments on script: white group = input from previous part of my script
pink groups = successful attempts to cut web (feel free to change this)
Red part = unsuccessful attempt at trimming web with itself (solution for this is asked)