Please log in to write a message.

16. Tasylor (May 10, 2014 06.45):
hi, how to addcurve with the point?
Call Main()
Sub Main()
Dim t, K1,K2,K3,K4,h,N,b,a,i,L,j,k,x,y
Dim arrx(20)
Dim arry(20)
a = 0.0
b = 200.0
N = 20
t = 0
y = 0
x = 0
L = 0.5
h = (b  a) / N
Rhino.Print(t & "," & x & "," & y)
arrx(0) = x
arry(0) = y
For i = 1 To N
K1 = h * FuncY(t, y, L)
K2 = h * FuncY((t + h / 2), (y + K1 / 2), L)
K3 = h * FuncY((t + h / 2), (y + K2 / 2), L)
K4 = h * FuncY((t + h), (y + K3), L)
y = y + (K1 + 2 * K2 + 2 * K3 + K4) / 6
t = a + i * h
Rhino.Print(t & "," & y)
arry(i) = y
Next
For k = 1 To N
K1 = h * FuncX(t, x, L)
K2 = h * FuncX((t + h / 2), (x + K1 / 2), L)
K3 = h * FuncX((t + h / 2), (x + K2 / 2), L)
K4 = h * FuncX((t + h), (x + K3), L)
x = x + (K1 + 2 * K2 + 2 * K3 + K4) / 6
t = a + k * h
Rhino.Print(t & "," & x)
arrx(k) = x
Next
For j= 0 To N
Rhino.AddPoint(Array(arrx(j), arry(j), 0))
Next
End Sub
Function FuncY(vt, vy, vl)
FuncY = sin(((1  vl) * 1 + vl * 10) * (vt ^ 2) / 2)
End Function
Function FuncX(vt, vy, vl)
FuncX = cos(((1  vl) * 1 + vl * 10) * (vt ^ 2) / 2)
End Function
i want blend a curve to this formula how ya?

15. ddelgiu (Sep 10, 2013 17.22):
Hi Dhaval,
thank you.
Cheers,
Davide

14. dhaval7shah (Aug 19, 2013 14.27):
Hi, ddelgiu,
Thanks for your script It worked and helped us, Many thanks.
Dhaval

13. Johannes (Jul 01, 2010 22.11):
nice! i will try...

12. ddelgiu (Jul 01, 2010 11.53):
Hi Johannes,
just uploaded :)
D

11. Johannes (Jun 14, 2010 13.48):
hi ddelgiu,
can you upload that script into the vbscript tool section? I just tried it and find it quite useful for quick dimensioning.
johannes

10. ddelgiu (Jun 14, 2010 13.33):
Hi Guys,
I was inspired on your dimension rhinoscript and I wrote this code:
Call Main()
Sub Main()
Rhino.MessageBox "check all lines are exploded and flip direction to change dimension orientation", 0,_
"First of all"
Dim arrLine:arrLine=Rhino.GetObjects("select lines",4)
If isNull (arrLine) Then Exit Sub
Rhino.AddLayer "DIMENSIONS",RGB(0,255,255)
Rhino.CurrentLayer "DIMENSIONS"
Dim Line
For Each Line In arrLine
Call dimension(Line)
Next
Rhino.MessageBeep 1
End Sub
Sub dimension(line)
Dim arrcurves,arrAngle,a,b,c,point,point2,strp,strq,arrOffsetCurve,arrsPoint, arrEpoint,arrMP,linebeta
LineBeta=line
arrMP = Rhino.CurveMidPoint( linebeta)
arrcurves=Rhino.OffsetCurve (linebeta, arrMP, 1.0)
Dim curve
For Each curve In arrcurves
arrsPoint = Rhino.CurveStartPoint( curve)
a= Rhino.Pt2Str(arrsPoint)
arrePoint = Rhino.CurveEndPoint( curve)
b= Rhino.Pt2Str(arrePoint)
arrAngle = Rhino.Angle(arrsPoint, arrePoint)
Dim arrMidPt: arrMidPt = Array( arrepoint(0), arrepoint(1)1, 0)
c = Rhino.Pt2Str (arrMidPt )
rhino.Command "_DimAligned " & a &" "& b &" "& b
rhino.HideObjects arrcurves
Next
End Sub

9. Reno (Nov 17, 2009 00.22):
I think this will do it.
Dim arrStartPt : arrStartPt = Rhino.CurveStartPoint(line)
Dim arrEndPt : arrEndPt = Rhino.CurveEndPoint(line)
Dim strStartPt, strEndPt, strDimCommand
Dim x1, y1, z1, x2, y2, z2, pt1, pt2, pt3
pt1 = Rhino.Pt2Str (arrStartPt)
pt2 = Rhino.Pt2Str (arrEndPt)
Dim arrMidPt: arrMidPt = Array(arrStartPt(0), arrStartPt(0) + 5, arrStartPt(2))
pt3 = Rhino.Pt2Str (arrMidPt)
Dim strInput: strInput = "_DimAligned " & pt1 &" "& pt2 &" "& pt3
Call Rhino.Command (strInput)
If someone has a input on how to dimension in an other view than world view I'm keen to know more about it.

8. isg (Aug 22, 2008 02.59):
i think you just need to add a space before the "_Enter" command (ie: " _Enter") then it should work!

7. ledisnomad (Aug 21, 2008 22.38):
Correction: should be
pt3 = x1 & "," & CStr(arrStartPt(0)+0.65) & "," & z1

6. ledisnomad (Aug 21, 2008 22.35):
So here is my dimension function so far:
Function AddDimension(line)
Dim arrStartPt : arrStartPt = Rhino.CurveStartPoint(line)
Dim arrEndPt : arrEndPt = Rhino.CurveEndPoint(line)
Dim strStartPt, strEndPt, strDimCommand
Dim x1, y1, z1, x2, y2, z2, pt1, pt2, pt3
x1 = CStr(arrStartPt(0))
y1 = CStr(arrStartPt(1))
z1 = CStr(arrStartPt(2))
pt1 = x1 & "," & y1 & "," & z1
x2 = CStr(arrEndPt(0))
y2 = CStr(arrEndPt(1))
z2 = CStr(arrEndPt(2))
pt2 = x2 & "," & y2 & "," & z2
pt3 = x1 & CStr(arrStartPt(0)+0.65) & z1
strDimCommand = "_DimAligned " & pt1 & " " & pt2 & " " & pt3 & "_Enter"
Call Rhino.Command(strDimCommand)
End Function
But it still asks the user for the dimension location even though I have it entered in pt3. This would speed up my annotation script tremendously... I have 465 panels to dimension so making this work would be great.

5. ledisnomad (Aug 21, 2008 21.29):
Of course! So all I have to do is convert the points to a coordinate string and run rhino.command. Thanks!

4. Hanno (Aug 21, 2008 16.50):
you can just type the coordinates, e.g.:
rhino.command "_dim 0,0,0 10,0,0 horizontal 0,5,0"

3. ledisnomad (Aug 21, 2008 15.12):
Is there a way to simulate a user click to pick points? Then I could use Rhino.Command "_Dim" and enter points as user input.

2. Hanno (Aug 21, 2008 12.02):
looks like you're right... there are methods to get dimension values and change the dimension style, but it looks like dimensions can only be created by command.

1. ledisnomad (Aug 20, 2008 23.29):
From the rhinoscript reference, it appears there isn't a way to add dimensions using a script. Am I missing something?