Grasshopper

algorithmic modeling for Rhino

[Python] Using the patch command within Python Script (creating a surface between 5 non-planar points)

Hi, I am new to Pyhton Scripting and I was wondering if anyone can help me with a problem I have been having.

I would like to create a surface between 5 or more non-planar points. I have tried to use the 'patch' command which I imported from Rhino. The script runs with no errors but the patched surface does not appear in my model.

If anyone can resolve this issue or tell me how I can create such a surface using another method, I will be grateful. 

Below is a copy of the script that I am working on:

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext
from Rhino.Collections import CurveList

p1 = rs.PointCoordinates("e798e82a-5abb-468e-8c33-c39e1e0d7180")
p2 = rs.PointCoordinates("820afac5-c594-42ea-8723-f3646019b0af")
p3 = rs.PointCoordinates("41e3c0aa-30ad-466f-b88b-3be98f67a485")
p4 = rs.PointCoordinates("3e0857c5-b463-49aa-8549-0b11f847b226")
p5 = rs.PointCoordinates("19d946ae-b416-4f9e-939c-ed9e31fbe8e7")
p6 = rs.PointCoordinates("65342367-a297-4536-8bff-5935ab500a69")
p7 = rs.PointCoordinates("70793197-e1de-4b4b-9be1-38ebb9fe5dd5")
p8 = rs.PointCoordinates("4be53db2-98ad-4b8b-80de-1ca055bf63a4")
p9 = rs.PointCoordinates("cc58b791-ccb3-41d7-ac2c-2b64f83d0210")
p10 = rs.PointCoordinates("bee35659-25ec-42c8-ae3f-65d053cdc6f7")

points1 = p1, p3, p5, p7, p9, p1
points2 = p2, p4, p6, p8, p10, p2

c1 = rs.coercecurve(rs.AddLine(p1, p3))
c2 = rs.coercecurve(rs.AddLine(p3, p5))
c3 = rs.coercecurve(rs.AddLine(p5, p7))
c4 = rs.coercecurve(rs.AddLine(p7, p9))
c5 = rs.coercecurve(rs.AddLine(p9, p1))

curves = c1, c2, c3, c4, c5

list1 = CurveList(curves)

Srf = Rhino.Geometry.Brep.CreatePatch(list1, 10, 10, 5)

Views: 2254

Replies to This Discussion

Hello,

You can check out this post from blog. It uses the Create patch method. I would suggest to switch to rhinocommon when working in a GH python component.

This specific script works both with lines and points alltogether as the norma command from rhino does.

If you have any question let me know.

best,

M.

Or what the heck.. it's five lines.

there you go,

Attachments:

Thanks a lot! This is great :):)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service