Return to Statement


Find Section Line Data Example

This example shows how to determine the Section Line data.

 
ENTITY/sxline, sxsegs(99), curseg

ENTITY/curcrv, bscrvs(99), nwcrvs(99)

NUMBER/selmsk(3), resp

NUMBER/sxdata(36), segcnt, segtyp, objtyp

NUMBER/x, y, z, mvmat(12), numcrv

STRING/pvname(30), name(30)

$$

crsmod = &VWCURS

&VWCURS = &ANY

$$

$$ set selection masks for

$$ Section Line (type 202)

selmsk(1) = 3

selmsk(2) = 5

selmsk(3) = 202

MASK/selmsk

$$

start:

$$ select section line

IDENT/'Select Section Line', sxline, resp

IF/resp <= 2, JUMP/finish:

$$

$$ test if true object type is a Section Line (type 202)

objtyp = &ISSXL(sxline, IFERR, err1:)

IF/objtyp <> 202, JUMP/err1:

$$

$$ find the section line information

OBTAIN/sxline, sxdata

$$

$$ extract the number of section line segments

segcnt = sxdata(5)

IF/segcnt > 99, JUMP/err3:

IF/segcnt == 0, JUMP/err4:

$$

$$ find the section line segments

sxsegs = SXLDAT/sxline, segcnt, REF, pvname, IFERR, err2:

PRINT/'The name of the parent view is', pvname

$$

$$ find the base curve and segment type of each segment

indx = 1

numcrv = 0

DO/segdo:, indx, 1, segcnt

$$ load the segment

curseg = sxsegs(indx)

curcrv = SXSEGD/curseg, RESULT, segtyp, IFERR, err5:

$$ a NULENT means an associated curve could not be found

IF/curcrv == &NULENT, JUMP/err6:

IFTHEN/segtyp == 1

PRINT/'The segment is an arrow.'

ELSEIF/segtyp == 2

PRINT/'The segment is a cut.'

ELSEIF/segtyp == 3

PRINT/'The segment is a bend.'

ELSE

MESSG/'The section line segment type is undetermined.'

JUMP/segdo:

ENDIF

name = &NAME(curcrv)

PRINT/'The name of the base curve is', name

numcrv = numcrv + 1

bscrvs(numcrv) = curcrv

JUMP/segdo:

err5:

MESSG/'The section line segment is not valid.'

JUMP/segdo:

err6:

MESSG/'The base curve or segment type or both cannot be determined.'

segdo:

IF/numcrv <= 0, JUMP/start:

trndis:

$$ get translation distance

PARAM/'enter translation distance','x', x, 'y', y, 'z', z, resp

IF/resp <= 2, JUMP/start:

$$

$$ define the translation matrix

mvmat = MATRIX/TRANSL, x, y, z

$$

$$ copy the base curves and move them some distance

nwcrvs(1..numcrv) = TRANSF/mvmat, bscrvs(1..numcrv)

JUMP/trndis:

$$

err1:

MESSG/'The object is not a section line.'

JUMP/start:

$$

err2:

MESSG/'The section line is not valid.'

JUMP/start:

$$

err3:

MESSG/'There are too many section line segments.'

JUMP/start:

$$

err4:

MESSG/'There are no section line segments.'

JUMP/start:

$$

finish:

&VWCURS = crsmod

HALT