Grasshopper

algorithmic modeling for Rhino

Hi there,

I made a little python def :

def mirrorWXZ(object, copy=True):
    transformation = rh.Geometry.Transform.Mirror(rh.Geometry.Plane(rh.Geometry.Point3d(0,0,0),rh.Geometry.Vector3d(0,1,0)))
    mirror = rs.TransformObject(object,transformation, copy)
    return(mirror)

It works welle, but I created a sweep2 surface with :

sweep = rh.Geometry.Brep.CreateFromSweep(rs.coercecurve(rail1),rs.coercecurve(rail2),(rs.coercecurve(Profile)),True,0.01)[0]

But when I try to use my mirror def I have the following error :

Runtime error (TypeErrorException): iteration over non-sequence of type Brep

I don't understand why. Any hints ?

Regards,

Views: 1126

Replies to This Discussion

Sweep returns an array of breps, you'll need to iterate over that array and call MirrorWXZ on each element in that collection.

Hi,

Thanks for your reply. But I still don't understand : it returns a array of 1 brep in this case. I added [0] at the end of my sweep line to extract it from the array right away. So I don't see where I did wrong.

Ah,missed that. In that case we've exhausted my mad Python skillz... sorry.

The exact error message is :

Runtime error (TypeErrorException): iteration over non-sequence of type NoneType
Traceback:
  line 1120, in TransformObject, "C:\Users\Shimegi\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py"
  line 82, in script
  line 1139, in TransformObjects, "C:\Users\Shimegi\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\object.py"

So it seems to come from the rhinoscriptsyntaxe library. May be it's a bug ? I'd like to use another library since this one have some bugs, but I don't see how to apply an transformation matrix to an object with the Rhino library. I found example with the scriptcontext one (sc.doc.Objects.Transform) but I need the GUID and when I use rs.coerceguid on my Brep (which exist) I got "None".

Humpf. Frustating.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service