Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Animating a train around a track

sarah_jacquessarah_jacques Member Posts: 5 EDU
I am trying to get a train to move around a train track and I am having trouble constraining the train to the track. I have been able to get the train to rotate around a pivot point while the wheels turn but the train is just floating in mid air. I have done this in Inventor, but not having some of the same constraints such as the mate, flush and angle constraint is really throwing me off. Any help would be greatly appreciated. Here is a link to the file: https://cad.onshape.com/documents/54227ea1cae17752668aaf85/w/1b9805dae8028477adc30e47/e/6c7edcc322101c9aaba99398

Comments

  • bradley_saulnbradley_sauln Moderator, Onshape Employees, Developers Posts: 373
    https://cad.onshape.com/documents/f667cd99c73d3979b0627c52/w/945fccdc489249ae4168396d/e/204bc4f6c8b5c970262540a9

    You need some sort of controlling parts. I have a few hidden to help drive the car around the tracks. It seems to stop short of one revolution so I'm am trying to debug that now.


    Engineer | Adventurer | Tinkerer
    Twitter: @bradleysauln


  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    edited April 2020
    https://cad.onshape.com/documents/292af20b6c06ac868e964caa/w/0e0df349e4eb1fb849ff3f48/e/066aadce57bdce7255d3e23d
    Here in another old example with dual tracks



    Edit: Just realized you asked about animating. not just mating.

    Clever use of the revolute/slider mate bradley. For a more constant speed though, a lot more work will need to be done.
    If you need it to zig/zag like we are showing, You will likely need a couple of relations that reference an X and Y axis, then plot the path specifically for the track.

    Fortunately for you Sarah, you only have a circular track. So Bradley's method will be perfect for that configuration.
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    https://cad.onshape.com/documents/f667cd99c73d3979b0627c52/w/945fccdc489249ae4168396d/e/204bc4f6c8b5c970262540a9

    You need some sort of controlling parts. I have a few hidden to help drive the car around the tracks. It seems to stop short of one revolution so I'm am trying to debug that now.


    @bradley_sauln
    It seems to be stopping because the track goes a little bit back on itself in relation to the rotation
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • bradley_saulnbradley_sauln Moderator, Onshape Employees, Developers Posts: 373
    Great observation @MBartlett21! That's definitely it
    Engineer | Adventurer | Tinkerer
    Twitter: @bradleysauln


  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    @bradley_sauln
    It also seems to be happening slightly on another bit (highlighted in the image below). It only stops it working when I set steps to a large value, like 3000.

    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • sarah_jacquessarah_jacques Member Posts: 5 EDU
    @bradley_sauln @MBartlett21
    So what constraints should I actually do to get the train onto the track? I can't seem to get the train to stay on the track, I have tried the tangent contraint, planar constraint, and some of the other constraints.
  • bradley_saulnbradley_sauln Moderator, Onshape Employees, Developers Posts: 373
    It will be a combination. The tangent mate is most important for ensuring that the wheels stay on the track to look visually correct. You should make a copy of the document I created and investigate how I set  up the mates. You only need to make 1 wheel tangent.
    Engineer | Adventurer | Tinkerer
    Twitter: @bradleysauln


  • sarah_jacquessarah_jacques Member Posts: 5 EDU
    @bradley_sauln
    I am sorry to keep asking questions, it's been really hard trouble shooting this without another set of eyes. I have spent quite awhile looking at what you have and then trying to do something similar with mine. I tried to do the planar mate, but then it's not letting me do the tangent mate with my wheels. I have tried changing the shape of the wheel, changing dimensions of the track, making the track all one part instead of circular patterning and I am still not getting anywhere. I can get the train to revolve around, but can't seem to get it to stay on the track. I really have been spinning my wheels. Any help would be so appreciated. Thanks!
  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    edited May 2020
    Instead of tanget to the wheel try addinh an offset mate connector in your part studio. Tangent mates (in all cad) are usually wonky

    P. S. No need to apologize, that's why we visit the forum, to answer questions. 
  • steve_shubinsteve_shubin Member Posts: 1,096 ✭✭✭✭
    edited May 2020
    @sarah_jacques

    I don’t know if this will help or not. But for what it’s worth ...

    In the document below, there’s a swingarm that always has some kind of forward progress along the track as that arm revolves. SEE THE POST BELOW

    https://cad.onshape.com/documents/ad6c0e6162ce8afa575e0b1e/w/f79066c5115e583468e0b5ca/e/9e63f1c1ffdaa1a0b63d9bd2




  • steve_shubinsteve_shubin Member Posts: 1,096 ✭✭✭✭
    edited May 2020

    When laying out the track, It looks like when the swingarm became tangent to the track, or crossed a point tangent or parallel to the track, that no forward progress was being made along the revolve at that time, and it caused the no forward movement of the swing arm to conflict with the engine trying to revolve that swing arm. So at that point, the animation would either hang or make the car jump along the track

    So the track is designed to not have any sections where swing arm becomes tangent or parallel to the track


  • steve_shubinsteve_shubin Member Posts: 1,096 ✭✭✭✭
    edited May 2020
    @sarah_jacques

    This is more like the round track you have

    • There are planar mates — one at the origin and one at the bottom side of the car
    • There is a tangent mate connection from one edge of the swing arm to the front inside corner of the car
    • There are revolute mates — one at the origin and one at the end of the swing arm
    • There are tangent mates at the front and back outside corners of the car, and, at the outside edge of the track
    1. The planar mates keep the car flat on the top plane
    2. The revolute mates on the swingarm and tangent mate connection at the front of the car, drag the car in a circular motion
    3. The tangent mates on the outside front and back corners of the car, and the outside of the track, keep the car on the track








Sign In or Register to comment.