Hi,
I am trying to offset a polygon. I am using different offset values for each side.
Is it possible to attain ? I cannot seem to find any node for that.
I tried to offset with offset distance with various values but then corners are not joining. I also to find any fillet that could close the open corners, no luck so far. has anyone achieved this in Dynamo ?
1 Like
@hassan.orion , hi
i think you have to index each offset, and redraw the polygone…
2 Likes
This is the algorithm i use in dynamo and grasshopper. It’s fairly reliable except for extreme shapes that weave and bend a lot.
Unfortunately most programs don’t have a builtin way of achieving this - need to do some geometry gymnastics. I had the same challenge in Grasshopper as well, I’ve attached my method built in Dynamo instead. It involves hyperextending the curves in an offset state and finding the most likely center segment when they’re all split at the intersections. It gets a bit messed up for very distorted shapes. You could also use trigonometry on each corner for a better but more complex outcome (I’m not go…
Pity I haven’t seen the older post earlier.
As you mentioned there it needs some geometry gymnastics.
I believe it’s worth mentioning that the Revit API has such a method for curveloops:
Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018
1 Like
As a design script function.
def unEqOffset (pgn,dst:var[]..[])
{
crv = List.ShiftIndices(pgn.Explode().Offset(dst),[1,0]);
cr1 = crv[0].ExtendEnd(crv[0].Length*10);
cr2 = crv[1].ExtendStart(crv[1].Length*10);
pnt = List.Flatten(cr1.Intersect(cr2),-1);
return Polygon.ByPoints(pnt);
};
UnequalOffset.dyn (8.9 KB)
3 Likes
Hello, is the definition of a function dependent on the dynamo version?
cordially
christian.stan
No idea
See if this helps you spot the problem
UnequalOffset-1.dyn (9.3 KB)
1 Like
This may be due to the fact that I have a revit education version
cordially
christian.stan
No need to mobilize too much of your time, I will try simple functions from the Bilt 18 document by Mr. Sol Amour
cordially christian.stan
1 Like
That shouldn’t be a problem
1 Like
i am facing the same issue
Our problem comes from line 7
(of the creation of intersection points)
In the creation you relied on the Orchid classes (Not sure of the term used)
Cordially
christian.stan
Then try to prefix List with DSCore
def unEqOffset (pgn,dst:var[]..[])
{
crv = DSCore.List.ShiftIndices(pgn.Explode().Offset(dst),[1,0]);
cr1 = crv[0].ExtendEnd(crv[0].Length*10);
cr2 = crv[1].ExtendStart(crv[1].Length*10);
pnt = DSCore.List.Flatten(cr1.Intersect(cr2),-1);
return Polygon.ByPoints(pnt);
};
I tried that and also to change the precision
anEqOffset is not colored
Intersect (not a function used within a function)
cordially
christian.stan
See if the node version of the same works
UnequalOffset-N.dyn (32.3 KB)
1 Like
Thank you for your efforts
edit:
You can show the contents of the Geometry.Intersect node
cordially
christian.stan
Very strange I don’t have the same coordinates after offset
I mobilize you a lot, in addition it is starting to get late at your home (with the jet lag), thank you for your pugnacity
Cordially
christian.stan
Hello, this comes from the curve.offset some offsets are normal to the plane of the curve and others tangent to the curve (I think that’s what gives different results from you)
Cordially
christian.stan
Try the algorithm i posted earlier. It checks curves for which way their normal faces to make sure they offset the right way.
1 Like