LoginSignup
1
2

More than 5 years have passed since last update.

Ubuntu > マウスクリックの自動化 > Tinkercadの操作が面倒なので > 下に移動しながらスライス | link:Iron Man Bust by tails_, published Nov 12, 2014

Last updated at Posted at 2018-03-24

ブラウザ動作するAutoDeskのTinkercad。

動作環境
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 16.04 LTS desktop amd64
TensorFlow v1.2.1
cuDNN v5.1 for Linux
CUDA v8.0
Python 3.5.2
IPython 6.0.0 -- An enhanced Interactive Python.
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
scipy v0.19.1
geopandas v0.3.0
MATLAB R2017b (Home Edition)
ADDA v.1.3b6
gnustep-gui-runtime v0.24.0-3.1

関連

スライシングの手順と問題

Tinkercadで積層モデルのレーザーカット用.svgファイルを作る手順は以下の通り。

  1. Exportクリック
  2. .svgクリック
  3. Ctrl + A
  4. Ctrl + 下カーソル
  5. 1から繰り返す (積層数)
    • 40秒おきくらい (Tinkercadの処理時間を考慮して)

44回繰り返してDelta Flyerの.svgファイルを作ったが、面倒なのでもう一回実行したいとは思わない。

自動化しよう。

マウスクリックの自動化

xdotoolを使う。

前準備としてExportボタンと.svgの位置を調べる。
(ボタンの表示位置はブラウザ(Chromeなど)のファイルダウンロード済があるかどうかで変化する。
1つのファイルをダウンロードした状態で座標位置を取得すること。また、実行時もダウンロード済がある状態で行うこと。
)
マウスを該当ボタンの位置に移動して、Alt+Tabでターミナルに移動して、以下を実行する。

$ xdotool getmouselocation
x:2378 y:287 screen:0 window:54525962

上記の情報(Exportボタンと.svg選択)を元にスクリプトを書く。

auto_save_svg_tinkercad_180324_exec
#!/usr/bin/env bash

# location of the mouse click dpends on the environment
# check with 
# xdotool getmouselocation

for loop in $(seq 1 5)
do
    xdotool mousemove 2378 287 click 1 &  # Export
    sleep 1
    xdotool mousemove 1762 862 click 1 &  # .svg
    sleep 40
done

使用

Tinkercadの画面を開いてターミナルから下記を実行する。

$ bash auto_save_svg_tinkercad_180324_exec

処理中は他の作業はしない方がいいかもしれない。

下に移動しながらスライス

  • Ctrl + Aなどキークリックの送信。

下記の実装でオブジェクトを-3.0下に移動しながらスライスできる。

auto_save_svg_tinkercad_180324_exec
#!/usr/bin/env bash

# location of the mouse click dpends on the environment
# check with 
# xdotool getmouselocation

for loop in $(seq 1 5)
do
    xdotool mousemove 2378 287 click 1 &  # Export
    sleep 1
    xdotool mousemove 1762 862 click 1 &  # .svg
    sleep 40
    xdotool key ctrl+a
    xdotool key ctrl+Down
    xdotool key ctrl+Down
    xdotool key ctrl+Down
    sleep 1
done

qiita.png

bashスクリプトが自動的にDelta Flyerをスライスしていている間に、こちらはサンマを三枚におろす (v0.5)。

Iron Man Bust by tails_, published Nov 12, 2014

https://www.thingiverse.com/thing:540937
からSTLを取得し、上記の処理でスライスした。

そのスライスをTinkercadでインポートし、仮組み実施。
(仮組み作業時間: 28分)

https://www.tinkercad.com/things/cMpamE8YClk
qiita.png

これじゃないロボ発進。

分解能を上げればSTLと似てくるだろうが、*万円コースのレーザーカットになってしまうだろう。

以下はスライスの進む方向を横にした場合。顔の特徴が出てきた。

qiita.png

SVGファイルを作ってみた。
A3 サイズとなった。
https://www.dropbox.com/s/mqgtx9gtax1i655/A3_IronMan_180325.svg?dl=0
部品のいくつかは小さすぎて、カットした後に台座下に落ちるサバイバル形式。

qiita.png

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2