[770c98]: / Tools / ModelUtilities / SolidModeling / SolidModelingTestDemo.Main.any

Download this file

160 lines (150 with data), 4.7 kB

#include "SolidModeling.any"

Main = 
{
  // Folder for design parameters
  AnyFolder DesignParameters = 
  {
      AnyVar box_length_x = 2;
      AnyVar box_length_y = 0.5;
      AnyVar box_length_z = 2;
      AnyVec3 box_r0 = {0, 1.75, 0};
      AnyVec3 box_Axes0_in_deg = {0,0,0};
      AnyVar box_density = 100;
      AnyVec3 box_color = {1,0,0};
      
      AnyVar cyl_radius = 0.5;
      AnyVar cyl_length = 1;
      AnyVec3 cyl_r0 = {0, 0.75, 0};
      AnyVec3 cyl_Axes0_in_deg = {-90,0,0};
      AnyVar cyl_density = 100;
      AnyVec3 cyl_color = {0,0,1};
  };

  // Folder for solid modeling operations
  AnyFolder SolidModelingOperations =
  {
       //--> Creating box operation
       CreateBox Box1(
       InputName = Box1,
       InputPlacement = Main.MyModel.Segs,
       InputLengthX = Main.DesignParameters.box_length_x,
       InputLengthY = Main.DesignParameters.box_length_y,
       InputLengthZ = Main.DesignParameters.box_length_z,
       InputDensity = Main.DesignParameters.box_density)
       =
       {
         Pos0 = Main.DesignParameters.box_r0;
         RotAnglesInDegree0 = Main.DesignParameters.box_Axes0_in_deg;
         Color = Main.DesignParameters.box_color;
         Opacity = 0.5;
         ScaleFactorForLocalFrame = 1;
         ScaleFactorForLocalRefNodes  = 0.2;
       };
       //<--
       //-->Definitions for some additional AnyRefNode objects
       Main.MyModel.Segs.Box1 = 
       {
           AnyRefNode new_bottom_node =
           {
               sRel = {0, -Main.DesignParameters.box_length_y /2, 0};
               AnyDrawRefFrame drw = 
               {
                   RGB = {1,0,1};
                   ScaleXYZ = 0.5*{1,1,1};
               };
           };
       };
       //<--
       
       //--> Creating a cylinder operation
       CreateCylinder Cyl1(
       InputName = Cyl1,
       InputPlacement = Main.MyModel.Segs,
       InputRadius = Main.DesignParameters.cyl_radius,
       InputLength = Main.DesignParameters.cyl_length,
       InputDensity = Main.DesignParameters.cyl_density) 
       = 
       {
         Pos0 = Main.DesignParameters.cyl_r0;
         RotAnglesInDegree0 = Main.DesignParameters.cyl_Axes0_in_deg;
         Color = Main.DesignParameters.cyl_color;
         Opacity = 0.5;
         ScaleFactorForLocalFrame = 0.5;
         ScaleFactorForLocalRefNodes  = 0;         
       };
       //<--
       //-->Definitions for some additional AnyRefNode objects
       Main.MyModel.Segs.Cyl1 =
       {
           AnyRefNode new_bottom_node =
           {
               sRel = {0 ,0, -Main.DesignParameters.cyl_length/2};
               ARel = RotMat(90*pi/180,x);
               AnyDrawRefFrame drw = 
               {
                   RGB = {1,1,1};
                   ScaleXYZ = 0.5*{1,1,1};
               };
           };
           AnyRefNode new_top_node =
           {
               sRel = {0 ,0, Main.DesignParameters.cyl_length/2};
               ARel = RotMat(90*pi/180,x);
               AnyDrawRefFrame drw = 
               {
                   RGB = {1,1,1};
                   ScaleXYZ = 0.5*{1,1,1};
               };
           };              
       };
       //<--       
  };

  // Folder for all model information
  AnyFolder MyModel = 
  {
    AnyFixedRefFrame GlobalRef = 
    {
       AnyDrawRefFrame Drw_GlobalRef = 
       {
           RGB = {0,1,0};
           ScaleXYZ = 1 * {1, 1, 1};
       };
    };  
    
    AnyFolder Segs = {};
    
    AnyFolder Joints = 
    {
        AnyRevoluteJoint Rev_Jnt1 =
        {
            AnyRefFrame& base = ..GlobalRef;
            AnyRefFrame& target = ..Segs.Cyl1.new_bottom_node;
            Axis = y;
            Ref = 0;            
        };
        AnyRevoluteJoint Rev_Jnt2 = 
        {
            AnyRefFrame& baes = ..Segs.Cyl1.new_top_node;
            AnyRefFrame& target = ..Segs.Box1.new_bottom_node;
            Axis = y;
            Ref = 0;
        };
    };
    
    AnyFolder Drivers = 
    {
        AnyKinEqPolynomialDriver drv1 = 
        {
            AnyKinMeasure& jnt = ..Joints.Rev_Jnt1;
            PolyCoef = pi/180*{{0,90,90}};
            Reaction.Type = {On};
        };    
        AnyKinEqSimpleDriver drv2 = 
        {
            AnyKinMeasure& jnt = ..Joints.Rev_Jnt2;
            DriverPos = pi/180*{0};
            DriverVel = pi/180*{-180};
            Reaction.Type = {On};
        };
    };
  }; 
  
  AnyBodyStudy MyStudy = 
  {
    AnyFolder &Model = .MyModel;
    Gravity = {0.0, -9.81, 0.0};
  };

};