Debug in Rhinoscript in Rhino5?


Hello to all,
Looking forward to know why in rhinoscript the debug mode block the execution of the code?
in previous versions with monkey, this not happend.

thanks in advance

(Dale Fugier) #2

Hi Carlos,

The debugger in the RhinoScript editor seems to work. I don’t understand what you mean by “block the execution.” How can I repeat what you are seeing?

– Dale


Hello Dale,

When I try to debug the debug debug popup doesn’t appear. It happen in Rhino 5 with Windows 7. I tryied in the desktop at job and also in my laptop at home. When I place a breakpoint in the first lines, lets say line 8 appear the the popup, but if a place the breakpoint into a function, the code is blocked.

This is my code: I want to know why in the line 66 the plane is not detected.
Thanks in advance, kind regards

Option Explicit
'Script written by <carlosdelab>

Call SrfAnalysis()
Sub SrfAnalysis()

	Dim srf : srf = Rhino.GetObject("sel srf", 8)
	'Dim arrLineAtt : arrLineAtt = Rhino.GetObjects("sel Line Attractors", 4)
	Dim i, j
	Dim uParam, vParam
	Dim cantU : cantU = 220
	Dim cantV : cantV = 40
	Dim pt
	Dim u : u = Rhino.SurfaceDomain(srf, 0)
	Dim v : v = Rhino.SurfaceDomain(srf, 1)
	Dim bigData()
	ReDim bigData(cantU, cantV)

	'Call Rhino.EnableRedraw(False)
	For i = 0 To cantU
		For j = 0 To cantV
			uParam = u(0) + i * ((u(1) - u(0)) / cantU)
			vParam = v(0) + j * ((v(1) - v(0) ) / cantV)
			bigData(i, j) = Rhino.SurfaceCurvature(srf, Array(uParam, vParam))
	Dim arrStripePts()
	ReDim arrStripePts(cantU)
	Dim cBase

	For j = 0 To CantV
		For i = 0 To cantU
			arrStripePts(i) = bigData(i, j)
		'Call Rhino.AddInterpCrvOnSrf(srf, arrStripePts)
		Call MuscleGenr(arrStripePts, srf)
	'Call Rhino.EnableRedraw(True)
End Sub

Function MuscleGenr(arrData, srf)
	Dim dat, pl
	Dim vecUp, vecDo
	Dim arrPtsTop()
	ReDim arrPtsTop(UBound(arrData))
	Dim arrPtsBot()
	ReDim arrPtsBot(UBound(arrData))
	Dim count : count = 0
	Dim i
	For i = 0 To UBound(arrData)
		pl = Rhino.PlaneFromNormal(arrData(i)(1))
		vecUp = Rhino.VectorScale(pl(1), 0.1)
		vecDo = Rhino.VectorScale(pl(1), -0.1)
		arrPtsTop(count) = Rhino.PointAdd(arrData(i)(0), vecUp)
		arrPtsBot(count) = Rhino.PointAdd(arrData(i)(0), vecDo)
	Call Rhino.AddInterpCrvOnSrf(srf, arrPtsTop)
	Call Rhino.AddInterpCrvOnSrf(srf, arrPtsBot)
End Function

(Dale Fugier) #4

This seems to work:

Option Explicit

Call Main()

Sub Main()
  Dim x, y, rc
  rc = Sum(x, y)
  Call Rhino.Print(rc)
End Sub

Function Sum(x, y)
  Dim rc
  rc = x + y ' add breakpoint here...
  Sum = rc
End Function

Running your script gives me a “type mismatch 'pl” on line 66. Perhaps thats the issue…