GetPathOneOp.mac

From Macros Wiki
Jump to: navigation, search

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"