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

Using RhinoPolyhedra from Python

$
0
0

@dale wrote:

I was asked how to create one of the polyhedral shapes, in RhinoPolyhedra, from Python. Here is a simple example:

import clr
import sys
import scriptcontext as sc

sys.path.append('%APPDATA%/McNeel/Rhinoceros?6.0?Plug-ins/Rhino Polyhedra (666ae572-a6c5-44b5-b668-6b503d56c199)/6.0.6844.19198')
clr.AddReference('PolyhedraCommon.dll')

import PolyhedraCommon

polyhedron = PolyhedraCommon.Library.CatalanSolids.DeltoidalHexecontahedron()
polyhedron.Create()
if polyhedron.IsSolid:
    mesh = polyhedron.ToMesh(sc.doc.ModelAbsoluteTolerance)
    sc.doc.Objects.AddMesh(mesh)
else:
    meshes = polyhedron.ToMeshFaces(doc.ModelAbsoluteTolerance)
    for m in meshes:
        sc.doc.Objects.AddMesh(m)

sc.doc.Views.Redraw()

– Dale

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles