goo blog サービス終了のお知らせ 

korondemoのメモ

記憶の助けとして

寸法値切り捨て切り上げ(DIESEL)

2006-03-21 18:57:02 | AutoCAD
あくまでも長さ寸法もどきです.
切り捨てて(切り上げて)小数点以下2桁までにする場合です.

切り捨て
^C^C_LINE;endp;\\$M=endp;\\;LENGTHEN;L;;"$M="ERASE;L;;dimlinear;$(getvar,lastpoint);"$(getvar,lastpoint)";T;"$(rtos,$(/,$(FIX,$(*,$(getvar,PERIMETER),100)),100),2,2)";

切り上げ
^C^C_L;endp;\\$M=endp;\\;LEN;L;;"$M="ERASE;L;;dimlinear;$(getvar,lastpoint);"$(getvar,lastpoint)";T;"$(rtos,$(/,$(FIX,$(*,$(if,$(>,$(*,$(getvar,perimeter),100),$(fix,$(*,$(getvar,perimeter),100))),$(+,$(getvar,PERIMETER),0.01),$(getvar,PERIMETER)),100)),100),2,2)";

寸法値切り捨て(平行寸法,長さ寸法,回転寸法のみ)

2006-03-17 19:09:57 | AutoCAD
(defun c:kirisute2()
(setq a1 (ssget "x"))
(setq ss (sslength a1))
(setq loop 0)
(while (<loop ss) (setq a3 (entget a2))
(setq b1 (cons 100 "AcDbAlignedDimension"))
(if (/= (member b1 a3) nil)
(progn
(setq r1 (cdr (assoc 42 a3)))
(setq keta (getvar "DIMDEC"))
(setq s2 (rtos r1 2 keta))
(setq r1 (* (fix (* (expt 10 keta) r1)) (expt 10.0 (* -1 keta))))
(setq s1 (rtos r1 2 keta))
(if (/= s1 s2)
(progn
(setq old (assoc 1 a3))
(setq new (cons 1 s1))
(setq a3 (subst new old a3))
(entmod a3)
)
)
)
)
(setq loop (+ loop 1))
)
)

寸法値切り捨て暫定版

2006-03-17 15:13:01 | AutoCAD
(defun c:kirisute()
(setq a1 (ssget "x"))
(setq ss (sslength a1))
(setq loop 0)
(while (<loop ss) (setq a3 (entget a2))
(setq b1 (cdr (assoc 0 a3)))
(if (= "DIMENSION" b1)
(progn
(setq r1 (cdr (assoc 42 a3)))
(setq keta (getvar "DIMDEC"))
(setq s2 (rtos r1 2 keta))
(setq r1 (* (fix (* (expt 10 keta) r1)) (expt 10.0 (* -1 keta))))
(setq s1 (rtos r1 2 keta))
(if (/= s1 s2)
(progn
(setq old (assoc 1 a3))
(setq new (cons 1 s1))
(setq a3 (subst new old a3))
(entmod a3)
)
)
)
)
(setq loop (+ loop 1))
)
)

円弧長寸法(位置指定可)

2006-03-11 15:33:06 | AutoCAD
;----------------------------------------------------------
; dimarc3.LSP --- 円弧長寸法記入
; コマンド名:dimarc3 --- 円弧長寸法記入
; 位置の指定をする場合
;----------------------------------------------------------

;円弧長寸法記入
(defun C:dimarc3 (/ arc ent rad sang eang arcang arclen)
;円弧の図形名と選択点を取得
(setq arc (entsel "\n円弧を選択:"))
;円弧の図形データを取得
(setq ent (entget (car arc)))
;選択図形が円弧かどうかチェック
(if (= (cdr (assoc 0 ent)) "ARC")
(progn ;図形が円弧の時、処理
;円弧の中心座標を取得
(setq c01 (cdr (assoc 10 ent)))
;円弧の半径を取得
(setq rad (cdr (assoc 40 ent)))
;円弧の始点角度を取得
(setq sang (cdr (assoc 50 ent)))
;円弧の終点角度を取得
(setq eang (cdr (assoc 51 ent)))
;始点角度と終点角度のどちらが大きいかチェック
(if (<sang eang) (setq arcang (- eang sang))
;始点角度が大きいとき
(progn
(setq eang (+ (* 2 PI) eang))
(setq arcang (- eang sang)))
)
;円弧の始点角度と終点角度の平均を計算
(setq mang (* 0.5 (+ sang eang)))
(setq cosm (cos mang))
(setq sinm (sin mang))
(setq tang (- PI (- mang sang)))
(setq cost (cos tang))
(setq sint (sin tang))
(setq l91 (* rad sint))
(setq l91 (* l91 l91))
(setq p01 (getpoint "\n弧長寸法の位置を指定"))
(setq cx (car c01))
(setq cy (cadr c01))
(setq px (car p01))
(setq py (cadr p01))
(setq sx (- px cx))
(setq sy (- py cy))
(setq l01 (- (sqrt (+ (* sx sx) (* sy sy))) rad))
(setq l92 (+ rad l01))
(setq l92 (* l92 l92))
(setq l91 (sqrt (- l92 l91)))
(setq l91 (+ l91 (* rad cost)))
;円弧の長さを計算
(setq arclen (* arcang rad))
;寸法スタイルの精度で小数点桁数を設定
(setq arclen (rtos arclen 2 (getvar "DIMDEC")))
;寸法補助線1の始点と終点
(setq x01 (+ cx (* rad (cos sang))))
(setq y01 (+ cy (* rad (sin sang))))
(setq x02 (+ x01 (* l91 cosm)))
(setq y02 (+ y01 (* l91 sinm)))
(setq p02 (list x02 y02))
(setq l02 (+ l91 (getvar "DIMEXE")))
(setq x03 (+ x01 (* l02 cosm)))
(setq y03 (+ y01 (* l02 sinm)))
(setq p03 (list x03 y03))
(setq l03 (getvar "DIMEXO"))
(setq x01 (+ x01 (* l03 cosm)))
(setq y01 (+ y01 (* l03 sinm)))
(setq p01 (list x01 y01))
;寸法補助線2の始点と終点
(setq x11 (+ cx (* rad (cos eang))))
(setq y11 (+ cy (* rad (sin eang))))
(setq x12 (+ x11 (* l91 cosm)))
(setq y12 (+ y11 (* l91 sinm)))
(setq p12 (list x12 y12))
(setq x13 (+ x11 (* l02 cosm)))
(setq y13 (+ y11 (* l02 sinm)))
(setq p13 (list x13 y13))
(setq x11 (+ x11 (* l03 cosm)))
(setq y11 (+ y11 (* l03 sinm)))
(setq p11 (list x11 y11))
;寸法補助記号えんこの座標
(setq l04 (getvar "DIMTXT"))
(setq l06 (* 0.4 (* l04 (strlen arclen))))
(setq l07 (+ l04 (* 2 (getvar "DIMGAP"))))
(setq mang2 (+ mang (* 0.5 PI)))
(if (or (<= mang PI) (> mang (* 2 PI)))
(progn
(setq l05 (+ (+ rad l01) l07))
(setq x21 (+ cx (* l05 cosm)))
(setq y21 (+ cy (* l05 sinm)))
(setq x22 (+ x21 (* l06 (cos mang2))))
(setq y22 (+ y21 (* l06 (sin mang2))))
(setq x23 (- x21 (* l06 (cos mang2))))
(setq y23 (- y21 (* l06 (sin mang2))))
(setq l05 (+ l05 (* 0.5 l06)))
(setq x21 (+ cx (* l05 cosm)))
(setq y21 (+ cy (* l05 sinm)))
(setq p21 (list x21 y21))
(setq p22 (list x22 y22))
(setq p23 (list x23 y23))
)
(progn
(setq l05 (- (+ rad l01) l07))
(setq x21 (+ cx (* l05 cosm)))
(setq y21 (+ cy (* l05 sinm)))
(setq x22 (+ x21 (* l06 (cos mang2))))
(setq y22 (+ y21 (* l06 (sin mang2))))
(setq x23 (- x21 (* l06 (cos mang2))))
(setq y23 (- y21 (* l06 (sin mang2))))
(setq l05 (- l05 (* 0.5 l06)))
(setq x21 (+ cx (* l05 cosm)))
(setq y21 (+ cy (* l05 sinm)))
(setq p21 (list x21 y21))
(setq p22 (list x22 y22))
(setq p23 (list x23 y23))
)
)
(setq o01 (getvar "OSNAPCOORD"))
(setvar "OSNAPCOORD" 1)
;コマンドエコーオフ
(setvar "CMDECHO" 0)
(command "LINE" p01 p03 "")
(command "LINE" p11 p13 "")
;角度寸法を記入し、値を円弧長さにする
(command "DIMANGULAR" "" c01 p02 p12 "T" arclen p02)
(command "DIMOVERRIDE" "DIMSE1" "ON" "DIMSE2" "ON" "" "L" "")
(command "ARC" p22 p21 p23)
;コマンドエコーオン
(setvar "CMDECHO" 1)
(setvar "OSNAPCOORD" o01)
)
;図形が円弧以外の時、メッセージボックスを表示
(alert "円弧ではありません")
)
(princ)
)

円弧長寸法

2006-03-08 19:11:01 | AutoCAD
;----------------------------------------------------------
; dimarc2.LSP --- 円弧長寸法記入
; コマンド名:dimarc2 --- 円弧長寸法記入
; 位置は並列寸法の寸法線間隔だけ離れた位置
;----------------------------------------------------------

;円弧長寸法記入
(defun C:dimarc2 (/ arc ent rad sang eang arcang arclen)
;円弧の図形名と選択点を取得
(setq arc (entsel "\n円弧を選択:"))
;円弧の図形データを取得
(setq ent (entget (car arc)))
;選択図形が円弧かどうかチェック
(if (= (cdr (assoc 0 ent)) "ARC")
(progn ;図形が円弧の時、処理
;円弧の中心座標を取得
(setq c01 (cdr (assoc 10 ent)))
;円弧の半径を取得
(setq rad (cdr (assoc 40 ent)))
;円弧の始点角度を取得
(setq sang (cdr (assoc 50 ent)))
;円弧の終点角度を取得
(setq eang (cdr (assoc 51 ent)))
;始点角度と終点角度のどちらが大きいかチェック
(if (<sang eang) (setq arcang (- eang sang))
;始点角度が大きいとき
(progn
(setq eang (+ (* 2 PI) eang))
(setq arcang (- eang sang)))
)
;円弧の始点角度と終点角度の平均を計算
(setq mang (* 0.5 (+ sang eang)))
(setq cosm (cos mang))
(setq sinm (sin mang))
(setq tang (- PI (- mang sang)))
(setq cost (cos tang))
(setq sint (sin tang))
(setq l91 (* rad sint))
(setq l91 (* l91 l91))
(setq l01 (getvar "DIMDLI"))
(setq l92 (+ rad l01))
(setq l92 (* l92 l92))
(setq l91 (sqrt (- l92 l91)))
(setq l91 (+ l91 (* rad cost)))
;円弧の長さを計算
(setq arclen (* arcang rad))
;寸法スタイルの精度で小数点桁数を設定
(setq arclen (rtos arclen 2 (getvar "DIMDEC")))
;寸法補助線1の始点と終点
(setq cx (car c01))
(setq cy (cadr c01))
(setq x01 (+ cx (* rad (cos sang))))
(setq y01 (+ cy (* rad (sin sang))))
(setq x02 (+ x01 (* l91 cosm)))
(setq y02 (+ y01 (* l91 sinm)))
(setq p02 (list x02 y02))
(setq l02 (+ l91 (getvar "DIMEXE")))
(setq x03 (+ x01 (* l02 cosm)))
(setq y03 (+ y01 (* l02 sinm)))
(setq p03 (list x03 y03))
(setq l03 (getvar "DIMEXO"))
(setq x01 (+ x01 (* l03 cosm)))
(setq y01 (+ y01 (* l03 sinm)))
(setq p01 (list x01 y01))
;寸法補助線2の始点と終点
(setq x11 (+ cx (* rad (cos eang))))
(setq y11 (+ cy (* rad (sin eang))))
(setq x12 (+ x11 (* l91 cosm)))
(setq y12 (+ y11 (* l91 sinm)))
(setq p12 (list x12 y12))
(setq x13 (+ x11 (* l02 cosm)))
(setq y13 (+ y11 (* l02 sinm)))
(setq p13 (list x13 y13))
(setq x11 (+ x11 (* l03 cosm)))
(setq y11 (+ y11 (* l03 sinm)))
(setq p11 (list x11 y11))
;寸法補助記号えんこの座標
(setq l04 (getvar "DIMTXT"))
(setq l06 (* 0.4 (* l04 (strlen arclen))))
(setq l07 (+ l04 (* 2 (getvar "DIMGAP"))))
(setq mang2 (+ mang (* 0.5 PI)))
(if (or (<= mang PI) (> mang (* 2 PI)))
(progn
(setq l05 (+ (+ rad l01) l07))
(setq x21 (+ cx (* l05 cosm)))
(setq y21 (+ cy (* l05 sinm)))
(setq x22 (+ x21 (* l06 (cos mang2))))
(setq y22 (+ y21 (* l06 (sin mang2))))
(setq x23 (- x21 (* l06 (cos mang2))))
(setq y23 (- y21 (* l06 (sin mang2))))
(setq l05 (+ l05 (* 0.5 l06)))
(setq x21 (+ cx (* l05 cosm)))
(setq y21 (+ cy (* l05 sinm)))
(setq p21 (list x21 y21))
(setq p22 (list x22 y22))
(setq p23 (list x23 y23))
)
(progn
(setq l05 (- (+ rad l01) l07))
(setq x21 (+ cx (* l05 cosm)))
(setq y21 (+ cy (* l05 sinm)))
(setq x22 (+ x21 (* l06 (cos mang2))))
(setq y22 (+ y21 (* l06 (sin mang2))))
(setq x23 (- x21 (* l06 (cos mang2))))
(setq y23 (- y21 (* l06 (sin mang2))))
(setq l05 (- l05 (* 0.5 l06)))
(setq x21 (+ cx (* l05 cosm)))
(setq y21 (+ cy (* l05 sinm)))
(setq p21 (list x21 y21))
(setq p22 (list x22 y22))
(setq p23 (list x23 y23))
)
)
(setq o01 (getvar "OSNAPCOORD"))
(setvar "OSNAPCOORD" 1)
;コマンドエコーオフ
(setvar "CMDECHO" 0)
(command "LINE" p01 p03 "")
(command "LINE" p11 p13 "")
;角度寸法を記入し、値を円弧長さにする
(command "DIMANGULAR" "" c01 p02 p12 "T" arclen p02)
(command "DIMOVERRIDE" "DIMSE1" "ON" "DIMSE2" "ON" "" "L" "")
(command "ARC" p22 p21 p23)
;コマンドエコーオン
(setvar "CMDECHO" 1)
(setvar "OSNAPCOORD" o01)
)
;図形が円弧以外の時、メッセージボックスを表示
(alert "円弧ではありません")
)
(princ)
)

ステータスバーのボタンをショートカットキーで

2006-02-13 12:18:01 | AutoCAD
F9 スナップのオンオフ
F7 グリッドのオンオフ
F8 直交モードのオンオフ
F10 極トラッキングのオンオフ
F3 オブジェクトスナップのオンオフ
F11 オブジェクトスナップトラッキングのオンオフ
F12 ダイナミック入力のオンオフ
lw [線の太さを表示]にチェックを入れる(外す)
ms モデル空間に
ps ペーパー空間に

F6 カーソル座標値の表示のオンオフ

ラスターイメージの挿入

2006-02-08 16:50:31 | AutoCAD
レギュラー版であれば
メニューバーから
挿入 => ラスターイメージ
で挿入できます.

LT では
そのファイルを開くことのできるソフトで開き
そちらからコピー貼り付けします.
この方法はレギュラー版でも実行可能です.

LT でレギュラー版のような挿入を行いたい場合は
南九州総合設計さんが
作図ソフト
で提供してくださっている
LTラスタ
のようなソフトを使用します.

計算

2006-01-16 15:37:12 | AutoCAD
cal[Enter]
に続けて数式を入力すると
コマンドラインウィンドウ内に
答が表示されます.

コマンド実行中に
計算結果の数値を使いたい場合は
'cal[Enter]
に続けて数式を入力します.

コマンドラインウィンドウの表示を初期状態に戻す

2006-01-15 09:51:45 | AutoCAD
commandlinehide[Enter]
でコマンドラインウィンドウを非表示にできるようになった
最近のバージョンでは関係のないお話です.
表示されていないコマンドラインウィンドウを表示するには
commandline[Enter]
と入力します.
どちらも
メニューバーからなら
ツール => コマンドライン
キーボードからのショートカットは
Ctrl + 9
です.

でやっと本題ですが
以下のようにレジストリを編集します.

マイコンピュータ - HKEY_CURRENT_USER - Software - Autodesk -
AutoCAD - R??.? - ACAD-????:??? - FixedProfile - Command Line Windows
内の
DockWindow.Style

2
に設定します.