Grasshopper

algorithmic modeling for Rhino

Hi,

I have a function in my script that analyses a couple of intersecting lines and returns a dictionary with the intersection point of the lines as a key and all of the intersecting lines at that point as values of the same key.

When I try to unpack the dictionary in another function. The intersection point prints as coordinates and can't be used to create a line with anther point.
The unpacked curves print correctly as line-like objects, but can't be analysed for start and end points when iterating over the curve list.

Any ideas on how to fix this? 

Views: 785

Attachments:

Replies to This Discussion

See the attached file for a quick debugged version..

Attachments:

Thanks for your help. I nearly finished the script.
It works if I only have a couple of lines, but I get an error, if I input a bigger number!?

Could you take another look, please? Or somebody else. I double checked the code, but the error is escaping me somehow.

Attachments:

If you read the output error stack, you can see the following error occur on line 47 :

Runtime error (TypeErrorException): Parameter must be a Guid or string representing a Guid

This means that you are not passing the correct argument type to the rs.CurveStartPoint() function (they usually always work with GUIDs).

In line 46 where you print your "line" you can see this:

[<Rhino.Geometry.LineCurve object at 0x0000000000000036 [Rhino.Geometry.LineCurve]>]

This looks like a list with the first item being a Rhinocommon LineCurve. As I noted in the def above you should learn to check your variables using type() to make sure that you are passing the right types that a function expects.

It seems that your problems are caused by mixing RhinoCommon types with RhinoScriptSyntax functions. To best avoid this stick with either pure RhinoCommon or try to use just RhinoScriptSyntax. I would recommend option number one, search the forum for more on this topic :)


Thanks for your tremendous amount of help again.

I'll look into RhinoCommon and RhinoScriptSyntax. I wasn't aware that RhinoCommon even exists. I guess I never really questioned the machinery behind Rhino and Rhino/Grasshopper Python.

Thanks again.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service