What is the rhino c++ api function for cmd Flow?

My system is Rhino 6 C++ SDK.
I want to flow a object along a curve by api function, not by run cmd script.
How can I do?
Please give me a sample.


Hi @john12,

Let me know if this helps.


– Dale

1 Like

I have some geometry (ON_3dPoint、ON_Curve、ON_Mesh…)
I want to flow them along curves by this function
virtual bool Morph (const class ON_SpaceMorph &morph)
How to set the input by CRhinoFlowSpaceMorph?
Please give me a sample.

@john12 - to work with just geometry, call the base class ON_Geometry::Morph method, instead of RhinoMorphObject.

– Dale

1 Like

@dale I’m a bit confused with the usage of ON_Geometry::Morph (for CRhinoFlowSpaceMorph). Do you by any chance have an example of its usage? Many thanks in advance.

Hi @resammc,

I’m sure there are several examples on the developer samples repo on GitHub.

– Dale

Hi @dale,

Thanks a lot. This repository was actually the first thing that I tried. The closest I could find was cmdSampleSporph.cpp (for CRhinoSporphSpaceMorph) and cmdSampleBend.cpp (for CRhinoBendSpaceMorph), but could not find any examples for CRhinoFlowSpaceMorph.

I tried to figure it out myself, but when I issue doc->MorphObject(obj, morph, true, true); I get an exception thrown error… So, my guess is that I’m not defining the morph object correctly.

Hi @resammc,

In a nutshell:

// objects to flow along a curve
CRhinoGetObject go = ...

// base curve
const ON_Curve* curve0 = ...

// target curve
const ON_Curve* curve1 = ...

// other params
bool bReverse0 = false;
bool bReverse1 = false;
bool bPreventStretching = false;
bool bPreserveStructure = false;

CRhinoFlowSpaceMorph morph;
morph.FlowInit(curve0, bReverse0, curve1, bReverse1, bPreventStretching);

for (int i = 0; i < go.ObjectCount(); i++)
  context.m_doc.MorphObject(go.Object(i).Object(), morph, true, true);


– Dale

1 Like

Hi @dale ,

Great.Thank you very much. I forgot to use morph.FlowInit(). Everything works as expected now.