GetPathOneOp.mac: Difference between revisions
From Macros Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
args opnum | args opnum | ||
local numfeat, ifeat, itype | local numfeat, ifeat, itype | ||
local xs, ys, zs, xe, ye, ze, cx, yc, zc, rad, dir | local xs, ys, zs, xe, ye, ze, cx, yc, zc, rad, dir | ||
get_op_num_feat opnum, numfeat | {| | ||
message "op num %opnum, number of features %numfeat" | |get_op_num_feat opnum, numfeat | ||
|- | |||
a$ = "Op %opnum : %numfeat Features"+crlf$ | |message "op num %opnum, number of features %numfeat" | ||
file_write_text 1, a$ | |- | ||
if FileError<>0 then stop "Error writing file" | | | ||
|- | |||
|a$ = "Op %opnum : %numfeat Features"+crlf$ | |||
|- | |||
|file_write_text 1, a$ | |||
|- | |||
|if FileError<>0 then stop "Error writing file" | |||
|- | |||
| | |||
|- | |||
|fmt$ = "+0.0~~" || ! output spaces in place of leading/trailing zeros | |||
|- | |||
| | |||
|- | |||
|for ifeat=1 to numfeat | |||
|} | |||
:get_op_feat_type opnum, ifeat, itype | |||
<br> | <br> | ||
:if itype = feat_type_ctool then continue ! ignore markers | |||
<br> | <br> | ||
:get_op_feat_start opnum, ifeat, xs, ys, zs | :get_op_feat_start opnum, ifeat, xs, ys, zs | ||
:get_op_feat_end opnum, ifeat, xe, ye, ze | :get_op_feat_end opnum, ifeat, xe, ye, ze | ||
<br> | |||
:a$ = "Feature " + format$(ifeat, "~~0") + " : " | :a$ = "Feature " + format$(ifeat, "~~0") + " : " | ||
<br> | |||
:if itype=1 then goto label_point | :if itype=1 then goto label_point | ||
:if itype=2 then goto label_line | :if itype=2 then goto label_line | ||
:if itype=3 then goto label_arc | :if itype=3 then goto label_arc | ||
<br> | |||
:a$ = a$ + "Unknown type (%itype)" | :a$ = a$ + "Unknown type (%itype)" | ||
:goto label_print | :goto label_print | ||
<br> | <br> | ||
<nowiki>:</nowiki>label_point | <nowiki>:</nowiki>label_point | ||
:xs$ = format$(xs, fmt$) | :xs$ = format$(xs, fmt$) | ||
:ys$ = format$(ys, fmt$) | :ys$ = format$(ys, fmt$) | ||
:zs$ = format$(zs, fmt$) | :zs$ = format$(zs, fmt$) | ||
<br> | |||
:a$ = a$ + "Point " | :a$ = a$ + "Point " | ||
:a$ = a$ + " X =%xs$ Y =%ys$ Z =%zs$" | :a$ = a$ + " X =%xs$ Y =%ys$ Z =%zs$" | ||
<br> | |||
:goto label_print | :goto label_print | ||
<br> | <br> | ||
<nowiki>:</nowiki>label_line | <nowiki>:</nowiki>label_line | ||
:xs$ = format$(xs, fmt$) | :xs$ = format$(xs, fmt$) | ||
:ys$ = format$(ys, fmt$) | :ys$ = format$(ys, fmt$) | ||
:zs$ = format$(zs, fmt$) | :zs$ = format$(zs, fmt$) | ||
<br> | |||
:xe$ = format$(xe, fmt$) | :xe$ = format$(xe, fmt$) | ||
:ye$ = format$(ye, fmt$) | :ye$ = format$(ye, fmt$) | ||
:ze$ = format$(ze, fmt$) | :ze$ = format$(ze, fmt$) | ||
<br> | |||
:a$ = a$ + "Line " | :a$ = a$ + "Line " | ||
:a$ = a$ + " Xs=%xs$ Ys=%ys$ Zs=%zs$" | :a$ = a$ + " Xs=%xs$ Ys=%ys$ Zs=%zs$" | ||
:a$ = a$ + " Xe=%xe$ Ye=%ye$ Ze=%ze$" | :a$ = a$ + " Xe=%xe$ Ye=%ye$ Ze=%ze$" | ||
<br> | |||
:goto label_print | :goto label_print | ||
<br> | <br> | ||
<nowiki>:</nowiki>label_arc | <nowiki>:</nowiki>label_arc | ||
:get_op_feat_arc_data opnum, ifeat, rad, dir, xc, yc, zc | :get_op_feat_arc_data opnum, ifeat, rad, dir, xc, yc, zc | ||
<br> | |||
:xc$ = format$(xc, fmt$) | :xc$ = format$(xc, fmt$) | ||
:yc$ = format$(yc, fmt$) | :yc$ = format$(yc, fmt$) | ||
:zc$ = format$(zc, fmt$) | :zc$ = format$(zc, fmt$) | ||
<br> | |||
:xs$ = format$(xs, fmt$) | :xs$ = format$(xs, fmt$) | ||
:ys$ = format$(ys, fmt$) | :ys$ = format$(ys, fmt$) | ||
:zs$ = format$(zs, fmt$) | :zs$ = format$(zs, fmt$) | ||
<br> | |||
:xe$ = format$(xe, fmt$) | :xe$ = format$(xe, fmt$) | ||
:ye$ = format$(ye, fmt$) | :ye$ = format$(ye, fmt$) | ||
:ze$ = format$(ze, fmt$) | :ze$ = format$(ze, fmt$) | ||
<br> | |||
:rr$ = format$(rad, fmt$) | :rr$ = format$(rad, fmt$) | ||
<br> | |||
:if dir=1 then a$ = a$ + "Arc CW " | :if dir=1 then a$ = a$ + "Arc CW " | ||
:if dir<>1 then a$ = a$ + "Arc CCW " | :if dir<>1 then a$ = a$ + "Arc CCW " | ||
<br> | |||
:a$ = a$ + " Xc=%xc$ Yc=%yc$ Zc=%zc$ R =%rr$" | :a$ = a$ + " Xc=%xc$ Yc=%yc$ Zc=%zc$ R =%rr$" | ||
<br> | |||
:a$ = a$ + crlf$ + " " | :a$ = a$ + crlf$ + " " | ||
<br> | |||
:a$ = a$ + " Xs=%xs$ Ys=%ys$ Zs=%zs$" | :a$ = a$ + " Xs=%xs$ Ys=%ys$ Zs=%zs$" | ||
:a$ = a$ + " Xe=%xe$ Ye=%ye$ Ze=%ze$" | :a$ = a$ + " Xe=%xe$ Ye=%ye$ Ze=%ze$" | ||
<br> | |||
:goto label_print | :goto label_print | ||
<br> | <br> | ||
<nowiki>:</nowiki>label_print<br> | <nowiki>:</nowiki>label_print | ||
<br> | |||
:file_write_text 1, a$ | :file_write_text 1, a$ | ||
:if FileError<>0 then stop "Error writing file" | :if FileError<>0 then stop "Error writing file" | ||
{| | |||
next ifeat | | | ||
|- | |||
file_write_text 1, crlf$ | |next ifeat | ||
if FileError<>0 then stop "Error writing file" | |- | ||
| | |||
|- | |||
|file_write_text 1, crlf$ | |||
|- | |||
|if FileError<>0 then stop "Error writing file" | |||
|} | |||
Latest revision as of 15:21, 29 July 2010
args opnum local numfeat, ifeat, itype local xs, ys, zs, xe, ye, ze, cx, yc, zc, rad, dir
| get_op_num_feat opnum, numfeat | |
| message "op num %opnum, number of features %numfeat" | |
| a$ = "Op %opnum : %numfeat Features"+crlf$ | |
| file_write_text 1, a$ | |
| if FileError<>0 then stop "Error writing file" | |
| fmt$ = "+0.0~~" | ! output spaces in place of leading/trailing zeros |
| for ifeat=1 to numfeat |
- get_op_feat_type opnum, ifeat, itype
- if itype = feat_type_ctool then continue ! ignore markers
- get_op_feat_start opnum, ifeat, xs, ys, zs
- get_op_feat_end opnum, ifeat, xe, ye, ze
- a$ = "Feature " + format$(ifeat, "~~0") + " : "
- if itype=1 then goto label_point
- if itype=2 then goto label_line
- if itype=3 then goto label_arc
- a$ = a$ + "Unknown type (%itype)"
- goto label_print
:label_point
- xs$ = format$(xs, fmt$)
- ys$ = format$(ys, fmt$)
- zs$ = format$(zs, fmt$)
- a$ = a$ + "Point "
- a$ = a$ + " X =%xs$ Y =%ys$ Z =%zs$"
- goto label_print
:label_line
- xs$ = format$(xs, fmt$)
- ys$ = format$(ys, fmt$)
- zs$ = format$(zs, fmt$)
- xe$ = format$(xe, fmt$)
- ye$ = format$(ye, fmt$)
- ze$ = format$(ze, fmt$)
- a$ = a$ + "Line "
- a$ = a$ + " Xs=%xs$ Ys=%ys$ Zs=%zs$"
- a$ = a$ + " Xe=%xe$ Ye=%ye$ Ze=%ze$"
- goto label_print
:label_arc
- get_op_feat_arc_data opnum, ifeat, rad, dir, xc, yc, zc
- xc$ = format$(xc, fmt$)
- yc$ = format$(yc, fmt$)
- zc$ = format$(zc, fmt$)
- xs$ = format$(xs, fmt$)
- ys$ = format$(ys, fmt$)
- zs$ = format$(zs, fmt$)
- xe$ = format$(xe, fmt$)
- ye$ = format$(ye, fmt$)
- ze$ = format$(ze, fmt$)
- rr$ = format$(rad, fmt$)
- if dir=1 then a$ = a$ + "Arc CW "
- if dir<>1 then a$ = a$ + "Arc CCW "
- a$ = a$ + " Xc=%xc$ Yc=%yc$ Zc=%zc$ R =%rr$"
- a$ = a$ + crlf$ + " "
- a$ = a$ + " Xs=%xs$ Ys=%ys$ Zs=%zs$"
- a$ = a$ + " Xe=%xe$ Ye=%ye$ Ze=%ze$"
- goto label_print
:label_print
- file_write_text 1, a$
- if FileError<>0 then stop "Error writing file"
| next ifeat |
| file_write_text 1, crlf$ |
| if FileError<>0 then stop "Error writing file" |