線属性変更(拡張版)
線色/線種を変更する各種外部変形をバッチファイルにまとめてみました。
属性取得を利用して、選択図形の中から指定線色/線種を変更することができます。
1.ブロック図形、ソリッド図形、寸法図形は除外
2.図形選択は、書込レイヤグループのみ、指示線は別レイヤグループ可
3.作図済の指示線選択は、直線のみ可
◇選択属性変更
選択図形から書込線色/線種を作図済の指示線属性に変更 Start
◇全属性変更
選択図形をすべて作図済の指示線属性に変更 Start
◇選択色/線色
選択図形から書込線色の図形を選択し、作図済の指示線色に変更 Start
◇選択種/線種
選択図形から書込線種の図形を選択し、作図済の指示線種に変更 Start
◇指定色/線種
選択図形から書込線色の図形を選択し、書込線種に変更 Start
◇指定種/線色
選択図形から書込線種の図形を選択し、書込線色に変更 Start
※属性取得が利用できない場合、線属性ツールバーから指定可
◇書込属性変更
選択図形の線属性をすべて書込属性に変更 Start
◇書込線色変更
選択図形の線色をすべて書込線色に変更 Start
◇書込線種変更
選択図形の線種をすべて書込線種に変更 Start
----------
@REM 線属性変更(拡張版)
@echo off
goto %1
REM
REM #jww
REM #cd
REM #hm|選択属性変更|全属性変更|選択色/線色|選択種/線種|指定色/線種|指定種/線色|書込属性変更|書込線色変更|書込線種変更|
REM #:1
REM #:2
REM #:3
REM #:4
REM #ht10 ブロック図形除外
REM #ht30 寸法図形除外
REM #ht40 ソリッド図形除外
REM #h1 範囲内データを選択
REM #hc 範囲選択してください
REM #1ln 線色/線種を指定する線(曲線は除く)を(L)クリック
REM #hr
REM #e
REM #:5
REM #:6
REM #:7
REM #:8
REM #:9
REM #ht10 ブロック図形除外
REM #ht30 寸法図形除外
REM #ht40 ソリッド図形除外
REM #h1 範囲内データを選択
REM #hc 範囲選択してください
REM #hr
REM #e
REM
:1
jgawk 'BEGIN{m=0;n=0}/^^lc/{m=m+1;if(m==1){culc=$1}else{lc=$1}}/^^lt/{n=n+1;if(n==1){cult=$1}else{lt=$1}}/^^hhp1ln/{print "attr",lc,lt,culc,cult}' jwc_temp.txt>attr.txt
copy attr.txt+jwc_temp.txt
jgawk 'BEGIN{m=0;n=0;print "hd"}/^^attr/{chlc=$2;chlt=$3;sllc=$4;sllt=$5;culc=sllc;cult=sllt;next}/^^hq/{next}/^^lc/{m=m+1;culc=$1;if(m==1 ^&^& culc==sllc ^&^& cult==sllt){print chlc;next}if(m^>=2 ^&^& culc==sllc ^&^& cult==sllt){print chlc;print chlt;next}if(cult==sllt ^&^& $1!=sllc){print $1;print cult}else{print $1}next}/^^lt/{n=n+1;cult=$1;if(n==1 ^&^& culc==sllc ^&^& $1==sllt){print chlt;next}if(n^>=2 ^&^& culc==sllc ^&^& $1==sllt){print chlc;print chlt;next}if(culc==sllc ^&^& $1!=sllt){print culc;print $1}else{print $1}next}/^^hhp1ln/{next}{print $0}' attr.txt>temp.txt
copy temp.txt jwc_temp.txt
del attr.txt
del temp.txt
goto end
:2
jgawk '/^^lc/{lc=$1}/^^lt/{lt=$1}/^^hhp1ln/{print "attr",lc,lt}' jwc_temp.txt>attr.txt
copy attr.txt+jwc_temp.txt
jgawk 'BEGIN{print "hd"}/^^attr/{print $2;print $3;next}/^^hq/{next}/^^lc/{next}/^^lt/{next}/^^hhp1ln/{next}{print $0}' attr.txt>temp.txt
copy temp.txt jwc_temp.txt
del attr.txt
del temp.txt
goto end
:3
jgawk 'BEGIN{m=0}/^^lc/{m=m+1;if(m==1){culc=$1}else{lc=$1}}/^^hhp1ln/{print "attr",lc,culc}' jwc_temp.txt>attr.txt
copy attr.txt+jwc_temp.txt
jgawk 'BEGIN{print "hd"}/^^attr/{chlc=$2;sllc=$3;next}/^^hq/{next}/^^lc/{if($1==sllc){print chlc}else{print $1}next}/^^hhp1ln/{next}{print $0}' attr.txt>temp.txt
copy temp.txt jwc_temp.txt
del attr.txt
del temp.txt
goto end
:4
jgawk 'BEGIN{n=0}/^^lt/{n=n+1;if(n==1){cult=$1}else{lt=$1}}/^^hhp1ln/{print "attr",lt,cult}' jwc_temp.txt>attr.txt
copy attr.txt+jwc_temp.txt
jgawk 'BEGIN{print "hd"}/^^attr/{chlt=$2;sllt=$3;next}/^^hq/{next}/^^lt/{if($1==sllt){print chlt}else{print $1}next}/^^hhp1ln/{next}{print $0}' attr.txt>temp.txt
copy temp.txt jwc_temp.txt
del attr.txt
del temp.txt
goto end
:5
jgawk 'BEGIN{m=0;n=0;print "hd"}/^^hq/{next}/^^lc/{m=m+1;culc=$1;if(m==1){sllc=$1;print $1}else{if(culc!=sllc ^&^& cult!=sllt){print $1;print cult;next}if(culc==sllc ^&^& culy!=sllt){print $1;print sllt}else{print $1}}next}/^^lt/{n=n+1;cult=$1;if(n==1){sllt=$1;print $1;next}else{if(culc==sllc ^&^& cult!=sllt){print sllt;next}else{print $1;next}}}{print $0}' jwc_temp.txt>temp.txt
copy temp.txt jwc_temp.txt
del temp.txt
goto end
:6
jgawk 'BEGIN{m=0;n=0;print "hd"}/^^hq/{next}/^^lc/{m=m+1;culc=$1;if(m==1){sllc=$1;print $1}else{if(culc!=sllc ^&^& cult==sllt){print sllc}else{print $1}}next}/^^lt/{n=n+1;cult=$1;if(n==1){sllt=$1;print $1}else{if(culc!=sllc ^&^& cult==sllt){print sllc;print sllt;next}if(culc!=sllc ^&^& cult!=sllt){print culc;print cult}else{print $1}}next}{print $0}' jwc_temp.txt>temp.txt
copy temp.txt jwc_temp.txt
del temp.txt
goto end
:7
jgawk 'BEGIN{print "hd"}/^^hq/{next}/^^lc/{next}/^^lt/{next}{print $0}' jwc_temp.txt>temp.txt
copy temp.txt jwc_temp.txt
del temp.txt
goto end
:8
jgawk 'BEGIN{print "hd"}/^^hq/{next}/^^lc/{next}{print $0}' jwc_temp.txt>temp.txt
copy temp.txt jwc_temp.txt
del temp.txt
goto end
:9
jgawk 'BEGIN{print "hd"}/^^hq/{next}/^^lt/{next}{print $0}' jwc_temp.txt>temp.txt
copy temp.txt jwc_temp.txt
del temp.txt
goto end
##### 2011.6.18 by somem
:end
| 固定リンク
コメント
こんばんは。
未だ、試していませんが、batに、こんだけスクリプトを書いているのが、とっても素敵!です。
投稿: 住職 | 2011年6月18日 (土) 21時03分
住職さん、こんばんは。
>とっても素敵!です。
ありがとうございます。
AWKファイルにした方が楽なんですがね。
一行でできるものは、一行にこだわってます。(^^ゞ
投稿: somem | 2011年6月18日 (土) 23時22分