![](http://take-web.com/cad/wp-content/uploads/2018/06/SnapCrab_2018-6-1_6-0-28.png)
コマンド入力できるCADソフト、Autohotkeyで自動化することができそうなのでいろいろと実験してます。
上の画像は、LibreCADに円を描きたものです。
円作成 for LibreCAD
原点から、中心点(半径,半径)の円を描きます。
B up:: Gui, +ToolWindow AlwaysOnTop ;; 最小・最大ボタンなし Gui, Font, S12 Gui, Add, Checkbox, x20 y25 w100 h25 v_diameter, 直径の時 Gui, Add, Edit, x15 y60 w120 h30 v_size , Gui, Add, Button, x20 y100 w100 h25 gDrawCircle Default, OK ;;--------- Gui, Show, x1600 h150 w150, 円作成 ;;窓を表示 Send,{Tab} ;;TAB {}が必要 Return DrawCircle: Gui, Submit ;;変数GET SetTitleMatchMode,2 ;;タイトル部分一致 WinActivate, LibreCAD send, ci send, {Enter} send, %_size% , %_size% ;;XY座標 send, {Enter} send, %_size% ;; 半径 send, {Enter} send, za ;; ズームオート send, {Enter} Gui, Destroy ;; 変数開放 Return
最後の行の「Gui, Destory」がないと、次のエラーが出てしまいます。
同じ変数を定義してはいけない?
Error: The same variable cannot be used for more than one control.
LibreCADの記事:
![LibreCAd座標入力](http://take-web.com/cad/wp-content/uploads/2018/06/2020-5-21_4-33_No-00.png)
for QCAD
円作成スクリプト
![](http://take-web.com/cad/wp-content/uploads/2018/06/SnapCrab_2018-6-1_14-50-14.png)
コードは99%、LibreCADと同じです。
違うのはこれだけ(15行目)
WinActivate, QCAD
LibreCADをQCADに変えてください。
geometric pattern
![](https://take-web.com/cad/wp-content/uploads/2021/11/geometric-pattern01.png)
n:=0
i:= cnt
k:= cnt-3
Loop, %i%
{
Loop, %k% ;10回繰り返す
{
send, ci
send, {Enter}
sleep, 500
send, %x% , %y% ;;XY座標
send, {Enter}
send, %size% ;; 半径
send, {Enter}
y := y+15
}
;k := k-Mod(n,2)
x :=0
y :=0
n := n+1
x := x+(15*cos(30*(3.14/180)))*n
y := y+(15*sin(30*(3.14/180)))*Mod(n,2)
}
円作成 for DraftSight
![](http://take-web.com/cad/wp-content/uploads/2018/06/SnapCrab_2018-6-8_17-1-20.png)
B up:: Gui, +ToolWindow AlwaysOnTop ;; 最小・最大ボタンなし Gui, Font, S12 Gui, Add, Checkbox, x20 y25 w100 h25 v_diameter, 直径の時 Gui, Add, Edit, x15 y60 w120 h30 v_size , Gui, Add, Button, x20 y100 w100 h25 gDrawCircle Default, OK ;;--------- Gui, Show, x1200 h150 w150, 円作成 ;;窓を表示 Send,{Tab} ;;TAB {}が必要 Return DrawCircle: Gui, Submit ;;変数GET SetTitleMatchMode,2 ;;タイトル部分一致 WinActivate, DraftSight ;;DraftSight send, circle send, {Enter} send, %_size%,%_size% ;;XY座標 半角スペース入れてはいけない。 send, {Enter} send, %_size% ;; 半径 send, {Enter} send, Zoomfit ; ズームオート send, {Enter} Gui, Destroy ; 変数開放 Return ;;GuiClose: ;;ExitApp
コメント