[38ba34]: / Application / MocapExamples / SpecialFeatures / ExternalDesVars.main.any

Download this file

44 lines (36 with data), 2.9 kB

// Example on overwriting the Marker design vars.

// Include Lower Extremity PiG example
#include "../Plug-in-gait_Simple/LowerExtremity.main.any"

Main = 
{
  // This illustrate how we can insert a DesVar to a KinOptStudy, and 
  // how it changes the color of the arrow to green.
  
// The following macro will add a DesignVar
#define OPTIMIZE_MARKER_POS(NAME, DIR,  R, G, B) AnyDesVar& NAME##_##DIR= Main.ModelSetup.ParameterIdentification.NAME##_##DIR;\
                                    Main.ModelSetup.MocapDrivers.NAME.MarkerPlacementSegment.NAME##_Marker.Arrow_##DIR.Line.RGB= {R,G,B};
Main.Studies.ParameterIdentification = 
{
   OPTIMIZE_MARKER_POS(CLAV,Z,0,1,0)
};                                  
                                    
// If it is necessary to add the same marker direction in different parameter optimization studies
// or color the arrow with difrent colors, then use the macros below.
// The macro with the highest number takes precedence when coloring the arrows. 
#define OPTIMIZE_MARKER_POS_1(NAME, DIR, R, G, B) AnyDesVar &NAME##_##DIR##_1= Main.ModelSetup.ParameterIdentification.NAME##_##DIR;\
                                    Main.ModelSetup.MocapDrivers.NAME.MarkerPlacementSegment.NAME##_Marker.Arrow_##DIR.Line.RGB1= {R,G,B};
#define OPTIMIZE_MARKER_POS_2(NAME, DIR, R, G, B) AnyDesVar &NAME##_##DIR##_2= Main.ModelSetup.ParameterIdentification.NAME##_##DIR;\
                                    Main.ModelSetup.MocapDrivers.NAME.MarkerPlacementSegment.NAME##_Marker.Arrow_##DIR.Line.RGB2= {R,G,B};
#define OPTIMIZE_MARKER_POS_3(NAME, DIR, R, G, B) AnyDesVar &NAME##_##DIR##_3= Main.ModelSetup.ParameterIdentification.NAME##_##DIR;\
                                    Main.ModelSetup.MocapDrivers.NAME.MarkerPlacementSegment.NAME##_Marker.Arrow_##DIR.Line.RGB3= {R,G,B};
#define OPTIMIZE_MARKER_POS_4(NAME, DIR, R, G, B) AnyDesVar &NAME##_##DIR##_4= Main.ModelSetup.ParameterIdentification.NAME##_##DIR;\
                                    Main.ModelSetup.MocapDrivers.NAME.MarkerPlacementSegment.NAME##_Marker.Arrow_##DIR.Line.RGB4= {R,G,0};
#define OPTIMIZE_MARKER_POS_5(NAME, DIR, R, G, B) AnyDesVar &NAME##_##DIR##_5= Main.ModelSetup.ParameterIdentification.NAME##_##DIR;\
                                    Main.ModelSetup.MocapDrivers.NAME.MarkerPlacementSegment.NAME##_Marker.Arrow_##DIR.Line.RGB5= {R,G,B};
                                    
                                    
//  // This shows how to add the same DesVar if a model contains multiple
//  // KinOptStudy classes. The arrow color is overridden by the second DesVar.
//  // If multiple DesVars are created which link to the same arrow the highest number 
//  // in take presendence.  
Main.Studies.ParameterIdentification = 
{
OPTIMIZE_MARKER_POS_1(STRN,X,1,1,0)
};                                  

   
};