Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4153

Curve.OffsetTangentToSurface direction isn't predictable

$
0
0

Hello,

I’m tinkering with a script that’s meant to create a custom ribbon around a 3D edge, for which I’m extruding a curve using the new Curve method OffsetTangentToSurface(Surface surface, Double length). The issue is that, for some imported geometries that have been repaired and standardized explicitly, two continuous edges that share the same face are extruded in different directions.


When touching the Brep seen in the pictures in the code, I’ve ran a check through the trims and there’s A LOT of them that will return True at IsReversed(). Nonetheless, the function Reverse() returns False (fails at reversing them). Both at the Trim itself and at its associated Edge.

Is there a way to obtain the expected behaviour, running checks or directly processing the trims or the surfaces in a certain way? For reference, the way I generated the trims uses the following function:

def ExtrudeEdgesNormalToSurface(brepGeometry):
    nakedEdges = list()
    extrusions = list()
    workEdges = brepGeometry.Edges
    for edge in workEdges:
        if edge.Valence == Rhino.Geometry.EdgeAdjacency.Naked:
            nakedEdges.append(edge)
    for nakedEdge in nakedEdges:
        adjacentFace = nakedEdge.AdjacentFaces()[0]
        edgeCurve = nakedEdge.EdgeCurve
        extrudedCurve = edgeCurve.OffsetTangentToSurface(brepGeometry.Faces[adjacentFace], System.Double(30.0))
        extrudedSurface = Rhino.Geometry.Brep.CreateFromLoft([edgeCurve, extrudedCurve], Rhino.Geometry.Point3d.Unset, Rhino.Geometry.Point3d.Unset, Rhino.Geometry.LoftType.Straight, False)
        extrusions.append(extrudedSurface)
    return extrusions

The brep geometry that is used as an input is repaired, standardized, and compacted. Then, the resulting extrusions are added to the document objects table.

Are there any obvious solutions to this? Thanks in advance.

  • Jose.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4153

Trending Articles