Grasshopper

algorithmic modeling for Rhino

Hello,

I am writing a code in Grasshopper Python component and I can not figure out how to write a code for finding the centroid of a closed triangular or 4 sided closed polyline. 

I tried using the AreaMassProperties, but I couldn't get the correct data as my output and it keeps giving me an error.

Naciem

Views: 1517

Attachments:

Replies to This Discussion

Hi Naciem... Try the attachment.

-Mostapha

Attachments:

Hi Mostapha,

Thank you so much for your response.

This is exactly what I wanted. I had something similar to what you wrote, but embedded in the Classes and I think that's why it was not giving me the correct result.

Thanks again!

Naciem

No problem! You can also embed it in the Class.

Check the attachment!

-Mostapha

Attachments:

Thank you Mustafa! I am at beginner level in Python. 

I don't quiet understand the last line:

massProp.Dispose()

Also, is there any reference or help menu for RhinoCommon namespaces similar to Rhino Script Syntax (F1 key) that I can easily understand what I have to feed into the namespace that I am using? 

Thanks again!

n-

Naciem,

The last line is not critical.  The script should work without that line. I just delete the massProp to clean the file.

Check RhinoCommon SDK webpage: http://www.rhino3d.com/5/rhinocommon/ for Online rhinocommon SDK documentation.

-Mostapha

Great.Thanks!

n-

Hi Mostapha,

I had to change my program since I wasn't able to create the hexagon shape that I was aiming for.

I used the WB compenet in GH to create the hexagon pattern and tried to bring that in as an input to python component as well as the attractor point.

At the moment nothing is working, and I can not figure out what the problem is.

Do you think it's because of feeding polylines into the python component?

If yes, what do you suggest me to do?

Any help would be greatly appreciated.

Thanks,

Naciem

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service