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

Modifying geometry in blocks

$
0
0

Hi-
Is there a way to modify an objects geometry while it is inside a block definition? I’m trying to clear the NGon list of meshes before they are exported. So far I have:

filt = Rhino.DocObjects.ObjectType.InstanceReference
 rc, object = Rhino.Input.RhinoGet.GetOneObject('Get Block', True, filt)
 if rc == Rhino.Commands.Result.Success:
     blockInstance = object.Object()
     blockObjs = blockInstance.InstanceDefinition.GetObjects()
     for rhObj in blockObjs:
         if rhObj.Geometry.ObjectType == Rhino.DocObjects.ObjectType.Mesh:
             nGons = rhObj.MeshGeometry.Ngons
             if len(nGons) > 0:
                 print 'NGons Found: ' + str(rhObj.Id)
                 nGons.Clear()
                 rhObj.CommitChanges()

Is there any way to get this to work or do I have to modify the mesh outside the block and then add it to instance definition.

Any help would be greatly appreciated!

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4141

Trending Articles