MotionView User's Guide

MotionView Model API

MotionView Model API

Previous topic Next topic No expanding text in this topic  

MotionView Model API

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Please contact MotionView Support to obtain information about a model API example

The Model API consists mainly of a group of SendOff functions that serve as the interface for passing model data from the MDL file to your solver writer program.  They are activated by calling API_MDLModelRead(const char *filename).

Model data is passed via the arguments in the SendOff functions.  These functions are defined as virtual in the class "Model_API".  You must define your own class derived from "Model_API" then handles the passed data in the derived class.  The relationship is transparent in the working examples.

Presently,only one of the virtual functions is an Inquiry Function, i.e., API_InquiryFlexBodySendOffOption which returns your selection back to the API.  All other API functions, except the Inquiry Function and API_MDLModelRead are one-directional, (they only send off data to the user).

The following is the Model_API class that includes a list of the SendOff functions.  The names of the functions are self-explanatory.

class MODEL_API Model_API

{

public:

 

 bool API_MDLModelRead(const char *filename);

 bool API_MDLModelRead(MDL *user_mdl);

 static ostream &(* apiOut)();

 

private:

 

 bool _API_MDLModelRead(MDL *user_mdl, const char *filename);

 

// #1

 virtual void API_SendOffModelUnit(const char* force_unit, const char* length_unit,

         const char* mass_unit, const char* time_unit) {}

// #2

 virtual void API_SendOffGravityVector(const double gravity_x, const double gravity_y,

         const double gravity_z) {}

// #3        

 virtual void API_SendOffMarker(const int num_marker, const int idx,

         const int id, const int body_id, const int node_id,

         const double x,   const double y,   const double z,

         const double a00, const double a01, const double a02,

         const double a10, const double a11, const double a12,

         const double a20, const double a21, const double a22) {}

// #4        

 virtual void API_SendOffRigidBody(const int num_rigid_body, const int idx,

         const int id, const bool IsGround,

         const int cg_id, const int im_id, const int lprf_id,

         const double mass, const double ixx, const double iyy, const double izz,

         const double ixy,  const double iyz, const double ixz,

         const double vx,   const double vy,  const double vz,

         const double wx,   const double wy,  const double wz) {}

// #5

 // option: <=0    -> gloabal property (rigid body property only)

 //       :   1    -> SIMPACK SID_FEM file along with other info

 //       :   2    -> DADS fdf file along with other info

 //       :   3    -> ADAMS mtx file along with other info

 //       :   4    -> MADYMO dat file along with other info

 //       : >=5    -> modal matrix info (nodal mass, node position,

 //                   translational mode shapes, rotational mode shapes,

 //                   diagonal of modal stiffness matrix)

 virtual int API_InquiryFlexBodySendOffOption(const int num_flex_body,const int idx,

         const int id) {return 999999;}

// #6        

 virtual void API_SendOffFlexBodyGlobalProperty(const int num_flex_body, const int idx,

         const int id, const int lprf_id, const double mass,

         const double cm_x, const double cm_y, const double cm_z,

         const double ixx, const double iyy, const double izz,

         const double ixy,  const double iyz, const double ixz,

         const double vx,   const double vy,  const double vz,

         const double wx,   const double wy,  const double wz) {}

// #7        

 virtual void API_SendOffFlexBody(const int num_flex_body, const int idx,

         const int id, const int lprf_id, const char* h3d_file,

const char* fdf_file, const int sel_mode_count,

         const int *sel_mode, const double *mode_freq, const double *cdamp_ratio,

         const double *DMode, const double *VMode,

         const double vx,   const double vy,  const double vz,

         const double wx,   const double wy,  const double wz) {}

// #8

 virtual void API_SendOffNodeInfo(const int num_flex_body, const int idx,

         const int id, const int num_nodes, const int *node_id,

         const double *node_position_x, const double *node_position_y,

const double *node_position_z,

         const double *node_mass, const int HasNodeInertia) {}

// #9        

 virtual void API_SendOffNodeInertia(const int num_flex_body, const int idx,

         const int id, const int num_nodes,

         const double *ixx,  const double *iyy, const double *izz,

         const double *ixy,  const double *iyz, const double *ixz) {}

// #10        

 virtual void API_SendOffOrthogonalizedModeInfo(const int num_flex_body, const int idx,

         const int id, const int num_modes, const int mode_idx, const int mode_id, const double frequency,

         const double modal_stiffness, const double modal_mass, const int num_nodes,

         const double *modeshape_x, const double *modeshape_y, const double *modeshape_z,

         const double *modeshape_rx, const double *modeshape_ry, const double *modeshape_rz) {}

// #11        

 virtual void API_SendOffBallJoint(const int num_ball_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #12        

 virtual void API_SendOffFixedJoint(const int num_fixed_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #13        

 virtual void API_SendOffRevJoint(const int num_rev_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #14        

 virtual void API_SendOffTransJoint(const int num_trans_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #15        

 virtual void API_SendOffCylJoint(const int num_cyl_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #16        

 virtual void API_SendOffUnivJoint(const int num_univ_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #17        

 virtual void API_SendOffInlineJoint(const int num_inline_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #18        

 virtual void API_SendOffOrientationJoint(const int num_orientation_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #19        

 virtual void API_SendOffCVJoint(const int num_convel_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #20

 virtual void API_SendOffPerpendicularJoint(const int num_perpendicular_joint,

         const int idx,

         const int id, const int i_marker_id, const int j_marker_id, const int body1_id,

         const int body2_id) {}

// #21        

 virtual void API_SendOffInplaneJoint(const int num_inplane_joint,

         const int idx, const int id,

         const int i_marker_id, const int j_marker_id, const int body1_id,

         const int body2_id) {}

// #22        

 virtual void API_SendOffPlanarJoint(const int num_planar_joint,

         const int idx, const int id,

         const int i_marker_id, const int j_marker_id, const int body1_id,

         const int body2_id) {}

// #23        

 virtual void API_SendOffParallelAxesJoint(const int num_par_axes_joint, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id) {}

// #24        

 virtual void API_SendOffThreeJointCoupler(const int num_three_joint_coupler,

         const int idx, const int id,

         const int i_marker_id_joint1,  const int j_marker_id_joint1,

         const int body1_id_joint1,  const int body2_id_joint1,

         const char joint_type_joint1,

         const int i_marker_id_joint2,  const int j_marker_id_joint2,

         const int body1_id_joint2,  const int body2_id_joint2,

         const char joint_type_joint2,

         const int i_marker_id_joint3,  const int j_marker_id_joint3,

         const int body1_id_joint3,  const int body2_id_joint3,

         const char joint_type_joint3,

         const double ratio1, const double ratio2) {}

// #25        

 virtual void API_SendOffTwoJointCoupler(const int num_two_joint_coupler,

         const int idx, const int id,

         const int i_marker_id_joint1,  const int j_marker_id_joint1,

         const int body1_id_joint1,  const int body2_id_joint1,

         const char joint_type_joint1,

         const int i_marker_id_joint2,  const int j_marker_id_joint2,

         const int body1_id_joint2,  const int body2_id_joint2,

         const char joint_type_joint2,

         const double ratio) {}

// #26        

 virtual void API_SendOffConstantJointMotion(const int num_expr_motion,

         const int idx,

         const int id, const int joint_id, const char joint_type,

         const char motion_type, const double val) {}

// #27        

 virtual void API_SendOffExpressionJointMotion(const int num_expr_motion,

         const int idx,

         const int id, const int joint_id, const char joint_type,

         const char motion_type, const char *motion_expr) {}

// #28        

 virtual void API_SendOffCurveJointMotion(const int num_curve_motion,

         const int idx, const int id,

         const int joint_id, const char joint_type, const char motion_type,

         const char *interpol_type, const int curve_id) {}

 

// #29

 virtual void API_SendOffLinearTranslationalSpringDamper(const int num_lin_tsd,

         const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id,

         const double length, const double stiffness, const double damping,

         const double preload) {}

// #30

 virtual void API_SendOffGeneralTranslationalSpringDamper(

         const int num_general_tspdp, const int idx, const int id,

         const int i_marker_id,const int j_marker_id,const int body1_id,

         const int body2_id,const double length,

         const int is_k_expression, const char *k_expression,

         const int is_c_expression, const char *c_expression,

         const int is_k_curve, const char *k_interpol_type,

         const char *k_indep_var, const int k_curve_id,

         const int is_c_curve, const char *c_interpol_type,

         const char *c_indep_var, const int c_curve_id) {}        

// #31

 virtual void API_SendOffLinearRotationalSpringDamper(const int num_lin_rsd,

         const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id,

         const double length, const double stiffness, const double damping,

         const double preload) {}

// #32

 virtual void API_SendOffGeneralRotationalSpringDamper(

         const int num_general_rspdp, const int idx, const int id,

         const int i_marker_id,const int j_marker_id,const int body1_id,

         const int body2_id,const double length,

         const int is_k_expression, const char *k_expression,

         const int is_c_expression, const char *c_expression,

         const int is_k_curve, const char *k_interpol_type,

         const char *k_indep_var, const int k_curve_id,

         const int is_c_curve, const char *c_interpol_type,

         const char *c_indep_var, const int c_curve_id) {}

// #33

 virtual void API_SendOffBeam(const int num_beam, const int idx,

         const int id, const int i_marker_id,

         const int j_marker_id, const int body1_id, const int body2_id,

         const double length, const double E, const double G, const double area,

         const double ixx, const double iyy, const double ASY, const double ASZ,

         const double cratio) {}        

 

// #34        

 virtual void API_SendOffLinearBushing(const int num_lin_bush,

         const int idx, const int id,

         const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id,

         const double kx, const double cx, const double preload_x,

         const double ky, const double cy, const double preload_y,

         const double kz, const double cz, const double preload_z,

         const double ktx, const double ctx, const double preload_tx,

         const double kty, const double cty, const double preload_ty,

         const double ktz, const double ctz, const double preload_tz) {}

// #35

 virtual void API_SendOffGeneralBushing(const int num_general_bush,

         const int idx, const int id,

         const int i_marker_id,const int j_marker_id,

         const int body1_id,const int body2_id,                

         const int is_kx_expression, const char *kx_expression,

         const int is_cx_expression, const char *cx_expression,

         const int is_kx_curve, const char *kx_interpol_type,

         const char *kx_indep_var, const int kx_curve_id,

         const int is_cx_curve, const char *cx_interpol_type,

const char *cx_indep_var, const int cx_curve_id,                

         const int is_ky_expression, const char *ky_expression,

const int is_cy_expression, const char *cy_expression,

         const int is_ky_curve, const char *ky_interpol_type,

const char *ky_indep_var, const int ky_curve_id,

         const int is_cy_curve, const char *cy_interpol_type,

const char *cy_indep_var, const int cy_curve_id,                        

         const int is_kz_expression, const char *kz_expression,

         const int is_cz_expression, const char *cz_expression,

         const int is_kz_curve, const char *kz_interpol_type,

         const char *kz_indep_var, const int kz_curve_id,

         const int is_cz_curve, const char *cz_interpol_type,

         const char *cz_indep_var, const int cz_curve_id,                

         const int is_ktx_expression, const char *ktx_expression,

         const int is_ctx_expression, const char *ctx_expression,

         const int is_ktx_curve, const char *ktx_interpol_type,

         const char *ktx_indep_var, const int ktx_curve_id,

         const int is_ctx_curve, const char *ctx_interpol_type,

         const char *ctx_indep_var, const int ctx_curve_id,        

         const int is_kty_expression, const char *kty_expression,

         const int is_cty_expression, const char *cty_expression,

         const int is_kty_curve, const char *kty_interpol_type,

         const char *kty_indep_var, const int kty_curve_id,

         const int is_cty_curve, const char *cty_interpol_type,

         const char *cty_indep_var, const int cty_curve_id,

         const int is_ktz_expression, const char *ktz_expression,

         const int is_ctz_expression, const char *ctz_expression,

         const int is_ktz_curve, const char *ktz_interpol_type,

         const char *ktz_indep_var, const int ktz_curve_id,

         const int is_ctz_curve, const char *ctz_interpol_type,

         const char *ctz_indep_var, const int ctz_curve_id) {}

 

// #36

 virtual void API_SendOffActionOnlyConstantForce(

         const int num_action_only_const_force, const int idx,

         const int id, const int i_marker_id, const int ref_marker_id,

         const int body_id, const int ref_body_id,

         const double fx, const double fy, const double fz) {}

// #37

 virtual void API_SendOffActionOnlyConstantTorque(

         const int num_action_only_const_torque, const int idx,

         const int id, const int i_marker_id,

         const int ref_marker_id, const int body_id, const int ref_body_id,

         const double tx, const double ty, const double tz) {}

// #38

 virtual void API_SendOffActionReactionConstantForce(

         const int num_action_reac_const_force, const int idx,

         const int id, const int i_marker_id,

         const int j_floating_marker_id, const int ref_marker_id,

         const int body1_id, const int body2_id, const int ref_body_id,

         const double fx, const double fy, const double fz) {}

// #39

 virtual void API_SendOffActionReactionConstantTorque(

         const int num_action_reac_const_torque, const int idx,

         const int id, const int i_marker_id,

         const int j_floating_marker_id, const int ref_marker_id,

         const int body1_id, const int body2_id, const int ref_body_id,

         const double tx, const double ty, const double tz) {}

// #40

 virtual void API_SendOffConstantScalarForce(

         const int num_const_scalar_force, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id, const double force) {}

// #41

 virtual void API_SendOffConstantScalarTorque(

         const int num_const_scalar_torque, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id, const double torque) {}

// #42

 virtual void API_SendOffActionOnlyGeneralForce(

         const int num_action_only_const_force, const int idx,

         const int id, const int i_marker_id,

         const int ref_marker_id, const int body_id, const int ref_body_id,

         const int is_fx_expression, const char *fx_expression,

         const int is_fy_expression, const char *fy_expression,

         const int is_fz_expression, const char *fz_expression,

         const int is_fx_curve, const char *fx_interpol_type,

         const char *fx_indep_var, const int fx_curve_id,

         const int is_fy_curve, const char *fy_interpol_type,

         const char *fy_indep_var, const int fy_curve_id,                

         const int is_fz_curve, const char *fz_interpol_type,

         const char *fz_indep_var, const int fz_curve_id) {}

// #43

 virtual void API_SendOffActionOnlyGeneralTorque(

         const int num_action_only_general_torque, const int idx,

         const int id, const int i_marker_id,

         const int ref_marker_id, const int body_id, const int ref_body_id,

         const int is_tx_expression, const char *tx_expression,

         const int is_ty_expression, const char *ty_expression,

         const int is_tz_expression, const char *tz_expression,

         const int is_tx_curve, const char *tx_interpol_type,

         const char *tx_indep_var, const int tx_curve_id,

         const int is_ty_curve, const char *ty_interpol_type,

         const char *ty_indep_var, const int ty_curve_id,                

         const int is_tz_curve, const char *tz_interpol_type,

         const char *tz_indep_var, const int tz_curve_id) {}

// #44

 virtual void API_SendOffActionReactionGeneralForce(

         const int num_action_reac_general_force, const int idx,

         const int id, const int i_marker_id,

         const int j_floating_marker_id, const int ref_marker_id,

         const int body1_id, const int body2_id, const int ref_body_id,

         const int is_fx_expression, const char *fx_expression,

         const int is_fy_expression, const char *fy_expression,                

         const int is_fz_expression, const char *fz_expression,

         const int is_fx_curve, const char *fx_interpol_type,

         const char *fx_indep_var, const int fx_curve_id,

         const int is_fy_curve, const char *fy_interpol_type,

         const char *fy_indep_var, const int fy_curve_id,                

         const int is_fz_curve, const char *fz_interpol_type,

         const char *fz_indep_var, const int fz_curve_id) {}

// #45

 virtual void API_SendOffActionReactionGeneralTorque(

         const int num_action_reac_general_torque, const int idx,

         const int id, const int i_marker_id,

         const int j_floating_marker_id, const int ref_marker_id,

         const int body1_id, const int body2_id, const int ref_body_id,

         const int is_tx_expression, const char *tx_expression,

         const int is_ty_expression, const char *ty_expression,                

         const int is_tz_expression, const char *tz_expression,

         const int is_tx_curve, const char *tx_interpol_type,

         const char *tx_indep_var, const int tx_curve_id,

         const int is_ty_curve, const char *ty_interpol_type,

         const char *ty_indep_var, const int ty_curve_id,                

         const int is_tz_curve, const char *tz_interpol_type,

         const char *tz_indep_var, const int tz_curve_id) {}

// #46

 virtual void API_SendOffGeneralScalarForce(

         const int num_general_scalar_force, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id,

         const int is_force_expression, const char *force_expression,

         const int is_force_curve, const char *force_interpol_type,

         const char *force_indep_var, const int force_curve_id) {}

// #47

 virtual void API_SendOffGeneralScalarTorque(

         const int num_general_scalar_torque, const int idx,

         const int id, const int i_marker_id, const int j_marker_id,

         const int body1_id, const int body2_id,

         const int is_torque_expression, const char *torque_expression,

         const int is_torque_curve, const char *torque_interpol_type,

         const char *torque_indep_var, const int torque_curve_id) {}

 

// #48        

 virtual void API_SendOffXYCurveData(const int num_curve,

         const int idx, const int id,

         const int num_xy_pair, const double *x_val, const double *y_val) {}

// #49

 virtual void API_SendOffTemplate(const int num_template,

         const int idx, const char *text) {}

};