gdbaldw / BlenderAndMBDyn

Combines Blender's graphical interface and rendering capabilities with MBDyn's multi-body dynamics, aerodynamics, and aeroelastics simulation and analysis, for rapid modeling and realistic rendering of physics based multi-body simulations.
GNU General Public License v3.0
25 stars 13 forks source link

Revolute hinge - Duplicate operation not successful #10

Closed timgow closed 8 years ago

timgow commented 8 years ago

Hi, I'm working through the 'BAM v2 - rigidpendulum tutorial example'. The images below show the clamp (cube appearance), the first revolute hinge and the outcome of duplicating the first revolute hinge. I've renamed the second revolute hinge to Revolute_hinge_2. The issue arises when I attempt to change the second hinge to be associated with the first hinge rather than the clamp; no drop-down menu entry appears for 'Reassign objects'. This issue could perhaps be related to the clamp appearance issue? Could the clamp definition be faulty and this effects the hinge duplication? Tim

screenshot revolute hinge img01 screenshot revolute hinge img02 screenshot revolute hinge img03 screenshot-tutorial-revolutehinge-reassign

timgow commented 8 years ago

Doug, The reassignment issue is present in the latest code (clamp shape now good). Tim

timgow commented 8 years ago

Hi, I have worked around the duplication issue, I believe, by creating a 3rd 'mesh>cube' from with to create the 2nd revolute hinge (rigid pendulum tutorial). The MBS model runs fine and animates ok until the end of the animation, where the reference frame with the 0.2rad/s angular velocity reverts from the -90° about X-axis inclination to the initial creation rx=0,ry=0,rz=0. The MBDyn input file becomes a bit confusing with the proliferation of Revolutehinge[] labels. Do you see an obvious cause or any error in the model construction? May I send the blender file by some means? Please see ascii that I can cut and paste below.

terminal output

tim@tim-AMILO-Pro-V2045:~/examples$ blender
connect failed: No such file or directory
Read new prefs: /home/tim/.config/blender/2.75/config/userpref.blend
read blend: /home/tim/examples/30Sep15_10.blend
mbdyn -s -f /home/tim/examples/30Sep15_10/Scene.001.mbd
Info: Gravity: <type> expected at line 131, file </home/tim/examples/30Sep15_10/Scene.001.mbd>; assuming "uniform"

Saved session recovery to '/tmp/quit.blend'

Blender quit
tim@tim-AMILO-Pro-V2045:~/examples$

Scene.001.mbd content

begin: data;
    problem: initial value;
end: data;

begin: initial value;
    initial time: 0;
    final time: 10;
    strategy: no change;
    time step: 0.001;
    tolerance: 1e-06;
    max iterations: 10;
    derivatives tolerance: 2;
    derivatives max iterations: 1;
    derivatives coefficient: 0.001;
end: initial value;

begin: control data;
    select timeout: forever;
    default orientation: orientation matrix;
    output meter: meter, 0, forever, steps, 1;
    output precision: 6;
    default output:
        reference frames,
        abstract nodes,
        electric nodes,
        hydraulic nodes,
        structural nodes,
        accelerations,
        aerodynamic elements,
        air properties,
        beams,
        electric elements,
        forces,
        genels,
        gravity,
        hydraulic elements,
        joints,
        rigid bodies,
        induced velocity elements;
    structural nodes: 3;
    joints: 3;
    rigid bodies: 1;
    gravity;
end: control data;

set: const integer Reference_frame = 0;
reference: Reference_frame,
    reference, global, 0, 0, 0,
    reference, global, matr,
        1, 0, 0,
        0, 0, 1,
        0, -1, 0,
    reference, global, 0, 0, 0,
    reference, global, 0, 0.2, 0;

set: const integer Node = 0;
set: const integer Revolute_hinge_1 = 1;
set: const integer Revolute_hinge_2 = 2;
begin: nodes;
    structural: Node, static,
        reference, global, 0, 0, 0,
        reference, global, matr,
            1, 0, 0,
            0, 0, 1,
            0, -1, 0,
        reference, global, null,
        reference, global, null;
    structural: Revolute_hinge_1, static,
        reference, Reference_frame, 0, 0, 0,
        reference, Reference_frame, matr,
            1, 0, 0,
            0, 1, 0,
            0, 0, 1,
        reference, Reference_frame, null,
        reference, Reference_frame, null;
    structural: Revolute_hinge_2, dynamic,
        reference, global, 0, 0, -0.5,
        reference, global, matr,
            1, 0, 0,
            0, 0, 1,
            0, -1, 0,
        reference, global, null,
        reference, global, null;
end: nodes;

set: const integer Meter_drive = 0;
set: const integer Unit_drive = 1;
drive caller: Meter_drive, meter, 0, forever, steps, 1;
drive caller: Unit_drive, unit;

set: const integer Body = 0;
set: const integer Clamp = 1;
set: const integer Gravity = 2;
set: const integer Revolute_hinge = 3;
set: const integer Revolute_hinge_001 = 4;
begin: elements;
    body: Body,
        Revolute_hinge_2,
            1,
            0, 0, 0, 
            eye,
            inertial, matr,
                1, 0, 0,
                0, 1, 0,
                0, 0, 1;
    joint: Clamp, clamp,
        Node, node, node;
    joint: Revolute_hinge, revolute hinge,
        Revolute_hinge_1, 0, 0, 0,
            hinge, matr,
                1, 0, 0,
                0, 1, 0,
                0, 0, 1, 
        Node, 0, 0, 0,
            hinge, matr,
                1, 0, 0,
                0, 1, 0,
                0, 0, 1;
    joint: Revolute_hinge_001, revolute hinge,
        Revolute_hinge_2, 0, 0, 0,
            hinge, matr,
                1, 0, 0,
                0, 1, 0,
                0, 0, 1, 
        Revolute_hinge_1, 0, 0.5, 0,
            hinge, matr,
                1, 0, 0,
                0, 1, 0,
                0, 0, 1;
    gravity: 
            0, 0, -1, scale, 9.81, reference, Unit_drive;
end: elements;

Tim

gdbaldw commented 8 years ago

Tim, The simple answer to your animation question is this. Before animating, always be at Frame-0 in the Blender timeline, select all Objects, and from the Blender menu select Object -> Animation -> Clear keyframes. A more complete answer is that animation keyframes are overwritten from your current position in the Blender timeline, and what you are seeing at the end of your animation is keyframes left over from some other action. As for name confusion, I suggest you name the nodes, i.e. Blender Objects, to be something physical, something other than duplicates of your Element names, or just Node, Node.001, etc. For example, a Clamp element can be associated with a Ground node. Revolute hinge can be associated with a Link or a Pin. -Doug

timgow commented 8 years ago

Doug, Thank you for the duplication procedure (deselect/select objects then edit), I've used it in the rigid pendulum and all working fine now. I'll check out the animation and familiarisation with the frames index. I appreciate your patience and time to answer my questions as I blunder my way towards my crank-slider analysis. There are many layers of refinement that I can see that you've scripted within BAM, it's a fine engineering tool. Tim