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

Surface Area

$
0
0

@onlyforpeace wrote:

hi.

i work with a lot of files tere are no rhino file, but catia, solidworks, or other… so it pass by igs or step…

i’ve to calculate surfaces of part of project, and sometimes the command surfaceArea doesn’t run:‘impossible to calculate’.
so i mesh objects, and calculate the area, and it runs everytime… so when i have to do that, by script, i pass to this way, i select objects, mesh its,return the area and delete meshes…

but in Python i didn’t find rs.meshobjects, so i use the @dale’s script…
with surfaces, it’s ok, but if i select a polysurface, it mesh only one surface of the polysurface.

def MeshObjects(_ids):
    objs = [sc.doc.Objects.Find(id) for id in _ids]
    mp = Rhino.Geometry.MeshingParameters()
    mesh_ids = []
    for obj in objs:
        if isinstance(obj.Geometry, Rhino.Geometry.Brep):
            brep = obj.Geometry
        elif isinstance(obj.Geometry, Rhino.Geometry.Extrusion):
            brep = obj.Geometry.ToBrep(True)
        elif isinstance(obj.Geometry, Rhino.Geometry.Surface):
            brep = Rhino.Geometry.Brep.CreateFromSurface(obj.Geometry)
        else:
            continue
        mesh = Rhino.Geometry.Mesh.CreateFromBrep(brep,mp)[0]
        m_id = sc.doc.Objects.AddMesh(mesh)
        mesh_ids.append(m_id)

    if len(mesh_ids)==0: return
    sc.doc.Views.RedrawEnabled = True
    return mesh_ids

what is a brep in rhino?
is it possible to create a brep from a polysurface?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4159

Latest Images

Trending Articles



Latest Images