Grasshopper

algorithmic modeling for Rhino

Hi all,

I try to split a surface in vb... for example
Domains are Set to 0,1

Dim Srf1 As OnSurface = Nothing
Dim Srf2 As OnSurface = Nothing
Dim dir As int32=0
Dim c As Double =0.5

original_srf.Split(dir,c,Srf1,Srf2)

but it doesn't work....
Can anybody help me?

Views: 1575

Replies to This Discussion

Try this:

Sub RunScript(ByVal org_srf As OnBrep)

'Get input surface
Dim srf As OnSurface = org_srf.m_S(0)

Dim Srf1 As OnSurface = Nothing
Dim Srf2 As OnSurface = Nothing
Dim dir As int32 = 0

'Take middle of the domain
Dim c As Double = org_srf.Face(0).Domain(1).Mid()

'Split
srf.Split(dir, c, Srf1, Srf2)

A = Srf1
B = Srf2
End Sub
thank you so much!!! :))
my fault: Dim srf As OnSurface = org_srf.face(0)
Hi Rajaa, Hi all,
is ist possible to split a surface with a curve in vb?
thanks
HPN
Hi HPN,

Sub RunScript(ByVal org_srf As OnBrep, ByVal cut_crv As OnCurve)

Dim tol As Double = doc.AbsoluteTolerance()
Dim arrcrv(0) As oncurve
arrcrv(0) = cut_crv

'cut the face
Dim cutBrep As New OnBrep'FaceArray
cutbrep = RhUtil.RhinoSplitBrepFace(org_srf, 0, arrcrv, tol)

A = cutbrep

End Sub

"If you are splitting a brep face with curves, then the following rule
applies (copied from RhinoSplitBrepFace function notes):
Remarks:
If the face is split, the portion of the face to the left of the
trim at the start of the trim remains in m_F[face_index]. Any
additional faces are appended to the m_F[] array."
Hi °[u,
thank you very much,
i will try it asap.
HPN
Hi °[u !
Do you know why on this discussion http://www.grasshopper3d.com/forum/topics/surfacetrim-workflow
The Dim declarations were not necessary? I m quite confused why you would need dim or not...
Many thanks,
Arthur
Hi Arthur!

I'm not sure if i got you right... do you mean the declaration of crv?

1. example

Sub RunScript(ByVal x As List(Of OnCurve), ByVal y As OnBrep)
a = rhutil.RhinoSplitBrepFace(y, 0, x.ToArray, _
doc.AbsoluteTolerance)
End Sub


x is input variable defined As List of OnCurve
Rhutil.RhinoSplitBrepFace only works with a 1-dimensional Array of curves
--> x.ToArray = convert the list to an array


2.example

Sub RunScript(ByVal x As List(Of OnCurve), ByVal y As OnBrep)

Dim crv() As OnCurve
crv = x.ToArray
a = rhutil.RhinoSplitBrepFace(y, 0, crv, doc.AbsoluteTolerance)
End Sub


x is input variable defined As List of OnCurve same as in example 1
but then you define a new variable named crv and convert the x-curves to an 1-dimensional array of curves
in the discussion I found the example:
Dim crv(0) As Oncurve
crv(0)=x --> dosn't work for x As List of Curves, only for x= 1 Curve,
better would be the "2.example"

kindest regards
[u
Thanks a lot [u,

It s a very clear explanation.
So you only need to declare and convert variables if the Rhutil. method asks for inputs that you cannot get from the "type hint" list that already exists in GH like "On2dpoint" for example...
I started wondering when i saw VB components that were just one line long like example1.

I am trying to split a surface at several t values (similarily to the shatter component that already exists in GH but only for curves)...
But can't manage to make the script work because i don't really understand how i could extract the iso curves on specific t values to split the surface accordingly.
I found this method: rhutil.RhinoGetIsoCurves
but what the function asks for is so different from the extract isocurve command on Rhino that i m getting lost...

Hope someone can help,

Many thanks,

Arthur
Hi, I have a silly question. How to convert 1 dimensional array back into list or items?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service