A ‘Link’ allow you to access a sofa component from another one anywhere in the simulation graph. In your scene creation file, it usually appear as : input=@../component. In this page we explain how to use it. In your .h, declare your link :
//Where it comes from (usually you do not need to include it, it is already included)
#include <sofa/core/objectmodel/Link.h>
//Use a typedef to make it readable
typedef sofa::core::objectmodel::SingleLink< FROM_CLASS, TO_CLASS, LINK_FLAG> MyLink;
MyLink mylink;
In your constructor use :
'name', 'help')){} MyConstructor::MyConstructor():mylink(initLink(
The list of flags you can use is available in the Sofa API in the LinkFlags enumeration “SofaAPIBaseLink. Here is a link to the BaseLink API. Here is an example from mapping.h. See the Mapping.inl for implementation also.
Last modified: 6 June 2023