|
OPTION BASE 0
DIM S(8),T(8)
FOR I=1 TO 8
READ S(I),T(I)
NEXT I
DATA -1,-1
DATA 0,-1
DATA 1,-1
DATA 1,0
DATA 1,1
DATA 0,1
DATA -1,1
DATA -1,0
LET A$="(仮称)十進BASIC"
LET XSIZE=945
LET YSIZE=125
DIM M(XSIZE,YSIZE)
CALL GINIT(XSIZE,YSIZE)
LET H=100
LET HH=100
SET TEXT FONT "MS 明朝" ,0
SET TEXT HEIGHT H
SET TEXT COLOR 7
PLOT TEXT ,AT 0,0 :A$
ASK PIXEL ARRAY (0,0) M
FILE GETSAVENAME F$,"dxfファイル|*.dxf"
IF F$="" THEN STOP
IF POS(UCASE$(F$),".DXF")=0 THEN LET F$=F$ & ".dxf"
OPEN #1:NAME F$
ERASE #1
PRINT #1:"0"
PRINT #1:"SECTION"
PRINT #1:"2"
PRINT #1:"ENTITIES"
CLEAR
FOR Y=0 TO YSIZE-1 !'輪郭抽出
FOR X=0 TO XSIZE-2
LET C=ABS(M(X,Y)-M(X+1,Y))
IF C>0 THEN CALL PSET(X,Y,4)
NEXT X
NEXT Y
FOR X=0 TO XSIZE-1
FOR Y=0 TO YSIZE-2
LET C=ABS(M(X,Y)-M(X,Y+1))
IF C>0 THEN CALL PSET(X,Y,4)
NEXT Y
NEXT X
FOR X=0 TO XSIZE-1 !'ライン追跡(※連続線にならずラインが分断してしまう)
FOR Y=0 TO YSIZE-1
IF GETPOINT(X,Y)=4 THEN
IF ABS(X-X0)<=1 AND ABS(Y-Y0)<=1 THEN
LET X1=X0
LET Y1=Y0
LET X0=X
LET Y0=Y
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X0
PRINT #1:"20"
PRINT #1:YSIZE-Y0
PRINT #1:"30"
PRINT #1:HH
PRINT #1:"11"
PRINT #1:X1
PRINT #1:"21"
PRINT #1:YSIZE-Y1
PRINT #1:"31"
PRINT #1:HH
PRINT #1:"12"
PRINT #1:X1
PRINT #1:"22"
PRINT #1:YSIZE-Y1
PRINT #1:"32"
PRINT #1:0
PRINT #1:"13"
PRINT #1:X0
PRINT #1:"23"
PRINT #1:YSIZE-Y0
PRINT #1:"33"
PRINT #1:0
END IF
LET X0=X
LET Y0=Y
DO
FOR I=1 TO 8
LET XS=X0
LET YS=Y0
IF GETPOINT(X0+S(I),Y0+T(I))=4 THEN
LET X1=X0+S(I)
LET Y1=Y0+T(J)
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X0
PRINT #1:"20"
PRINT #1:YSIZE-Y0
PRINT #1:"30"
PRINT #1:HH
PRINT #1:"11"
PRINT #1:X1
PRINT #1:"21"
PRINT #1:YSIZE-Y1
PRINT #1:"31"
PRINT #1:HH
PRINT #1:"12"
PRINT #1:X1
PRINT #1:"22"
PRINT #1:YSIZE-Y1
PRINT #1:"32"
PRINT #1:0
PRINT #1:"13"
PRINT #1:X0
PRINT #1:"23"
PRINT #1:YSIZE-Y0
PRINT #1:"33"
PRINT #1:0
CALL PSET(X1,Y1,2)
LET X0=X1
LET Y0=Y1
EXIT FOR
END IF
NEXT I
LOOP UNTIL X0=XS AND Y0=YS
END IF
NEXT Y
NEXT X
PRINT #1:"0"
PRINT #1:"ENDSEC"
PRINT #1:"0"
PRINT #1:"EOF"
CLOSE #1
END
EXTERNAL SUB GINIT(XSIZE,YSIZE)
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1, 0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
SET COLOR MIX(0) 0,0,0
SET COLOR MIX(1) 0,0,1
SET COLOR MIX(2) 1,0,0
SET COLOR MIX(3) 1,0,1
SET COLOR MIX(4) 0,1,0
SET COLOR MIX(5) 0,1,1
SET COLOR MIX(6) 1,1,0
SET COLOR MIX(7) 1,1,1
SET TEXT JUSTIFY "LEFT" , "TOP"
CLEAR
END SUB
EXTERNAL FUNCTION GETPOINT(X,Y)
ASK PIXEL VALUE (X,Y) C
LET GETPOINT=C
END FUNCTION
EXTERNAL SUB PSET(X,Y,C)
SET POINT COLOR C
PLOT POINTS: X , Y
END SUB
|
|