Grasshopper

algorithmic modeling for Rhino

Hey guys, 

What I would like to do is to be able to import a weaverbirdcommand (ExtractMeshEdges) from rhino to iron python or ghpython.

So what I planned to do was : 

import rhinoscriptsyntax as rs

rs.ExtractMeshEdges

But this command doesn't appear, and I guess because its referring to a plug-in and not to rhino itself.

So I was also thinking about that : 


import Rhino.PlugIns

But I don't find weaverbird there.

I hope that I was clear,

Best

Views: 546

Replies to This Discussion

You don't need weaverbird to extract mesh edges in python...you can do so looping through topologyedges.edgeline in the mesh object in rhinocommon. 

#m is the input mesh

el = []

for te in range(m.TopologyEdges.Count):
....el.append(m.TopologyEdges.EdgeLine(te))

a = el

Python list comprehension is also pretty neat for such cases:

edges = [m.TopologyEdges.EdgeLine(i) for i in range(m.TopologyEdges.Count)]

You could use the recently added node-in-code functionality (warning: can be slow). I'm not sure that you'll be able to import weaverbird as an assembly, but perhaps Giulio can chime in on that subject. I guess it all depends a bit on what you are trying to do. But in general you should be able to import most Python modules, .NET assemblies and GH components. Hope that helps.


RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service