Fill Pattern where the shape of the body to be patterned is different each direction

BStump
BStump Member Posts: 19 ✭✭
I am looking to see if there is a fill pattern in Featurescript that has the ability to control both direction dimensions independently.  I have a fill where the shape of the body to be patterned is different each direction, so to pattern it I need to control both directions.  Anyone done this or suggestions?
Tagged:

Comments

  • kevin_o_toole_1
    kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565 image
    I'd suggest copying the FeatureScript Fill Pattern, adding a parameter named definition.length2 and making the following changes:

    Change line 70 to
    var maximumIndex = round((norm(diagonal) - (definition.border * 2)) / min(definition.distance, definition.distance2));
    and change line 90 to
    var translation = (direction * i)  * definition.distance + (angled * j)) * definition.distance2;

    If you want the two directions to be perpendicular (rather than the current hex grid), you'll also want to change line 45 to use 90 degree angles.

    Cheers to @NeilCooke for writing clean code that's this easy to modify :D
    Let us know if you encounter any issues!
  • BStump
    BStump Member Posts: 19 ✭✭
    Well that is a good start. In this case you need to consider the shapes I want to pattern to be something like dog bones (https://macrotrac.com/wp-content/uploads/2016/12/i-trac-pic.png ). I just need to be able to do a fill using the basic shape with appropriate offsets in each direction ( I don't need the surface details, the tabs, pins, locks, or tread). The shape nests, so a bounding box would show significant overlap. The angle is not 0, 45 , or 90, but about 29.56 degrees. I am seeing if I can find a way to simplify layouts using Onshape.
  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,123 image
    @kevin_o_toole_1 as much as I'd like to take credit for it, the master code comes from the master coder himself @paul_chastell
    Senior Director, Technical Services, EMEA