Call FlowAlongSrf From Script


Question: How do I call flow along surface passing in the surfaces and point arrays programmatically?

Problem: During the layout of objects on a surface, I use FlowAlongSrf. I am constantly adding new objects to the base surface, and re-calling FlowAlongSrf to get them on the target surface. History is enabled so I am able to move the objects and get them oriented correctly.

Calling flow along surface 10 times in a row, remembering to pick the right corners on each surface is painstaking.

Solution: Create a script to capture the initial flow along surface. Use Rhino.GetSurfaceObject to capture the point on the base and target surface, convert the point array to text objects and store them on base surface with Rhino.SetUserText.

Create a second script called reflow. Pick the new object(s) to flow and select the base surface. Use Rhino.GetUserText to get the target surface and the point arrays to correctly orient the FlowAlongSrf command.

(Dale Fugier) #2

Try using Rhino.SporphObject.


I don’t see an option for Rigid…and do you know if it works with History?

(Dale Fugier) #4

The Rigid option simply performs a rotation transformation (XformRotation, TransformObject).

History is command based. So if you need history, you’ll need to script the command.


So there is no way to do what I am trying to do.

Is there any chance that V6 will allow this?

(Dale Fugier) #6

Like I said, history is command-based. When Rhino detects that an object with history changes, it re-runs the command that recorded the history. In doing this, the object updates.

So, can you “FlowAlongSrf” via scripting - yes. Can you record history from scripting? Not without running (or scripting) the command that does the history recording.


Ok, how do I pass in the point array I capture from Rhino.GetSurfaceObject for the point on my base and target surface into FlowAlongSrf?

(Dale Fugier) #8

You cannot specify selection points when scripting Rhino commands, which is why there is a SporphObject method in RhinoScript.

If you are going to script the FlowAlongSrf command, you’ll need to be aware of the origins (u,v) of the source and target surfaces, as these locations will be used (automatically) as selection points when the surfaces are selected (e.g. SelId, SelSrf, etc) and not picked.

Here is an example of scripting the FlowAlongSrf command with RhinoScript.