OrientOnSrf

Hi,

After running this script and editing the original sphere - why does history not work as expected.

motif.3dm (123.2 KB)

Dim obj
obj = rhino.GetObject("Select Sphere", 8)

Dim pts,pt
pts = rhino.GetObjects("Select Points", 1)

Dim srf
srf = rhino.GetObject("Select Surface", 8)

Dim i
i = 0

Do While i < UBound(pts) + 1

	rhino.UnselectAllObjects		
	
	rhino.SelectObject obj

	rhino.Command "-_OrientOnSrf 0 10,0,0 _SelID " & srf & " _Copy=_Yes  _Flip=_No  _Rigid=_No " & rhino.Pt2Str(rhino.PointCoordinates(pts(i))) & " _Enter _Enter _Enter"
	
	i = i + 1
	
Loop

@dale

The problem might be that you are running the OrientOnSrf command UBound(pts) + 1 number of times instead of just once. With Copy=Yes, OrientOnSrf will continue to place copies - you just have to build the correct script string.

But I will look into this…

I’ve tracked this down to an issue with the OrientOnSrv command, which expected the points on the surface to be picked, not scripted. I will fix this for SR9. Thanks for reporting.

Was this ever fixed?

I believe so.

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

I can’t seem to make this work:

Panel is some surface in 3D
SplitRow(j) is a 3D point coordinates lying in the Panel surface

Rhino.SelectObject Circle
Rhino.Command "_-OrientOnSrf 0,0,0 0,1,0 _SelID " & Panel & " " & Rhino.Pt2Str(SplitRow(j)) & “_Enter _Enter”, False

Have you tried the sample above? Seems to work here.

I may need a sample model from you…

– Dale

Yep, does exactly the same thing as mine. Which is nothing.

Basically what I’m doing is Rhino.OffsetCurveOnSurface, shorten the curves ends with Rhino.ExtendCurveLength and use curve ends as 3D points to orient my circles on a twisted surface.

Option Explicit

Call Main()

Sub Main()
	Dim Circle, Panel, Point
	
	Panel = Rhino.GetObjectEx("Pick surface", 8)(0)
	Circle = Rhino.AddCircle(Rhino.WorldXYPlane, 1)
	Point = Rhino.GetPoint(0)
	
	Rhino.UnselectAllObjects
	Rhino.SelectObject Circle
	Rhino.Command "-_OrientOnSrf 0,0,0 0,1,0 _SelID " & Panel & " " & Rhino.Pt2Str(Point) & "_Enter _Enter", False
	
End Sub

orientonsrf.3dm (31.4 KB)

Edit:

Nevermind - missed space …Pt2Str(Point) & "_Enter…