Surface Orientation

hello!!

on this picture:


do you see something wrong?

for me there is a problem:

  • red arrows are in same direction,
  • the pink too,
  • but greens no,

is it normal?

i have a script that orient a profil on surface intersections, but in this case it reverse some orientation, why? i don’t know, so i search, an i find the reverse orientation of this surface.

i try with a script that write the start and end of surface intersections:

i don’t know how i can make the green vector on same orientation…

Hi - you can use the Dir command and then use the VReverse option on the surface that you want to change.
-wim

my script can orient a lot of polyline on surfaces intersections, but how can i be sure that all are in the same orientation?
i have to search a better way…

Hello - you can check for a local plane - Surface.FrameAt() - and see ff the axes are parallel Vector3d.IsParallelTo().

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Surface_FrameAt.htm

https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_Geometry_Vector3d_IsParallelTo.htm

-Pascal

is there a command, allowing to standardize the parameters u and v of a surface set.
i think no but it can be asked… no?

Hello - if the input is parallel, or more or less parallel, more or less planar surfaces, then I can imagine it is possible to line them up, yes. But currently there is no command for this - well, except the ShowDir command which will lat you make adjustments to multiple surfaces at once, but it is not automatic.

-Pascal

input are more or less parallel, and planar surfaces, so have you an idea?

if i analyse U domain and V domain, is it possible to standardize all of them?

does all surfaces have a domain that begins or ends at 0?

No - you can set this, (in Rhino Reparameterize)but in general no.
I’ll see if I can cook something up - it seems to me that @Helvetosaur might have done this already in a script…?

-Pascal

No, nothing in my library for that currently, sorry…

OK, thanks… Still, I am impressed that you have a library. I have a blob.

-Pascal

1 Like

Thank you!!! All surfaces are planar surface, but not parallel… I don’t know how I can compare u or v direction. To be sure, maybe I can rebuilt all surfaces with the same code…

Something like this should set the domain of all single-face breps (i.e. surfaces, not polysurfaces) to 0 to 1 in both the U and V directions:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

srfIDs=rs.GetObjects("Select surfaces to normalize domain",8,preselect=True)
if srfIDs:
    norm_interval=Rhino.Geometry.Interval(0,1)
    breps=[rs.coercebrep(srfID) for srfID in srfIDs]
    for i,brep in enumerate(breps):
        if brep.Faces.Count==1:
            face=brep.Faces[0]
            face.SetDomain(0,norm_interval)
            face.SetDomain(1,norm_interval)
            norm_brep=face.DuplicateFace(True)
            sc.doc.Objects.Replace(srfIDs[i],norm_brep)
    sc.doc.Views.Redraw()

Ok but how can i compare the u direction to an other u direction of an other surface?

note, all surfaces are planar surfaces!!

what do you think about it:

import rhinoscriptsyntax as rs
name=''
surfs=rs.GetObjects('select',8)
if surfs:
    rs.EnableRedraw(False)
    for surf in surfs:
        if rs.IsSurfacePlanar(surf):
            if rs.ObjectLayer(surf):layer=rs.ObjectLayer(surf)
            if rs.ObjectName(surf):name=rs.ObjectName(surf)
            cvs=rs.DuplicateEdgeCurves(surf)
            rs.DeleteObject(surf)
            surf=rs.AddPlanarSrf(cvs)
            if layer:rs.ObjectLayer(surf,layer)
            if name:rs.ObjectName(surf,name)
            rs.DeleteObjects(cvs)
    rs.EnableRedraw(True)

i built a new surface, that make all surfaces with the same u and v direction…

Hello - @onlyforpeace - I think this thing works - it modifies the existing surfaces.

SrfUVAlign.py (2.5 KB)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

-Pascal

thank you for your script!!!
i take it!!!
which is faster, write directly script in the buton, or call it by full Path inside double-quotes?

Is what I would do…

-Pascal