;============================================================================== ;【ソ フ ト名】 リアルタイムボルト作図(Vir1.5) ;【著作権 者】 OKAP工房 おかぴー ;【動作 確認】 AutoCAD R2000 確認済み ;【掲 載 日】 2002/10/21 ;【ソフトウェア種別】 フリーウェア ;【転載 条件】 要連絡 ;【 ホームページ 】 http://homepage1.nifty.com/okap/ ;【電子メール】 BQW04027@nifty.com ;============================================================================== ;このファイルには、当Lispをご利用いただく上での注意や制限事項などに関して記載しています。 ;記載内容をよくお読みの上、本ソフトウェアをご使用ください。 ; ;1. 当Lispについて ; 当Lispは、AutoCAD 2000 用に作成したAutoLispですが、他のバージョンでも使用できると思われます。 ; ;2.実行方法 ; 本ファイルをAutoCADのサポートパスの通して有る場所に保存してください。 ;  その後AutoCADのコマンドラインから本アプリケーションをロードすると実行可能になります。(load "bmake") ; ;3.基本的な使い方 ; 本アプリケーションをロードすると、必要事項を聞いてきます。 ; マージ点・呼び径・ボルト向き・ナット・座金タイプを入力します。 ; 最後に固定面を指定します。 ; 作図が終わると、使用したボルトがコマンドラインに表示されます。 ; ボルト・ナット・座金等のデータはプログラム上部に記入されています。 ; 特寸等がある場合は必要に応じて追記して下さい。 ; 作図する画層・入力の初期値もこのファイルを編集する事で可能です。(編集はメモ帳等のテキストエディタで行って下さい) ; ☆作図用の画層が『オフ フリーズ ロック』のどれかの状態にある場合中断します。解除してから再実行して下さい。 ; ☆ボルト系に適したワッシャー及びスプリングワッシャーが無い場合は使用しないで作図します。 ; ☆作図されたボルトヘヘッド及びナットはデータ量軽減の為、ブロック化されます。必要に応じて分解して下さい。 ; ;4.品質保証 ; いかなる場合においても生ずる障害に関し、OKAP工房側は一切責任を持ちません。 ; ご意見、感想、障害、使用方法などは BQW04027@nifty.com までメールをお願いします。 ; ;5.使用上の注意 ; 本ソフトは図面作図のため、また自分で使用するコマンドを作成するために使用してください。 ; 転載する場合は連絡して下さい。 ; 本バージョンからフリーウェアとなり、ソースを公開していますので自由に変更可能です。 ; ;6.更新履歴 ; 2002/10/19 β版完成 ; 2002/10/22 製品版完成 ; 2003/6/7 フリーウェア化 ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ;ここから下は初期設定値 ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ;初期値 (defun defolt_type_list (/ def_data) ;ユーザー入力事項の初期値です。必要に応じて変更してください。 ;ただし、リストの順番を変えたり追加しないでください。 (setq def_data (list 10 ;呼径 "A";ボルト向き [通常(A)/横向き(B)] "Y";ナット [使用(Y)/無し(N)] "C";座金タイプ [丸座(C)/小角座(S)/大角座(L)/無し(N)/] )) def_data ) ;線種設定 (defun def_line_type (/ def_line) (setq def_line (list ;作図する画層及び線種の設定です。必要に応じて変更してください。 ;ただし、リストの順番を変えたり追加しないでください。 ; "線種" "画層" (list "ByLayer" (getvar "clayer"));ボルト 作図線 (list "ByLayer" (getvar "clayer"));ワッシャー 作図線 (list "ByLayer" (getvar "clayer"));SPワッシャー 作図線 (list "ByLayer" (getvar "clayer"));ナット 作図線 (list "ByLayer" (getvar "clayer"));ボルト芯 作図線 (list "Dashed" (getvar "clayer"));隠線 作図線 (list "Center" (getvar "clayer"));中心 作図線 )) def_line ) (defun bolt_make_date (/ bolt_data nat_data washer_data sp_washer_data) ;ボルトデータ (setq bolt_data (list ;標準サイズのボルトが記載されています。 ;特寸を使用する場合は追加してください。 ;(呼径 頭高さ 六角幅 最小値 最大値) '( 3.0 2.0 5.5 6.0 30.0) '( 4.0 2.8 7.0 6.0 50.0) '( 5.0 3.5 8.0 8.0 50.0) '( 6.0 4.0 10.0 8.0 100.0) '( 8.0 5.5 13.0 12.0 200.0) '(10.0 7.0 17.0 14.0 200.0) '(12.0 8.0 19.0 18.0 200.0) '(14.0 9.0 22.0 20.0 200.0) '(16.0 10.0 24.0 22.0 200.0) '(18.0 12.0 27.0 25.0 200.0) '(20.0 13.0 30.0 30.0 300.0) '(22.0 14.0 32.0 30.0 300.0) '(24.0 15.0 36.0 30.0 300.0) '(30.0 19.0 46.0 40.0 300.0) '(36.0 23.0 55.0 50.0 300.0) '(42.0 26.0 65.0 50.0 325.0) '(48.0 30.0 75.0 55.0 325.0) ;標準サイズのボルト長の一覧です。 ;特寸が有る場合は追加してください。 ;ただし、数値は小さい順に並べてください。 '(0 6.0 8.0 10.0 12.0 14.0 16.0 18.0 20.0 22.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 65.0 70.0 75.0 80.0 85.0 90.0 100.0 110.0 120.0 130.0 140.0 150.0 160.0 170.0 180.0 190.0 200.0 220.0 240.0 260.0 280.0 300.0 325.0);長さ種類 )) ;ナットデータ (setq nat_data (list ;標準サイズのナットが記載されています。 ;特寸を使用する場合は追加してください。 ;(呼径 厚み 六角幅) '( 1.6 1.3 3.2) '( 2.0 1.6 4.0) '( 2.5 2.0 5.0) '( 3.0 2.4 5.5) '( 3.5 2.8 6.0) '( 4.0 3.2 7.0) '( 5.0 4.7 8.0) '( 6.0 5.2 10.0) '( 8.0 6.8 13.0) '(10.0 8.4 16.0) '(12.0 10.8 18.0) '(14.0 12.8 21.0) '(16.0 14.8 24.0) '(18.0 15.8 27.0) '(20.0 18.0 30.0) '(22.0 19.4 34.0) '(24.0 21.5 36.0) '(27.0 23.8 41.0) '(30.0 25.6 46.0) '(33.0 28.7 50.0) '(36.0 31.0 55.0) '(39.0 33.4 60.0) '(42.0 34.0 65.0) '(45.0 36.0 70.0) '(48.0 38.0 75.0) '(52.0 42.0 80.0) '(56.0 45.0 85.0) '(60.0 48.0 90.0) '(64.0 51.0 95.0) )) ;ワッシャーデータ (setq washer_data (list ;標準サイズのワッシャーが記載されています。 ;特寸を使用する場合は追加してください。 ;存在しない場合は『-1.0』と記載してください。 ;(呼径 丸座金幅 丸座金高さ 小角座金幅 小角座金高さ 大角座金幅 大角座金高さ) '( 1.6 3.8 0.3 -1.0 -1.0 -1.0 -1.0 ) '( 2.0 4.3 0.3 -1.0 -1.0 -1.0 -1.0 ) '( 2.5 5.0 0.5 -1.0 -1.0 -1.0 -1.0 ) '( 3.0 6.0 0.5 -1.0 -1.0 -1.0 -1.0 ) '( 3.5 7.0 0.5 -1.0 -1.0 -1.0 -1.0 ) '( 4.0 8.0 0.8 -1.0 -1.0 -1.0 -1.0 ) '( 5.0 10.0 1.0 -1.0 -1.0 -1.0 -1.0 ) '( 6.0 11.5 1.6 17.0 1.2 20.0 2.3 ) '( 8.0 15.5 1.6 23.0 1.6 26.0 2.3 ) '(10.0 18.0 2.0 28.0 1.6 32.0 2.3 ) '(12.0 21.0 2.5 35.0 2.3 40.0 3.2 ) '(14.0 24.0 2.5 40.0 3.2 44.0 3.2 ) '(16.0 28.0 3.0 45.0 3.2 52.0 4.5 ) '(18.0 30.0 3.0 52.0 4.5 55.0 4.5 ) '(20.0 34.0 3.0 56.0 4.5 62.0 6.0 ) '(22.0 37.0 3.0 64.0 4.5 68.0 6.0 ) '(24.0 39.0 4.0 68.0 6.0 72.0 6.0 ) '(27.0 44.0 4.0 73.0 6.0 80.0 6.0 ) '(30.0 50.0 4.0 -1.0 -1.0 90.0 6.0 ) '(33.0 56.0 5.0 -1.0 -1.0 100.0 8.0 ) '(36.0 60.0 5.0 -1.0 -1.0 110.0 8.0 ) '(39.0 66.0 6.0 -1.0 -1.0 115.0 8.0 ) '(42.0 78.0 7.0 -1.0 -1.0 120.0 9.0 ) '(45.0 85.0 7.0 -1.0 -1.0 130.0 9.0 ) '(48.0 92.0 8.0 -1.0 -1.0 140.0 12.0 ) '(52.0 98.0 8.0 -1.0 -1.0 150.0 12.0 ) '(56.0 105.0 9.0 -1.0 -1.0 -1.0 -1.0 ) '(60.0 110.0 9.0 -1.0 -1.0 -1.0 -1.0 ) '(64.0 115.0 9.0 -1.0 -1.0 -1.0 -1.0 ) )) ;スプリングワッシャーデータ (setq sp_washer_data (list ;標準サイズのスプリングワッシャーが記載されています。 ;特寸を使用する場合は追加してください。 ;(呼径 外径 厚み) '( 2.0 4.4 0.5) '( 2.5 5.2 0.6) '( 3.0 5.9 0.7) '( 3.5 6.6 0.8) '( 4.0 7.6 1.0) '( 5.0 9.2 1.3) '( 6.0 12.2 1.5) '( 8.0 15.4 2.0) '(10.0 18.4 2.5) '(12.0 21.5 3.0) '(14.0 24.5 3.5) '(16.0 28.0 4.0) '(18.0 31.0 4.6) '(20.0 32.7 5.1) '(22.0 37.7 5.6) '(24.0 40.3 5.9) '(30.0 49.9 7.5) '(36.0 59.1 9.0) '(39.0 63.1 9.5) )) (list bolt_data nat_data washer_data sp_washer_data) ) ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ;ここから上は初期設定値 ;■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ (defun bolt_make1 (damiok / org size bolt_data ax btype ntype ztype bolt_name nut_name block1 block2 max_leng nut_leng z_leng end obj ang hight tbl leng b1 thick nuthight b7 zorg com block3 block3x) ;ボルト長決定(ナット付) (defun getlen1 (/ ax leng_list pno) (setq ax (+ (* 2 (get_washer_hight1 size ztype)) (get_nut_hight1 size) (get_spwasher_hight1 size) (distance org obj) (* size 0.1);少し長めにする )) (setq leng_list (cdr (last (nth 0 (bolt_make_date))))) (setq pno 0) (repeat (length leng_list) (if (and (> ax (nth pno leng_list)) (< ax (nth (1+ pno) leng_list))) (setq ax (nth (1+ pno) leng_list)) (setq pno (1+ pno)) ) ) (if (< ax (nth 3 tbl)) (setq ax (nth 3 tbl));最小長 ) (if (> ax (nth 4 tbl)) (setq ax (nth 4 tbl));最大長 ) ax ) ;ボルト長決定(ナット無し) (defun getlen2 (/ ax leng_list pno) (setq ax (+ (get_washer_hight1 size ztype) (distance org obj) )) (setq leng_list (cdr (last (nth 0 (bolt_make_date)))));長さLIST (setq pno 0) (repeat (length leng_list) (if (and (> ax (nth pno leng_list)) (< ax (nth (1+ pno) leng_list))) (setq ax (nth pno leng_list)) (setq pno (1+ pno)) ) ) (if (< ax (nth 3 tbl)) (setq ax (nth 1 tbl));最小長 ) (if (> ax (nth 4 tbl)) (setq ax (nth 4 tbl));最大長 ) ax ) ;ワッシャー付 (defun head_make1 (/ washer_all zt b_head_all spwasher_all nut_all) (if (< 0 (get_washer_hight1 size ztype));ワッシャーのサイズが有る時だけ (setq washer_all (draw_washer1 size ztype org pi));受けワッシャー作図 ) (if(= ztype "C");丸座金 (setq zt (get_washer_hight1 size "C")) ) (if(= ztype "S");小角座金 (setq zt (get_washer_hight1 size "S")) ) (if(= ztype "L");大角座金 (setq zt (get_washer_hight1 size "L")) ) (setq b_head_all (draw_bolt_head1 size btype ztype (polar org pi zt)));ボルトヘッド作図 (command "-block" bolt_name org washer_all b_head_all "") (if (< 0 (get_washer_hight1 size ztype));ワッシャーのサイズが有る時だけ (setq washer_all (draw_washer1 size ztype org 0));押えワッシャー作図 (setq washer_all b_head_all) ) (if (< 0 (get_spwasher_hight1 size));SPワッシャーのサイズが有る時だけ (setq spwasher_all (draw_spwasher1 size (polar org 0 zt) 0));スプリングワッシャー作図 (setq spwasher_all b_head_all) ) (setq nut_all (draw_nut1 size btype (polar org 0 (+ zt (get_spwasher_hight1 size)))));ナット作図 (command "-block" nut_name org washer_all spwasher_all nut_all "") ) ;ワッシャー無し (defun head_make2 (/ b_head_all spwasher_all nut_all) (setq b_head_all (draw_bolt_head1 size btype ztype org));ボルトヘッド作図 (command "-block" bolt_name org b_head_all "") (if (< 0 (get_spwasher_hight1 size));SPワッシャーのサイズが有る時だけ (setq spwasher_all (draw_spwasher1 size (polar org 0 0) 0));スプリングワッシャー作図 (setq spwasher_all b_head_all) ) (setq nut_all (draw_nut1 size btype (polar org 0 (get_spwasher_hight1 size))));ナット作図 (command "-block" nut_name org spwasher_all nut_all "") ) ;ナット無し (defun head_make3 (/ tbl min_leng zorg bolt_s_all) (setq tbl(get_bolt_data1 size)) (setq min_leng (nth 3 tbl));最小値 (setq zorg (polar org pi (get_washer_hight1 size ztype))) (setq bolt_s_all (draw_bolt_s size org 0 min_leng));ボルト最小芯作図 (command "-block" "kari" (polar org 0 min_leng) bolt_s_all "") (command "-insert" "kari" org "" "" "") ) ;リアルタイム移動 (defun head_move (/ input end p0 block1x block2x block2xx) (while (and (setq input (grread 0 7)) (cond ((= (car input) 3) nil);座標の入力 ((= (car input) 2) nil);キーの入力 ((= (car input) 11) (setq end 1) nil);R14右クリック ((= (car input) 25) (setq end 1) nil);A2k右クリック (T T);泣きマークじゃないよ(true true) ) ) (if (= "Y" ntype) (progn (setq p0 (osnap (cadr input) "per,int")) (if (not p0)(setq p0 (cadr input))) (if (> (distance org p0) (- max_leng nut_leng));最大長以上延ばさない (setq p0 (polar org (angle org p0) (- max_leng nut_leng))) ) ) (progn (setq p0 (osnap (cadr input) "int,per")) (if (not p0)(setq p0 (cadr input))) (if (> (distance org p0) (- max_leng z_leng));最大長以上延ばさない (setq p0 (polar org (angle org p0) (- max_leng z_leng))) ) (if (< (distance org p0) (- min_leng (get_washer_hight1 size ztype)));最小長以下にしない (setq p0 (polar org (angle org p0) (- min_leng (get_washer_hight1 size ztype)))) ) ) ) (setq block1x (subst (cons 50 (angle org p0))(assoc 50 block1) block1)) (entmod block1x);ボルトヘッド回転 (setq block2x (subst (cons 50 (angle org p0))(assoc 50 block2) block2)) (setq block2xx (subst (cons 10 p0)(assoc 10 block2x) block2x)) (entmod block2xx);ナット移動 ) end;キャンセル時 ) (if (/= "okk" damiok) (exit) ) ;ボルト作図スタート (while (not org) (setq org (getpoint "\nマージ点 :")) ) (setq size (getreal (strcat "\n呼径 <" (rtos (nth 0 (defolt_type_list))) ">:"))) (if (not size) (setq size 10.0) ) ;ボルトデータ取得 (setq bolt_data (nth 0 (bolt_make_date))) (setq ax (gettbl1 size bolt_data)) (initget 6) (if (= ax -1) (princ "\nボルト径が存在しません") (progn (setq btype (getstring (strcat "\nボルト向き [通常(A)/横向き(B)] <" (nth 1 (defolt_type_list)) ">:"))) (if (= "" btype) (setq btype (nth 1 (defolt_type_list))) (setq btype (strcase btype)) ) (setq ntype (getstring (strcat "\nナット [使用(Y)/無し(N)] <" (nth 2 (defolt_type_list)) ">:"))) (if (= "" ntype) (setq ntype (nth 2 (defolt_type_list))) (setq ntype (strcase ntype)) ) (setq ztype (getstring (strcat "\n座金タイプ [丸座(C)/小角座(S)/大角座(L)/無し(N)/] <" (nth 3 (defolt_type_list)) ">:"))) (if (= "" ztype) (setq ztype (nth 3 (defolt_type_list))) (setq ztype (strcase ztype)) ) (setq bolt_name (strcat "M" (rtos size) "_bolt_head_" ztype btype)) (setq nut_name (strcat "M" (rtos size) "_nut_" ztype btype)) (if (= ztype "N") (head_make2) (head_make1) ) (command "-insert" bolt_name org "" "" "") (setq block1 (entget (entlast))) (if (= ntype "N") (head_make3);最小芯を作図後ブロック挿入 (command "-insert" nut_name org "" "" "") ) (setq block2 (entget (entlast))) (setq max_leng (nth 4 (nth ax bolt_data)));ボルト最大長 (setq min_leng (nth 3 (nth ax bolt_data)));ボルト最小長 (setq nut_leng (+ (get_spwasher_hight1 size) (get_nut_hight1 size)(* 2 (get_washer_hight1 size ztype)))) (setq z_leng (get_washer_hight1 size ztype)) (princ "\n固定面を指定:") (setq end nil) (setq end (head_move));リアルタイム移動 (setq obj (cdr (assoc '10 (entget (entlast))))) (setq ang (cdr (assoc '50 (entget (entlast))))) (setq hight (distance org obj)) (setq tbl (nth ax bolt_data));ボルト長さ (if (= "Y" ntype) (setq leng (getlen1));ボルト長決定 (setq leng (getlen2));ボルト長決定 ) (setq b1 (polar org (+ ang pi)(get_washer_hight1 size ztype)));ボルト起点 (setq thick (polar obj ang (get_washer_hight1 size ztype)));ワッシャー終点 (setq nuthight (polar thick ang (+ (get_spwasher_hight1 size) (get_nut_hight1 size))));ナット終点 (setq b7 (polar b1 ang leng));ボルト終点 (if end (progn (entdel (entlast))(entdel (entlast));ヘッド等削除 (princ "\nキャンセルされました") ) (if (= "Y" ntype) (draw_bolt1 size b1 ang thick nuthight b7);ボルト芯作図(ナット付) (progn (entdel (entlast)) (setq com (strcat "\nM" (rtos size)"×" (rtos leng))) (setq zorg (polar org pi (get_washer_hight1 size ztype))) (setq bolt_s_all (draw_bolt_s size zorg 0 leng));ボルト芯作図(ナット無し) (command "-block" com org bolt_s_all "") (command "-insert" com org "" "" "") (setq block3 (entget (entlast))) (setq block3x (subst (cons 50 ang)(assoc 50 block3) block3)) (entmod block3x) (princ com) ) ) ) ) ) (princ) ) ;★★★★★★★★★★★★★★★★★★★★★★ ;線種一覧 (defun line_type_list (/ line_type line_type0 line_type1 line_type2 line_type3 line_type4 line_type5 line_type6) (setq line_type (def_line_type)) (if (tblsearch "ltype" (car (nth 0 line_type)));ボルト 作図線 (setq line_type0 (nth 0 line_type)) (setq line_type0 (list "ByLayer" (cadr (nth 0 line_type)))) ) (if (tblsearch "ltype" (car (nth 1 line_type)));ワッシャー 作図線 (setq line_type1 (nth 1 line_type)) (setq line_type1 (list "ByLayer" (cadr (nth 1 line_type)))) ) (if (tblsearch "ltype" (car (nth 2 line_type)));SPワッシャー 作図線 (setq line_type2 (nth 2 line_type)) (setq line_type2 (list "ByLayer" (cadr (nth 2 line_type)))) ) (if (tblsearch "ltype" (car (nth 3 line_type)));ナット 作図線 (setq line_type3 (nth 3 line_type)) (setq line_type3 (list "ByLayer" (cadr (nth 3 line_type)))) ) (if (tblsearch "ltype" (car (nth 4 line_type)));ボルト芯 作図線 (setq line_type4 (nth 4 line_type)) (setq line_type4 (list "ByLayer" (cadr (nth 4 line_type)))) ) (if (tblsearch "ltype" (car (nth 5 line_type)));隠線 作図線 (setq line_type5 (nth 5 line_type)) (setq line_type5 (list "ByLayer" (cadr (nth 5 line_type)))) ) (if (tblsearch "ltype" (car (nth 6 line_type)));中心 作図線 (setq line_type6 (nth 6 line_type)) (setq line_type6 (list "ByLayer" (cadr (nth 6 line_type)))) ) (setq line_type (list line_type0 line_type1 line_type2 line_type3 line_type4 line_type5 line_type6)) line_type ) ;★★★★★★★★★★★★★★★★★★★★★★ ;ナットデータ (defun get_nut_data1 (size / ax tbl) (setq tbl (nth 1 (bolt_make_date))) (setq ax(gettbl1 size tbl)) (if(/= ax -1) (setq ax(nth ax tbl)) (setq ax nil) ) ) (defun get_nut_hight1 (size / ax tbl) (setq tbl(get_nut_data1 size)) (if(/= tbl nil) (setq ax(nth 1 tbl)) (setq ax 0.0) ) (setq ax ax) ) (defun draw_nut1 (size btype org / ax bx cx dx m s p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 n_head_all) (setq ang 0) (setq tbl(get_nut_data1 size)) (setq m(nth 1 tbl)) (setq s(*(nth 2 tbl)0.5)) (setq n_head_all (ssadd));ナットを選択セットに追加 (if(= btype "B") (progn (setq p1(polar org(+ ang(* pi 0.5))s)) (setq ax(polar org ang m)) (setq p2(polar ax(+ ang(* pi 0.5))(* s 0.5))) (setq p3(polar p2(- ang pi)size)) (setq dx(sqrt(-(* size size)(* (* s 0.5) (* s 0.5))))) (setq p4(polar ax(- ang pi)(- size dx))) (setq p5(polar p4(+ ang(* pi 0.5))s)) (setq p6(mirrorpos1 p1 org ax)) (setq p7(mirrorpos1 p2 org ax)) (setq p8(mirrorpos1 p3 org ax)) (setq p9(mirrorpos1 p5 org ax)) (draw_line_t1 p1 p5 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p1 p6 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p2 p7 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p6 p9 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p4 org (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_arc_t1 p3 p4 p5 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_arc_t1 p8 p9 p4 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) ) (progn (setq s(/ s(cos(/ pi 6.0)))) (setq p1(polar org(+ ang pi)(-(* size 1.5)m))) (setq p2(polar org(+ ang(* pi 0.5))s)) (setq p3(polar org(+ ang(* pi 0.5))(* size 0.5))) (setq dx(sqrt(-(* (* size 1.5) (* size 1.5))(* (* size 0.5) (* size 0.5))))) (setq ax(- dx(distance p1 org))) (setq p4(polar p2 ang ax)) (setq p5(polar p3 ang ax)) (setq p6(polar p4(- ang(/ pi 3.0))(*(- m(distance p4 p2))2.0))) (setq dx(angle p5 p6)) (setq bx(polar p5 dx(*(distance p5 p6)0.5))) (setq ax(sqrt(-(* size size)(* (*(distance p5 p6)0.5) (*(distance p5 p6)0.5))))) (setq p7(polar bx(+ dx(* pi 0.5))ax)) (setq p8(mirrorpos1 p2 org p1)) (setq p9(mirrorpos1 p3 org p1)) (setq p10(mirrorpos1 p4 org p1)) (setq p11(mirrorpos1 p5 org p1)) (setq p12(mirrorpos1 p6 org p1)) (setq p13(mirrorpos1 p7 org p1)) (draw_line_t1 p2 p4 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p2 p8 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p3 p5 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p4 p6 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p6 p12 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p8 p10 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p9 p11 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_line_t1 p10 p12 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_arc_t1 p1 p11 p5 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_arc_t1 p7 p5 p6 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) (draw_arc_t1 p13 p12 p11 (car (nth 3 (line_type_list)))(cadr (nth 3 (line_type_list)))) (setq n_head_all (ssadd (entlast) n_head_all)) ) ) n_head_all ) ;ボルト (defun get_bolt_data1 (size / ax tbl) (setq tbl (nth 0 (bolt_make_date))) (setq ax(gettbl1 size tbl)) (if(/= ax -1) (setq ax(nth ax tbl)) (setq ax nil) ) ) ;(defun get_bolt_hight1 (size / ax tbl) ; (setq tbl(get_bolt_data1 size)) ; (if(/= tbl nil) ; (setq ax(nth 1 tbl)) ; (setq ax 0.0) ; ) ; (setq ax ax) ;) ;ボルトヘッド作図 (defun draw_bolt_head1 (size btype ztype org / tbl k s ax bx cx dx p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 b_head_all) (setq tbl (get_bolt_data1 size)) (setq k (nth 1 tbl)) (setq s (* (nth 2 tbl) 0.5)) (setq b_head_all (ssadd));ボルトを選択セットに追加 (if(= btype "B") (progn;ボルト向き横向き(B) (setq p1 (polar org (+ pi (* pi 0.5)) s)) (setq ax (polar org pi k)) (setq p2 (polar ax (+ pi (* pi 0.5))(* s 0.5))) (setq p3 (polar p2 (- pi pi) size)) (setq dx (sqrt (- (* size size)(* (* s 0.5) (* s 0.5))))) (setq p4 (polar ax (- pi pi)(- size dx))) (setq p5 (polar p4 (+ pi (* pi 0.5))s)) (setq p6 (mirrorpos1 p1 org ax)) (setq p7 (mirrorpos1 p2 org ax)) (setq p8 (mirrorpos1 p3 org ax)) (setq p9 (mirrorpos1 p5 org ax)) (draw_line_t1 p1 p5 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p1 p6 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p2 p7 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p6 p9 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p4 org (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_arc_t1 p3 p4 p5 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_arc_t1 p8 p9 p4 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) ) (progn;ボルト向き通常(A) (setq p1 (polar org (+ pi pi)(- (* size 1.5)k))) (setq p2 (polar org (+ pi (* pi 0.5)) (/ s (cos (/ pi 6.0))))) (setq p3 (polar org (+ pi (* pi 0.5))(* size 0.5))) (setq dx (sqrt(- (* (* size 1.5) (* size 1.5))(* (* size 0.5) (* size 0.5))))) (setq ax (- dx (distance p1 org))) (setq p4 (polar p2 pi ax)) (setq p5 (polar p3 pi ax)) (setq p6 (polar p4 (- pi (/ pi 3.0))(* (- k (distance p4 p2)) 2.0))) (setq dx (angle p5 p6)) (setq bx (polar p5 dx (* (distance p5 p6) 0.5))) (setq ax (sqrt (- (* size size)(* (* (distance p5 p6) 0.5) (* (distance p5 p6) 0.5))))) (setq p7 (polar bx (+ dx (* pi 0.5)) ax)) (setq p8 (mirrorpos1 p2 org p1)) (setq p9 (mirrorpos1 p3 org p1)) (setq p10 (mirrorpos1 p4 org p1)) (setq p11 (mirrorpos1 p5 org p1)) (setq p12 (mirrorpos1 p6 org p1)) (setq p13 (mirrorpos1 p7 org p1)) (draw_line_t1 p2 p4 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p2 p8 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p3 p5 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p4 p6 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p6 p12 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p8 p10 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p9 p11 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_line_t1 p10 p12 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_arc_t1 p1 p11 p5 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_arc_t1 p7 p5 p6 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) (draw_arc_t1 p13 p12 p11 (car (nth 0 (line_type_list)))(cadr (nth 0 (line_type_list)))) (setq b_head_all (ssadd (entlast) b_head_all)) ) ) b_head_all ) ;ボルト芯作図(ナット有り) (defun draw_bolt1 (size org ang thick nuthight leng / ax bx cx dx tbl k s p1 p2 p3 p4 p5 p6 p7 p8 p9 p0 com) (setq tbl(get_bolt_data1 size)) (setq k (nth 1 tbl));最小値 (setq s (* (nth 2 tbl) 0.5));最大の半分 (setq p1 (polar org (+ ang (* pi 0.5))(* size 0.5))) (setq p2 (polar org (+ ang (* pi 0.5))(* size 0.4))) (setq p3 (polar p1 ang (distance org thick))) (setq p4 (polar p2 ang (distance org thick))) (setq p5 (polar p1 ang (distance org nuthight))) (setq p6 (polar p2 ang (distance org nuthight))) (setq p7 (polar p1 ang (-(distance org leng)(* size 0.1)))) (setq p8 (polar p2 ang (distance org leng))) (if (< 0 (distance p1 p3)) (progn (draw_line_t1 p1 p3 (car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (draw_line_t1 p2 p4 (car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (draw_line_t1 (mirrorpos1 p1 org leng)(mirrorpos1 p3 org leng)(car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (draw_line_t1 (mirrorpos1 p2 org leng)(mirrorpos1 p4 org leng)(car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) ) ) (if (> (- (distance org leng)(* size 0.1)) (distance org nuthight)) (progn;先端が見える時 (draw_line_t1 p5 p7 (car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 p6 p8 (car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 (mirrorpos1 p5 org leng)(mirrorpos1 p7 org leng)(car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 (mirrorpos1 p6 org leng)(mirrorpos1 p8 org leng)(car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 p7 (mirrorpos1 p7 org leng)(car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 p8 (mirrorpos1 p8 org leng)(car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 p7 p8 (car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 (mirrorpos1 p7 org leng)(mirrorpos1 p8 org leng) (car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) ) (if (/= (rtos (distance org leng)) (rtos (distance org nuthight)));誤差を考慮 (progn;先端が隠れる時 (setq p7 (polar p6 (+ ang (/ pi 2))(distance p6 p8))) (draw_line_t1 p6 p8 (car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 (mirrorpos1 p6 org leng)(mirrorpos1 p8 org leng)(car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 p8 (mirrorpos1 p8 org leng)(car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 p7 p8 (car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) (draw_line_t1 (mirrorpos1 p7 org leng)(mirrorpos1 p8 org leng) (car (nth 4 (line_type_list)))(cadr (nth 4 (line_type_list)))) ) ) ) (setq p9 (polar org (+ ang pi)(+ k (* size 0.2)))) (setq p0 (polar leng ang (* size 0.2))) (draw_line_t1 p9 p0 (car (nth 6 (line_type_list)))(cadr (nth 6 (line_type_list))));中心線 (setq com (strcat "\nM" (rtos size)"×" (rtos (distance org leng)))) (princ com) ) ;ボルト芯作図(ナット無し) (defun draw_bolt_s (size org ang leng / ax bx cx dx tbl k s p1 p2 p7 p8 bolt_s_all) (setq tbl(get_bolt_data1 size)) (setq k (nth 1 tbl));最小値 (setq s (* (nth 2 tbl) 0.5));最大の半分 (setq p0 (polar org ang (+ leng (* size 0.2)))) (setq p1 (polar org (+ ang (* pi 0.5))(* size 0.5))) (setq p2 (polar org (+ ang (* pi 0.5))(* size 0.4))) (setq p7 (polar p1 ang (- leng (* size 0.1)))) (setq p8 (polar p2 ang leng)) (setq p9 (polar org (+ ang pi)(+ k (* size 0.2)))) (setq bolt_s_all (ssadd));ボルト最小芯を選択セットに追加 (draw_line_t1 p1 p7 (car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (setq bolt_s_all (ssadd (entlast) bolt_s_all)) (draw_line_t1 p2 p8 (car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (setq bolt_s_all (ssadd (entlast) bolt_s_all)) (draw_line_t1 (mirrorpos1 p1 org p0)(mirrorpos1 p7 org p0)(car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (setq bolt_s_all (ssadd (entlast) bolt_s_all)) (draw_line_t1 (mirrorpos1 p2 org p0)(mirrorpos1 p8 org p0)(car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (setq bolt_s_all (ssadd (entlast) bolt_s_all)) (draw_line_t1 p7 (mirrorpos1 p7 org p0)(car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (setq bolt_s_all (ssadd (entlast) bolt_s_all)) (draw_line_t1 p8 (mirrorpos1 p8 org p0)(car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (setq bolt_s_all (ssadd (entlast) bolt_s_all)) (draw_line_t1 p7 p8 (car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (setq bolt_s_all (ssadd (entlast) bolt_s_all)) (draw_line_t1 (mirrorpos1 p7 org p0)(mirrorpos1 p8 org p0) (car (nth 5 (line_type_list)))(cadr (nth 5 (line_type_list)))) (setq bolt_s_all (ssadd (entlast) bolt_s_all)) (draw_line_t1 p9 p0 (car (nth 6 (line_type_list)))(cadr (nth 6 (line_type_list))));中心線 (setq bolt_s_all (ssadd (entlast) bolt_s_all)) bolt_s_all ) ;ワッシャー (defun get_washer_data1 (size / ax tbl) (setq tbl (nth 2 (bolt_make_date))) (setq ax(gettbl1 size tbl)) (if(/= ax -1) (setq ax(nth ax tbl)) (setq ax nil) ) ) (defun get_washer_width1 (size typ / ax tbl) (setq tbl(get_washer_data1 size)) (if(/= tbl nil) (progn (if(= typ "C") (setq ax(nth 1 tbl)) ) (if(= typ "S") (setq ax(nth 3 tbl)) ) (if(= typ "L") (setq ax(nth 5 tbl)) ) (if(= typ "N") (setq ax 0.0) ) ) (setq ax 0.0) ) (setq ax ax) ) ;ワッシャー高さ (defun get_washer_hight1 (size typ / ax tbl) (setq tbl(get_washer_data1 size)) (if(/= tbl nil) (progn (if(= typ "C") (setq ax(nth 2 tbl)) ) (if(= typ "S") (setq ax(nth 4 tbl)) ) (if(= typ "L") (setq ax(nth 6 tbl)) ) (if(= typ "N") (setq ax 0.0) ) ) (setq ax 0.0) ) (setq ax ax) ) ;ワッシャー作図 (defun draw_washer1 (size typ org ang / zw zt p1 p2 p3 p4 washer_all) (if(= typ "C");丸座金 (setq zw (get_washer_width1 size "C") zt (get_washer_hight1 size "C")) ) (if(= typ "S");小角座金 (setq zw (get_washer_width1 size "S") zt (get_washer_hight1 size "S")) ) (if(= typ "L");大角座金 (setq zw (get_washer_width1 size "L") zt (get_washer_hight1 size "L")) ) (setq p1(polar org(+ ang(* pi 0.5))(* zw 0.5))) (setq p2(polar p1 ang zt)) (setq p3(mirrorpos1 p1 org(polar org ang 1.0))) (setq p4(mirrorpos1 p2 org(polar org ang 1.0))) (setq washer_all (ssadd));ワッシャーを選択セットに追加 (draw_line_t1 p1 p2 (car (nth 1 (line_type_list)))(cadr (nth 1 (line_type_list)))) (setq washer_all (ssadd (entlast) washer_all)) (draw_line_t1 p1 p3 (car (nth 1 (line_type_list)))(cadr (nth 1 (line_type_list)))) (setq washer_all (ssadd (entlast) washer_all)) (draw_line_t1 p2 p4 (car (nth 1 (line_type_list)))(cadr (nth 1 (line_type_list)))) (setq washer_all (ssadd (entlast) washer_all)) (draw_line_t1 p3 p4 (car (nth 1 (line_type_list)))(cadr (nth 1 (line_type_list)))) (setq washer_all (ssadd (entlast) washer_all)) washer_all ) ;スプリングワッシャー (defun get_spwasher_data1 (size / ax tbl) (setq tbl (nth 3 (bolt_make_date))) (setq ax(gettbl1 size tbl)) (if(/= ax -1) (setq ax(nth ax tbl)) (setq ax nil) ) ) (defun get_spwasher_width1 (size / ax tbl) (setq tbl(get_spwasher_data1 size)) (if(/= tbl nil) (setq ax(nth 1 tbl)) (setq ax 0.0) ) ) (defun get_spwasher_hight1 (size / ax tbl) (setq tbl(get_spwasher_data1 size)) (if(/= tbl nil) (setq ax(nth 2 tbl)) (setq ax 0.0) ) ) ;スプリングワッシャー作図 (defun draw_spwasher1 (size org ang / ax bx cx dx sw st p1 p2 p3 p4 p5 p6 p7 p8) (setq sw(get_spwasher_width1 size)) (setq st(get_spwasher_hight1 size)) (setq p1(polar org(+ ang(* pi 0.5))(* sw 0.5))) (setq p2(polar p1 ang st)) (setq p3(mirrorpos1 p1 org(polar org ang 1.0))) (setq p4(mirrorpos1 p2 org(polar org ang 1.0))) (setq ax(polar org(+ ang(* pi 0.5))(* st 0.5))) (setq p5(polar ax(+ ang(* pi 0.5))(* st 0.125))) (setq p6(polar ax(- ang(* pi 0.5))(* st 0.125))) (setq p7(polar p5(- ang(* pi 0.25))(* st(sqrt 2.0)))) (setq p8(polar p6(- ang(* pi 0.25))(* st(sqrt 2.0)))) (setq spwasher_all (ssadd));SPワッシャーを選択セットに追加 (draw_line_t1 p1 p2 (car (nth 2 (line_type_list)))(cadr (nth 2 (line_type_list)))) (setq spwasher_all (ssadd (entlast) spwasher_all)) (draw_line_t1 p1 p3 (car (nth 2 (line_type_list)))(cadr (nth 2 (line_type_list)))) (setq spwasher_all (ssadd (entlast) spwasher_all)) (draw_line_t1 p2 p4 (car (nth 2 (line_type_list)))(cadr (nth 2 (line_type_list)))) (setq spwasher_all (ssadd (entlast) spwasher_all)) (draw_line_t1 p3 p4 (car (nth 2 (line_type_list)))(cadr (nth 2 (line_type_list)))) (setq spwasher_all (ssadd (entlast) spwasher_all)) (draw_line_t1 p5 p7 (car (nth 2 (line_type_list)))(cadr (nth 2 (line_type_list)))) (setq spwasher_all (ssadd (entlast) spwasher_all)) (draw_line_t1 p6 p8 (car (nth 2 (line_type_list)))(cadr (nth 2 (line_type_list)))) (setq spwasher_all (ssadd (entlast) spwasher_all)) spwasher_all ) ;直線作成 (defun draw_line_t1 (pos1 pos2 typ gasou) (entmake(list(cons 0 "LINE")(cons 8 gasou)(cons 10 pos1)(cons 11 pos2)(cons 6 typ))) ) ;円弧作成 (defun draw_arc_t1 (pos0 pos1 pos2 typ gasou) (entmake(list(cons 0 "ARC")(cons 8 gasou)(cons 10 pos0)(cons 40(distance pos0 pos1))(cons 50(angle pos0 pos1))(cons 51(angle pos0 pos2))(cons 6 typ))) ) (defun mirrorpos1 (pos b1 b2 / ax bx dx) (setq dx(angle b1 pos)) (setq ax(distance b1 pos)) (setq bx(-(*(-(angle b1 b2)pi)2.0)dx)) (setq ax(polar b1 bx ax)) (setq ax ax) ) ;(defun tan (x) ; (setq x(/(sqrt(- 1.0(* (cos x)(cos x))))(cos x))) ;) (defun gettbl1 (size tbl / ax bx cx dx) (setq cx 0 ax -1) (while(and(/=(setq dx(nth cx tbl))nil)(= ax -1)) (if(= size(car dx)) (setq ax cx) ) (setq cx(1+ cx)) ) (setq ax ax) ) ;線種チェック (defun line_type_check (/) (if (not (tblsearch "ltype" (car (nth 0 (def_line_type)))));ボルト 作図線 (princ (strcat "\n線種 " (car (nth 0 (def_line_type))) " は有りません ByLayer に置き換えられます。")) ) (if (not (tblsearch "ltype" (car (nth 1 (def_line_type)))));ワッシャー 作図線 (princ (strcat "\n線種 " (car (nth 1 (def_line_type))) " は有りません ByLayer に置き換えられます。")) ) (if (not (tblsearch "ltype" (car (nth 2 (def_line_type)))));SPワッシャー 作図線 (princ (strcat "\n線種 " (car (nth 2 (def_line_type))) " は有りません ByLayer に置き換えられます。")) ) (if (not (tblsearch "ltype" (car (nth 3 (def_line_type)))));ナット 作図線 (princ (strcat "\n線種 " (car (nth 3 (def_line_type))) " は有りません ByLayer に置き換えられます。")) ) (if (not (tblsearch "ltype" (car (nth 4 (def_line_type)))));ボルト芯 作図線 (princ (strcat "\n線種 " (car (nth 4 (def_line_type))) " は有りません ByLayer に置き換えられます。")) ) (if (not (tblsearch "ltype" (car (nth 5 (def_line_type)))));隠線 作図線 (princ (strcat "\n線種 " (car (nth 5 (def_line_type))) " は有りません ByLayer に置き換えられます。")) ) (if (not (tblsearch "ltype" (car (nth 6 (def_line_type)))));中心 作図線 (princ (strcat "\n線種 " (car (nth 6 (def_line_type))) " は有りません ByLayer に置き換えられます。")) ) ) (defun line_view_check (/ view_check) (defun line_view (pno / line_v1 line_v2 v_msg) (setq line_v1 (cdr (assoc 70 (tblsearch "layer" (cadr (nth pno (def_line_type))))))) (setq line_v2 (cdr (assoc 62 (tblsearch "layer" (cadr (nth pno (def_line_type))))))) (if (or (= 1 line_v1)(= 2 line_v1)(= 3 line_v1)) (if (> 0 line_v2) (setq v_msg "オフ フリーズ") (setq v_msg "フリーズ") ) (if (= 4 line_v1) (if (> 0 line_v2) (setq v_msg "オフ ロック") (setq v_msg "ロック") ) (if (< 4 line_v1) (if (> 0 line_v2) (setq v_msg "オフ フリーズ ロック") (setq v_msg "フリーズ ロック") ) (if (> 0 line_v2) (setq v_msg "オフ") (setq v_msg nil) ) ) ) ) v_msg ) (if (line_view 0) (princ (strcat "\n画層 " (cadr (nth 0 (def_line_type))) " は " (line_view 0) " されています")) ) (if (line_view 1) (princ (strcat "\n画層 " (cadr (nth 1 (def_line_type))) " は " (line_view 1) " されています")) ) (if (line_view 2) (princ (strcat "\n画層 " (cadr (nth 2 (def_line_type))) " は " (line_view 2) " されています")) ) (if (line_view 3) (princ (strcat "\n画層 " (cadr (nth 3 (def_line_type))) " は " (line_view 3) " されています")) ) (if (line_view 4) (princ (strcat "\n画層 " (cadr (nth 4 (def_line_type))) " は " (line_view 4) " されています")) ) (if (line_view 5) (princ (strcat "\n画層 " (cadr (nth 5 (def_line_type))) " は " (line_view 5) " されています")) ) (if (line_view 6) (princ (strcat "\n画層 " (cadr (nth 6 (def_line_type))) " は " (line_view 6) " されています")) ) (if (or (line_view 0)(line_view 1)(line_view 2)(line_view 3)(line_view 4)(line_view 5)(line_view 6)) (princ "\n解除してから実行して下さい") (setq view_check 1) ) view_check ) (defun c:bmake (/ back_expert back_cmdecho btype) (setq damiok "okk") (setq back_expert (getvar "expert")) (setq back_cmdecho (getvar "cmdecho")) (setvar "expert" 5) (setvar "cmdecho" 0) (command "undo" "be") (line_type_check);線種チェック (if (line_view_check); (bolt_make1 damiok) ) (command "undo" "e") (setvar "expert" back_expert) (setvar "cmdecho" back_cmdecho) (princ) ) (princ "\nコマンド名は『bmake』です。") (princ)