ExtractIso & RhinoCommand

Hi all,

As V6 have History on _ExtractIsoCurve, i’m trying to script this with RhinoCommand, but RhinoCommand still,for me, always a bit confused in writing method.

With the Script below, when i use Rhino.extractIsoCurve , the script work as expected.

When i try the same with RhinoCommand, i get another result, Iso are extracted on mouse position :thinking:

Any ideas on what’s wrong ?

Thx.

Option Explicit

Call Main()
Sub Main()


	Dim strObject, arrPoint, arrParameter, pos, arrIso
	Dim arrDomainU, arrDomainV
	Dim arrParam(1)

	strObject = Rhino.GetObject("Select surface", 8)
	
	arrDomainU = Rhino.SurfaceDomain(strObject, 0)
	arrDomainV = Rhino.SurfaceDomain(strObject, 1)	
	arrParam(0) = ((arrDomainU(0) + arrDomainU(1)) / 2 )						
	arrParam(1) = ((arrDomainV(0) + arrDomainV(1)) / 2 )
	
	arrPoint = Rhino.EvaluateSurface(strObject, arrParam)
	arrParameter = Rhino.SurfaceClosestPoint(strObject, arrPoint)
	
	'arrIso = Rhino.ExtractIsoCurve(strObject, arrParameter, 2)
	
	Pos = Rhino.Pt2Str(arrParameter)
		
	Rhino.Command "_ExtractIsoCurve _SelID " & strObject & " " & " _Direction=Both _IgnoreTrims=Yes " & Pos & " " & "_Enter "
	

End Sub

@dale can you just tell me if something is wrong in script or if it’s a unexpected RhinoCommand result ?

Hi @Cyver,

How about this?

Sub Main()

	Dim strSrf, arrIso
	Dim blnHistory, arrPt
	Dim strPt, strCmd

	strSrf = Rhino.GetObject("Select surface for isocurve extraction", 8)
	If IsNull(strSrf) Then Exit Sub
	
	arrIso = Rhino.GetSurfaceIsoParamPoint(strSrf, "Select isocurve to extract")
	If IsNull(arrIso) Then Exit Sub

	arrPt = Rhino.EvaluateSurface(strSrf, Array(arrIso(0), arrIso(1)))
	strPt = Rhino.Pt2Str(arrPt)
	
	strCmd = "_ExtractIsoCurve _SelID " & strSrf & " _Direction=_Both _IgnoreTrims=_Yes " & strPt & " _Enter"

	blnHistory = Rhino.EnableHistoryRecording(True)
	Call Rhino.Command(strCmd, True)
	Call Rhino.EnableHistoryRecording(blnHistory)

End Sub

– Dale

Hi @dale,
Thanks for reply.

I got same problem, something is wrong, when i try to put value from Domain in StrPt, seems script extract at right place ( surface center ) then , for some mysterious reasons replace iso extracted on mouse location click.

If you try the script on simple surface you’ll see what’s happend.


Call Main()
Sub Main()

	Dim strSrf, arrIso , arrDomainU , arrDomainV
	Dim blnHistory, arrPt
	Dim strPt, strCmd
	Dim arrParam(1)

	strSrf = Rhino.GetObject("Select surface for isocurve extraction", 8)
	If IsNull(strSrf) Then Exit Sub
	
	arrDomainU = Rhino.SurfaceDomain(strSrf, 0)
	arrDomainV = Rhino.SurfaceDomain(strSrf, 1)	
	arrParam(0) = ((arrDomainU(0) + arrDomainU(1)) / 2 )						
	arrParam(1) = ((arrDomainV(0) + arrDomainV(1)) / 2 )

	arrPt = Rhino.EvaluateSurface(strSrf, arrParam)
	strPt = Rhino.Pt2Str(arrPt)
	
	strCmd = "_ExtractIsoCurve _SelID " & strSrf & " _Direction=_Both _IgnoreTrims=_Yes " & strPt & " _Enter"

	blnHistory = Rhino.EnableHistoryRecording(True)
	Call Rhino.Command(strCmd, True)
	Call Rhino.EnableHistoryRecording(blnHistory)

End Sub

Hi @Cyver,

I’ve logged a bug for the ExtractIsoCurve command.

https://mcneel.myjetbrains.com/youtrack/issue/RH-43868

– Dale

1 Like