Need help with a idea for a time lapse using the feature tree.
Comments
-
I would love a tool which would step through the feature tree in some sort of controlled fashion. It is possible now to select the roll back bar and use the arrow keys to roll forward (or back). If you just screen record a video of this, it might be close enough to what you want.
Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn
1 -
You could do this using the REST API. Here is an outline of the algorithm & relevant API calls
1. Get the list of features (https://cad.onshape.com/glassworks/explorer#/PartStudio/getPartStudioFeatures)
2. For each feature, move the rollback bar by 1. ( https://cad.onshape.com/glassworks/explorer#/PartStudio/updateRollback )
3. Get a snapshot of the part studio ( https://cad.onshape.com/glassworks/explorer#/PartStudio/getPartStudioShadedViews ) & save to file.
4. Repeats step 2,3 until you are done with features.
HTH.1 -
I do something similar on Linux with a little (very hacky) shell script.
It basically works like this:
- Manually set the number of features in your file (55 in my example)
- Manually move the rollback bar to the top
- Run the script; it will wait for 3 seconds allowing you to select the rollback bar again by clicking on it
- The script will fake a 'down arrow' keypress, wait a second, take a screenshot, wait another second and repeats this 55 times until all features are applied.
I might try to make a little python script that does something similar using the API (so you don't need to set the number of features manually) but for now this works fine for my needs. If you're on Windows / Macos there are many apps that let you control your system in a similar way (for Windows there is AutoIt for example). You could use one of those programs to set up a similar loop.
In the end I use ffmpeg to combine the frames into an animation (but again there is also GUI based software that can do this for you).
ffmpeg -framerate 24 -pattern_type glob -i "*.png" -c:v libx264 -pix_fmt yuv420p output.mp4My shellscript (also online as a gist on Github )
#!/bin/bash
sleep 3
for i in $(seq 1 55); do
echo "Iteration: $i of 55"
# Press the Arrow Down key using xdotool
xdotool key Down
sleep 1
# Replace "Part Studio" with the actual window title or part of it
WINDOW_ID=$(xdotool search --name "Part Studio" | head -n 1)
import -window "$WINDOW_ID" ~/screenshots/screenshot_$(date +%Y%m%d_%H%M%S).png
sleep 1
done0 -
I've written a quick test script using the API as described by @Paul_J_Premakumar. The script is very much WIP (but does work), but I like the result less than the 'real' screenshot option; seeing the sketches and some of the UI is a bit more interesting. Might depend on your needs though.
As this forum doesn't allow formatting code, and Python code breaks when it looses the right indentation, I've made a gist on Github:
https://gist.github.com/javl/b0ec23ce20e3a06160ed28aada3a5a34
1


