3. maxofa (Nov 17, 2009 16.09):
Thanks Johannes for your precious help!
The Rhino.CurvePoints() function worked on a test object but it seems that the Dim membA for my OffsetCurve is not working properly. I can not pass this line... string required... any clue on this one? Thank you so much in advance!
Call Main()
Sub Main()
Dim i, j, k
Dim x, y, z
Dim imax, jmax, kmax
imax = Rhino.GetInteger ("max number of point in x", 4)
jmax = Rhino.GetInteger ("max number of point in y", 4)
kmax = Rhino.GetInteger ("max number of point in z", 2)
imax = imax - 1
jmax = jmax - 1
kmax = kmax - 1
ReDim arrPtsMatrix(imax, jmax, kmax)
Call Rhino.EnableRedraw(False)
For i = 0 To imax
For j = 0 To jmax
For k = 0 To kmax
x = i * 1200
y = j * 1200
z = k * 600
arrPtsMatrix(i,j,k) = array(x,y,z)
If i>0 And j>0 And k>0 Then
Dim polyBottom
polyBottom = Rhino.AddPolyline (array (arrPtsMatrix(i,j-1,k-1),arrPtsMatrix(i,j,k-1),arrPtsMatrix(i-1,j,k-1),arrPtsMatrix(i,j-1,k-1)))
Dim polyCentroid
polyCentroid = Rhino.CurveAreaCentroid (polyBottom)
Dim ptCentroid
ptCentroid = Rhino.AddPoint (polyCentroid(0))
ptCentroid = Rhino.PointCoordinates (ptCentroid)
Dim plateThickness : plateThickness = 12
Dim membThickness : membThickness = 25
Dim membA, arrPointsA, arrPointA
membA = Rhino.OffsetCurve (polyBottom, ptCentroid, plateThickness)
arrPointsA = Rhino.CurvePoints(membA)
For Each arrPointA In arrPointsA
Call Rhino.AddPoint (arrPointA)
Next
Dim membAA : membAA = Rhino.OffsetCurve (polyBottom, ptCentroid, membThickness + plateThickness)
End If
Next
Next
Next
Call Rhino.EnableRedraw(True)
End Sub
1. maxofa (Nov 17, 2009 06.00):
Hi guys,
I am trying to create 1 points at the end of each line of a triangle that have been previously offset. I tried to put points at he end or start of the curve but I only have one point instead of 3. It is probably because The OffsetCurve returns an array so anybody have an idea on how to resolve that?
Here is my code
Call Main()
Sub Main()
Dim polyBottom
polyBottom = Rhino.GetObject("curve",4)
Dim polyCentroid
polyCentroid = Rhino.CurveAreaCentroid (polyBottom)
Dim ptCentroid
ptCentroid = Rhino.AddPoint (polyCentroid(0))
ptCentroid = Rhino.PointCoordinates (ptCentroid)
Dim plateThickness : plateThickness = 12
Dim membThickness : membThickness = 25
Dim membA : membA = Rhino.OffsetCurve (polyBottom, ptCentroid, plateThickness)
Dim arrStartPtA : arrStartPtA = Rhino.CurveStartPoint(membA(0))
Call Rhino.AddPoint (arrStartPtA)
Dim membAA : membAA = Rhino.OffsetCurve (polyBottom, ptCentroid, membThickness + plateThickness)
Dim arrStartPtAA : arrStartPtAA = Rhino.CurveStartPoint(membAA(0))
Call Rhino.AddPoint (arrStartPtAA)
Call Rhino.AddLine (arrStartPtA, arrStartPtAA)
End Sub