Grasshopper

algorithmic modeling for Rhino

Hi All,

I need a simplest solution for intersection problem, where the method RhUtil.RhinoCurveBrepIntersect doesn't work.

I have a m-number list of OnLine and n-number list of OnSurface(m<>n)
and I could imagine that it works with follows logic, but it's doesn't :(

Sub RunScript(ByVal arrSrf As List(Of OnSurface), ByVal arrLines As List(Of OnLine))
Dim pts As New List(Of On3dPoint)
Dim pts_B As New List(Of On3dPoint)
For Each plSrf As onBrep In arrSrf
For i As int32=0 To arrLines.count - 1
Dim points As On3dPointArray = Nothing
Dim overlaps As OnCurve()
If (Not RhUtil.RhinoCurveBrepIntersect(arrLines.item(i), plSrf, 0.0001, overlaps, points)) Then Continue For
If (points.Count() = 0) Then Continue For
pts.Add(points(0))
Next i
Next
A = pts
End Sub


Any Sugestions?
Thank you and Best!
Dima

Views: 282

Replies to This Discussion

Firstly you need to input OnBrep's and OnCurve's rather than OnSurface's and OnLine's as the RhUtil Curve Brep Intersection is exactly that - a OnCurve + OnBrep intersection (you can Cast OnLine's as OnCurve's by simply connecting a OnCurve param component between).

Here's a VB that spits out two Data Trees with points and curves - it also collects null lists for both so you can keep track of path numbers between each list.


Sub RunScript(ByVal inBreps As List(Of OnBrep), ByVal inCrvs As List(Of OnCurve))
Dim tol As Double = RhUtil.RhinoApp().ActiveDoc().AbsoluteTolerance()

'create DataTree generic class
Dim ptTree As New DataTree(Of On3dPoint)
Dim crvTree As New DataTree(Of OnCurve)
Dim pathNum As Int32 = 0

Dim brep As OnBrep
For Each brep In inBreps
Dim crv As OnCurve
For Each crv In inCrvs
Dim path As New EH_Path(pathNum)
Dim intPt As New On3dPointArray
Dim intCrv(0) As OnCurve
RhUtil.RhinoCurveBrepIntersect(crv, brep, tol, intCrv, intPt)

If (intPt IsNot Nothing) Then
Dim tPt As On3dPoint
For Each tPt In intPt
ptTree.Add(tPt, path)
Next
End If

If (intCrv IsNot Nothing ) Then
Dim tCrv As OnCurve
For Each tCrv In intCrv
crvTree.Add(tCrv, path)
Next
End If
Next
pathNum = pathNum + 1
Next
ptOut = ptTree
crvOut = crvTree
End Sub
Hi Dirk,

Thanks for your reply!
I pasted your cod and got that the type RMA.OpenNurbs.online coudn't be convert to RMA.OpenNurbs.OnCurve.
the other point, as you can see in the attachment I have a different kind of lines/srf intersection. I have a number of surface and curves and they are independent of each other.

cheers!
Dima
Attachments:
hi dimitry

as dirk wrote before you have to put a curve container after your line component so that the line will be casted as oncurve or you write some lines inside the vb (post from dirk ....a OnCurve + OnBrep intersection (you can Cast OnLine's as OnCurve's by simply connecting a OnCurve param component between)

best to]
Here's what you need to do:

Thank you Dirk,
thank you to],
I got it:)
cheers!
Dima

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service