Exemple #1
0
        /// Use this function after gear creation, to initialize it, given two shafts to join.
        /// Each shaft must belong to the same ChSystem.
        /// Derived classes might overload this (here, basically it only sets the two pointers)
        public virtual bool Initialize(ChShaft mshaft1, //< first  shaft to join
                                       ChShaft mshaft2  //< second shaft to join
                                       )
        {
            ChShaft mm1 = mshaft1;
            ChShaft mm2 = mshaft2;

            // assert(mm1 && mm2);
            // assert(mm1 != mm2);
            // assert(mm1->GetSystem() == mm2->GetSystem());
            shaft1 = mm1;
            shaft2 = mm2;
            SetSystem(shaft1.GetSystem());
            return(true);
        }
Exemple #2
0
        /// Use this function after object creation, to initialize it, given
        /// the 1D shaft and 3D body to join.
        /// Each item must belong to the same ChSystem.
        /// Direction is expressed in the local coordinates of the body.
        public bool Initialize(ChShaft mshaft,    //< shaft to join
                               ChBodyFrame mbody, //< body to join
                               ChVector mdir      //< the direction of the shaft on 3D body (applied on COG: pure torque)
                               )
        {
            ChShaft     mm1 = mshaft;
            ChBodyFrame mm2 = mbody;

            //Debug.Assert(mm1 == null && mm2 == null);

            shaft          = mm1;
            body.BodyFrame = mm2;
            shaft_dir      = ChVector.Vnorm(mdir);

            constraint.SetVariables(mm1.Variables(), mm2.Variables());

            SetSystem(shaft.GetSystem());
            return(true);
        }