University of Missouri-Columbia

College of Engineering

(NASA-CP,- 1df_547) cNGINrERING SPuC Ir IEAT IrIN

A_J SYST,;_ '_ r]ESIGN F'?i-',L_b/CAM u ._ rUSI_Fi

SHOE5: UMC PROJECT _EFd_] Proc;r__ss eeport, I

Au,'j. - _[ ;no. 19_9 (Missouri Univ.) 6_3 2

CSCL 09r_ _)/oI

NQO-2225b
ENGINEERINGSPECIFICATION AND SYSTEM DESIGN

FOR CAD/CAM OF CUSTOM SHOES:

UMC PROJECT EFFORT

PROJECT NAG-I-875

STATUS REPORT COVERING PERIOD 8/1/89-12/31/89

S_TO

NATIONAL AERONAUTICS & SPACE ADMINISTRATION

LANGLEY RESEARCHCENTER

HAMPTON, VIRGINIA

o

by

_AN P. BAO, Ph.D., P.E.

UNIVERSITY OF MISSOURI-COLUMBIA

COLUMBIA, MISSOURI 65211

Technical report UMC-IE-5-0590

May 1990
CONTENTS

2.2.3

3 - MACHINING WORK

SUMMARY

DESIGN CONSIDERATIONS

2.1 0rthopedic/Therapeutic Requirements

2.2 Machining Requirements

2.2.1 Undercut

2.2.2 High Edges

Cutter Interfaces

4 - SOFTWARE CONVERSION

1

2

3

9

13

APPENDICES 16

Correspondence with North Carolina State University

Listings of dBase programs

Listings of C programs
1. SUMMARY

In this reporting period, further experimentations were made to

improve the design and fabrication techniques of the integrated sole.

The sole design is shown to be related to the foot position

requirements and the actual shape of the foot including presence of

neurotropic ulcers or other infections. Factors for consideration were:

heel pitch, balance line, and rigidity conditions of the foot. Machining

considerations were also part of the design problem. Among these

considerations, widths of each contour, tool motion, tool feed rate, depths

of cut, and slopes of cut at the boundary were the key elements.

The essential fabrication techniques evolved around the idea of

machining a mold then, using quick-firm latex material, casting the sole

through the mold. Two main mold materials were experimented with: plaster

and wood. Plaster was very easy to machine and shape but could barely

support the pressure in the hydraulic press required by the casting

process. Wood was found to be quite effective in terms of relative cost,

strength, and surface smoothness except for the problem of cutting against

the fibers which could generate ragged surfaces.

This report also discusses our programming efforts to convert our

original dBase programs into C programs so that they could be executed on

the SUN Computer at North Carolina State University.
2 - DESIGN CONSIDERATIONS

There are two major categories of design considerations:

(I) Orthopedic/Therapeutic

(2) Machining

The Orthopedic/Therapeutic requirements arise from physiological

disorders of the patient and dictate the types of sole needed to alleviate

or prevent further damage to his foot. The Machining requirements are

strictly technological requirements to achieve the design objectives of the

sole.

2.1 Orthopedic/Therapeutic Requirements

People who may benefit from custom-molded shoes can be a healthy

person with hard-to-fit feet or, as usually is the case, a person with

severe physiological disorders of lower limbs. In the majority of cases,

the custom shoe candidate is at least partially disabled. He or she may

have been born with a birth defect such as cerebral palsy, or club feet.

He or she may have had diseases such as rheumatoid arthritis, diabetes, or

polio. Muscular dystrophy, multiple sclerosis, or charcot disease may have

been his or her problem. Aging also can contribute to foot imbalance,

bunions, or hammertoes. Regardless of etiology, this person cannot

tolerate commercial footwear, and even extra-depth shoes with special

inserts may only offer minimum reduction in discomfort and pain. It is

this particular segment of population for whom custom molded shoes are a

requirement that is addressed in this NASA supported project.
the length of the tibia but, when conditions of foot inflexibility and

severe proration or supiration exist, it should be selected appropriately

and used to orient the last before one can proceed with the design of the

sole.

Foot riEidity: Generally speaking if the foot is flexible then a

certain amount of cast inversion or eversion is tolerated. This means that

the angle of inversion or eversion could be specified by the user. If the

foot is inflexible or deformation conditions such as cavus foot,

equino-varus, or considerable tibia varum exist then the balance line is

drawn while the foot is in its natural orientation.

The discussion of heel pitch, balance line, and foot rigidity given

above has been communicated to the research group at North Carolina State

University for incorporation into their "LASTMOD' design software. See

Appendix i.

2.2 Hachining Requirements

The basic concept of making the sole for the shoe is to generate a

mold cavity with its bottom surface being an exact reproduction of the

plantar surface of the foot in an upside-down position. This concept is

illustrated in figure i.

Plantar surface in upside down position

\

r _

a) machining of mold

1

b) casting of sole using liquid

latex

Figure I - Concept of mold making
Custommolded shoes require a last which remains inside the shoes from

the beginning to the end of the shoe-making process. The last is the most

important element of the entire process and must be precisely designed and

fabricated. The responsibility for last design and last machining is with

the research group at North Carolina State University, while the design and

manufacture of insoles are the responsibility of the University of MissouriColumbia.

As far as the design of the soles are concerned, the foot must first

be scanned in its most correct position. The correct position is typically

a "neutral" position in which there is minimum stress to the foot.

Opinions vary between proponents of no-load position and proponents of

weight-bearing position but the general practice is the seated position for

which the foot is at rest. The knees should be flexed at 90° unless there

is limited flexion in the knees. The position of the tibia is also an

important consideration, as well as the orientation of the ankle joints

because of their influence on the heel pitch. Reference [i] provides ample

discussion on the factors just mentioned.

In general, there are three basic design criteria for the soles: heel

pitch, balance line, and rigidity condition of the foot.

Heel pitch: It is specified according to aesthetic requirements (ie.,

male or female) and anatomical features such as leg-length discrepancy.

There exist general heel pitch values (I/2" to 1 3/4"), and they should be

used as much as possible.

Balance line: The balance line can be drawn on the last to indicate

the amount of correction desired in the shoe. It is usually vertical along

4
Before a milling machine is used to mill the mold cavity, a number of

design problems must first be resolved. They are listed as follows:

undercut

high edges

- cutter interference

2.2.1 Undercut

This problem is illustrated in figure 2. To generate the bottom

surface for the mold cavity, a tool must be programmed to follow each

contour of the foot. However, if we allow the tool to go below the maximum

width (shown as dash line in figure 2) then some material may be removed

from the foot body, thus distorting its final shape.

material removed _ _/ tool

from foot body_ line of maximum width

one contour of the foot

in an upside-down position

to leg

Figure 2 - Foot contour and problem of undercut
The solution, therefore, is to program the tool motion so that it will

never go below the points of maximumwidth as shown in figure 2. The

implication of this strategy is a cut surface through the foot which is

neither planar nor constant width as shownin figure 3. The fact that this

surface is everywhere as wide as the foot can be meansthat the foot will

not feel squeezed inside the shoe and, therefore, the fit of the shoe would

be enhanced.

line of maximumwidth

Figure 3 - Line of maximumwidth

2.2.2 High edges

When the points of maximum width happens to be well above the bottom

surface of the foot, high edges may result as shown in figure 4.

line of maximum width

/

_ high edges

Figure 4 - High edges in mold cavity
High edges present two problems. First, they require very thin

cutters which may break easily during the machining phase. Second, the

casting latex may not be able to reach the bottom of these edges, thus

creating a ragged rather than smooth edge.

These problems have been avoided in our fabrication experiments by

arbitrarily limiting the slope to no more than 30 degrees.

2.2.3 Cutter Interference

Cutter interference is defined as a problem of inadvertently removing

some portions of the part surface as due to the size of the cutter. This

problem is illustrated in figure 5.

tool moves

into paper I

/

_k_ part surface

removed inadvertenttly

Figure 5 Cutter Interference

Two types of cutter interference

circumferential and longitudinal.

have been identified:
Circumferential Interference

This problem occurs when the tool is programmed to move along each

contour of the shoe last as shown in figure 5.

The approach was to calculate the amount of tool lift necessary to

avoid the interference, very much along the line used by Saunders and

Vickers [2] except for the fact that the tool is always vertical while, in

their case, the tool is radially oriented. The tool lift was calculated as

follows. As shown in figure 6, let's consider a point of interest, say ti,

and its immediate neighbors ti+ I, and ti_ 1 respectively before and behind

it. The tool is assumed to move from ti_ 1 to t i to ti+ I. Interference is

detected if the outline of the tool centered at t. intersects with segment

i

titi+ I. The maximum vertical difference between segment titi+ 1 and the

tool contour (a circle) is taken as the necessary tool uplift required to

avoid circumferential interference.

I

"Fool Li_rl-

; t

._t 6+t

Figure 6 - Tool lift to avoid circumferential interference

8
Lpngitudinal Interference

This problem occurs when the tool is programmed to move along the

length of the object. In our case the tool spends most of its time cutting

across the object (ie., circumferential cuts), and very little time along

the length of the object except for advancing the tool forward for the next

cut. Because this motion corresponds with the conventional feed rate, the

problem of longitudinal interference reduces to a problem of surface

roughness left between two consecutive tool passes. Because of the nature

of the cut, longitudinal interference can be ignored without much effect on

the surface to be generated.

3 - MACHINING WORK

To implement the design objectives discussed in section 2, a series of

computer programs written mostly in dBase language were developed as shown

in figure 7. Figures 8 to ii show respectively the 4-axis CNC milling

machine used to machine the mold cavities, a mold in plaster, a mold in

wood, and samples of casted insoles.

DIII.DAT

DIII.DBF

S2.PRG

I

DSIDE .DBF)

)

__ Append from DIII.DAT

type delimiter with

blank

I Determine maximum width of each contour

SOLE3.PRG

DSOLE .DBF)

I

DINTERI.PRG I

Select data

points below

max width

Increase

resolution by

interpolation

DSOLE2. DBF)

Continued on next page
I

DINTER2.PRG linsert between another every twocontour consecutive

I contours

rDSOLETO2.DBF_

I

DINTER3.PRG

L

_DSOLET03. DB_

J

DREBOI .PRG

insert four more contours

between i0.00 and 10.25

Form sequencethe zig-zag cutting

I

DSOLETO4.DB_

I

I DIOS1.PRG

OLETO5.D_

Add heel height to sole

surface.

I DFLATED_ • PRGI Reduce the high edges

D_ OLETO 6. DB F_

INFERI.PRG

I

_SOLET07. D_

I

i DNCTO7.PRG

Tool interference

Convert to NC Program DSOLETO7.DBF

DNCTO 7. PRG_

l

Data File

Program

Figure 7 dBase programs to generate machine codes

for machining mold cavity

i0
ORIGINAL PAGE IS

OF POOR QUALITY

Figure 8 4-Axis CNC Milling Machine Used in

the Production of the Mold Cavity.

Figure 9 An example of Plaster Mold

ORIGtN,_,f_ PAC_E

Ii 8LACK AND WHilE Pt_O[OSRA£t.-i
-ORIGINAL PAGE IS

OF POOR QUALITY

Figure i0 An Example of Wood Mold

ORIGINAL PAGE

_LACK AND WHITE PHOTOGRAPH

Figure ii Sample Insoles

12
- SOFTWARE CONVERSION

Since the final product of this project is a custom footwear design

system based on the SUN computer, all software developed by the various

parties must be converted to C programs.

Figure 12 shows a sequence of three C programs designed to bring the

work done by the group at the University of Missouri-Columbia into the

"LASTMOD' program at North Carolina State University.

" _FOOT2.DAT_

I

SOLE. DAT _

I INSOLE.C

L

NCCODE. C I

!

Machining Codes for

mill_g machine

Data File

Program

Figure 12 Sequence of C programs to make the current work

compatible with the SUN computer

13
DETACH.C

This program searches for the maximum width of each foot contour,

discards all data points above this width, reduces the high edges to an

arbitrary 20-degree slope, and rearranges the data points so that a

continuous zig-zag tool motion can be obtained.

INSOLE.C

This program finds the highest points at the heel and at the ball of

the foot, adds user-specified heights to these points, for example I 3/4

inch to heel and 1/2 inch to ball, then determines the thicknesses of the

sole at all data points.

NCCODE.C

This program generates the machining codes for the milling machine.

For this, it must add G, M, S, and F codes to each motion of the tool.

The above programs have been installed in the LASTMOD software at the

last group meeting at North Carolina State University on May 23, 1990.

Their listings are shown in appendix 3.

REFKRENCES

_ "Custom Shoe Therapy: Vol 1 - The Fitting of Custom Orthopedic

Footwear", Research Traingle Institute, North Carolina, and Arnold

Davis of Davis Shoe Therapeutics, California, 1988.

14
_ "A Generalized Approach to the Replication of Cylindrical Bodies with

Compound Curvature", C. G. Saunders and G. W. Vickers, Trans. ASME,

Journal of Mechanisms, Vol. 106, March 1984, pp. 72-76.

15
APPENDICES

i - Correspondance with North Carolina State University

2 - Listings of dBase programs

3 - Listings of C programs

16
UNIVERSITY OF MISSOURI-COLUMBIA

APPENDIX

• ...,,w ,, -- I I_,.,i 11_ IL-"L--'_'] I| !I._1

1

Department of Industrial Engineering

113 Electrical Engineering Building

Columbia, Missouri 65211

Telephone (314) 882-2691

MEMORANDUM

TO

FROM

SUBJECT :

DATE

Dr. D. McAllister //IF/_

Hen P. Bao '_If_"

m

Sole Design . features to be included in LASTMOD

June 19 , 1989

(cc : Drs Farmer, Luo, Rasdorf, Sanii ) -'.._"

$.

i

This memorandum contains three parts :

I- fundamentals of sole design

2- features to be included in LASTMOD

3- types of output files to be given to UMC

Part I outlines the essential specifications of last position

before the design of the matching sole can be pursued.

Part II indicates the desirable features ( ie. new features )

to be included in LASTMOD as part of the sole design process.

Part III specifies the types and formats of the output files

that your research group should provide us.

PART I

For the sole to be designed properly, we require two pieces of

information :

i- heel pitch

2- balance line

Figure i depicts these two features :

I

lift I_CIl.lilll ODl)OflUfllf? ill$il|U|lOi"l

/,
Pt A : lowest pt of

heel

Pt B : lowest pt of

ball of foot

I

heel

Ditch

I/2

" 3/4',

I

z z/2

2

select

done

4- 0nce the heel pitch is selected then redisplay the-ofoot with the selected heel pitch for visual check_ _f

the view is satisfactory, then 'done ' option is

selected, and the panel in step 2 is shown again.

5- If ' balance line ' option in step 2 is selected then

display the following screen :

flexibility

inversion angle

eversion angle

done

yes no

(default is

zero)

_default is

zero)

When ' done ' is picked in step 5, the screen in step

2 should be shown again.

In summary, the four basic pieces of information required for the sole

design process are :

i- heel pitch

2- inversion angle

3- eversion angle

4- foot flexibility ( yes or no )

They will be used to determine a reference plane below which the foot

would be sho_ and used in the derivation of the mold geometry for

casting the sole.
The heel pitch is specified according to aesthetic requirement ( male

or female fashion ) and anatomical features such as leg-length discrepancy ( LLD ). There exist general heel pitch values, and they

should be indicated on the computer screen for selection.

The balance line is a line drawn on the back of the last for purpose

of balancing the cast after the addition of the heel. This balance

line is usually vertical along the length of the tibias but, when

conditions of foot inflexibility and severe pronation or supination

exist, it should be selected appropriately and used to orient the last

before one can proceed with the design of the sole.

In general, if the foot is flexible then a certain amount of cast

inversion or eversion is tolerated. This means that the angl e of

inversion or eversion must be specified interactively by the user. If

the foot is inflexible or deformation conditions such as cavu{ foot,

equino-varus, or considerable tibia varum exist then the balance line

is drawn while the foot is in its natural orientation.

PART II

The additional features for LASTMOD will be :

i- in MAIN menu, add option ' sole design '

2- Design a new panel labelled 's01e design cycle[ to

look like this.

heel pitch

balance line

save and exit

quit without saving

note : this panel should appear after the 'sole design'

option in the main menu is selected.

3- If ' heel pitch section ' in step 2 is selected then display

medial view of foot and sub-menu as shown below.
Pt A : lowest pt of

heel

Pt B : lowest pt of

ball of foot

heel

_ pitch

I/2

i

i i/2

2

select

done

4- Once the heel pitch is selected then redisplay the _-

foot with the selected heel pitch for visual check_ _f

the view is satisfactory, then 'done ' option is "_

selected, and the panel in step 2 is shown again.

5- If ' balance line ' option in step 2 is selected then

display the following screen :

flexibility

inversion angle

eversion angle

done

yes no

(default is

zero)

_default is

zero)

When ' done ' is picked in step 5, the screen in step

2 should be shown again.

f

In summary, the four basic pieces of information required for the sole

design process are :

i- heel pitch

2- inversion angle

3- eversion angle

4- foot flexibility ( yes or no )

They will be used to determine a reference plane below which the foot

would be shown and used in the derivation of the mold geometry for

casting the sole.
PART III

Two types of files are required :

a- parameter file to contain last ID number, heel pitch,

inversion angle, eversion angle, and foot flexibility.

b- Points coordinate file to contain the geometry of the

lower portion of the foot ( see examples below )

Example 1 :

reference plane

passing thru

max width of

foot

normal foot, inversion angle = eversion angle #_

_ " _ portion to discard

( ,

¢

portion to be saved

and sent to UMC

Examole 2 : pronated foot, flexible, eversion angle=5 deg

inversion = 0

bisectionllne__ eversion angle

Example 3 : supinated foot, flexible, inversion angle = 5

deg., eversion angle = 0 deg.

bisection lin inversion angle

!j---
I

i

I

I

!

I

I

I

I

I

]

I

I

I

I

I

I

!

*******************

close databases

select 2

use side

select 1

use foot2

rx=x

maax=x

maay=y

maaz=z

miix=x

miiy=y

miiz=z

skip

do while .t.

select 1

if .not.(eof())

if x<>rx+0.5

if y>maay

maay=y

maax=x

maaz=z

skip

loop

else

if y<miiy

miix=x

miiy=y

miiz=z

skip

loop

else

skip

loop

endif

endif

else

select 2

append blank

PROGRAM NAME : S I.PRG

replace lax with maax,lay with maay,laz with maaz

replace smx with miix,smy with miiy,smz with miiz

select 1

rx=x

maax=x

maay=y

maaz=z

miix=x

miiy=y

miiz=z

loop

endif

else

select 2

append blank

replace lax with maax,lay with maay,laz with maaz

replace smx with miix,smy with miiy,smz with miiz

exit

endif

enddo
******************* PROGRAM NAME : SOLE2.PRG *************************

close databases

select 1

use foot2

rx=x

select 2

use side

select 3

use sole

flagl=0

flag2=0

flag3=0

do while .t.

select 1

if x<>rx+0.5.and.(.not.eof())

if y=side->lay

flagl=l

endif

if y=side->smy

flag2=l

flag3=l

endif

do case

case flagl=0.and.f!ag2=0.and, flag3=0

select 1

skip

loop

case flagl=l.and.flag2=0.and.flag3=0

select 3

append blank

replace sox with foot2->x,soy with foot2->y,soz with foot2->:

select 1

skip

loop

case flagl=l.and.flag2=l.and.flag3=l

select 3

append blank

replace sox with foot2->x,soy with foot2->y,soz with foot2->_

flag3=0

select 1

skip

loop

case flagl=l.and.flag2=l.and.flag3=0

select 1

skip

loop

endcase

else

if .not. (eof())

flagl=0

flag2=0

rx=x

select 2

skip

loop

else

exit
endif

endif

enddo
,

!11

!

!

!

!

!

!

!

!

******************* PROGRAM NAME : DINTERI.PRG *************************

* PURPOSE: TO INSERT FOUR MORE SLICES IN BETWEEN EVERY TWO CURRENT *

* SLICES BY INTERPOLATION ( 0.5->0.1 INCH ) *

* PROGRAMMER: PAUL N. LIN DATE: OEC. 6, 1989 *

**************************************************************************

close databases

select 1

use dsole2

select 2

use dsole

rx=sox

inx=sox

nol=recno()

do while .t.

count next 25 for sox=rx to ccl

goto nol

count next 50 for sox=rx+0.5 to cc2

do dsubintl with nol,ccl,cc2

if sox<>10.0

rx=rx+0.5

loop

else

do while .t.

if .not.eof()

select 1

append blank

replace sox with dsole->sox,soy with dsole->soy,soz with ;

dsole->soz

select 2

skip

loop

enddo

exit

endif

enddo

return

!

I

!

!

!

I
!

!

!

!

!

!

!

!

l

******************* PROGRAM NAME : DSUBINTI.PRG *************************

* PURPOSE: THE SUBROUTINE OF DINTERI.PRG TO ADD SLICES IN BETWEEN

* CURRENT SLICES ( 0.5 -> 0.I INCH ) *

* PROGRAMMER: PAUL N. LIN DATE: 'DEC. 6, 1989

***************************************************************************

parameter nol,ccl,cc2

nno=nol

head=max(ccl,cc2)

tail=min(ccl,cc2)

cut=mod(head,tail)

if cut=O

pa=0

else

if head=ccl

pa=l

else

if head=cc2

pa=2

endif

endif

endif

do case

case pa=0

num=0

do while num<5

go nol

ppl=ccl

irx=sox+(0.1*num)

do while ppl>O

noo=recno ()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly=(dy-oy)/5

Iz= (dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl-i

select 2

skip

loop

enddo

num=num+l

loop

enddo

nol=recno ()

return

case pa=l

go nol

odd=mod(ccl,2)

do case

case odd=0

midd=(ccl/2)
rr=ccl

do while rr>O

select 1

append blank

replace sox with dsole->sox,soy with dsole->soy,soz with ;

dsole->soz

rr=rr-I

select 2

skip

loop

enddo

num=l

do while num<5

go nol

ppl=l

irx=sox+(O.l*num)

do while ppl<=ccl

if ppl<=midd

noo=recno()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly=(dy-oy) /5

iz= (dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+ (iz *num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

else

noo=recno()

oy=soy

oz=soz

sk=noo+cc2

go sk

dy=soy

dz=soz

ly= (dy-oy)/5

Iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

endif

enddo

num=num+l
I

i

i

i

i

i

I

I

I

I

i

i

I

I

I

!

I

I

loop

enddo

nol=recno()

return

case odd=l

midd= (int (cci/2))

rr=ccl

do while rr>O

select 1

append blank

replace sox with dsole->sox,soy with dsole->soy,soz with ;

dsole->soz

rr=rr-i

select 2

skip

loop

enddo

num=l

do while num<5

go nol

ppl=l

irx=sox+(O.l*num)

do while ppl<=ccl

if ppl<=midd

noo=recno ()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly = (dy-oy)/5

iz= (dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

else

noo=recno()

oy=soy

oz=soz

sk=noo+cc2

go sk

dy=soy

dz=soz

ly=(dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

I
select 2

skip

loop

endif

enddo

num=num+l

loop

enddo

nol=recno()

return

endcase

case pa=2

go nol

odd=mod(ccl,2)

do case

case odd=O

midd= (cci/2)

rr=ccl

do while rr>O

select 1

ippend blank

replace sox with dsole->sox,soy with dsole->soy,soz with ;

dsole->soz

rr=rr-I

select 2

skip •

loop

enddo

num=l

do while num<5

go nol

ppl=l

irx=sox+(O.l*num)

do while ppl<=cc2

if ppl<=midd

noo=recno()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly=(dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+i

select 2

skip

loop

else

if ppl=midd+l

select 2

skip -I

endif

noo=recno()
oy=soy

oz=soz

sk=noo+cc2

go sk

dy=soy

dz=soz !

ly= (dy-oy)/5

iz= (dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

endif

enddo

"num=num+l

loop

enddo

nol=recno()

return

case odd=l

midd= (int (cci/2)) +I

rr=ccl

do while rr>O

select 1

append blank

replace sox with dsole->sox,soy with dsole->soy,soz with ;

dsole->soz

rr=rr-I

select 2

skip

loop

enddo

num=l

do while num<5

go nol

ppl=l

irx=sox+ (O. l*num)

do while ppl<=cc2

if ppl<=midd

noo=recno ()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly= (dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz
endcase

endcase

ppl=ppl+l

select 2

skip

loop

else

if ppl=midd+l

select 2

skip -i

endif

noo=recno ( )

oy=soy

oz=soz

sk=noo+cc2

go sk

dy=soy

dz=soz

ly=(dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(Iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

endif

enddo

num=num+l

loop

enddo

nol=recno()

return
******************* PROGRAM NAME : DINTER2.PRG ************************

* THIS PROGRAM IS USED TO INSERT ONE MORE LINE IN BETWEEN EVERY TWO *

* SLICES AND MAKE THE DISTANCE BETWEEN EVERY TWO CONTURE TO BE 0.05 *

* INCH. ( DSOLE.DBF -> DSOLETO2.DBF ) _ ,

* PROGRAMMER : PAUL N. LIN DATE : DEC. 6, 1989 *

close databases

select 1

use dsoleto2

select 2

use dsole2

rx=sox

inx=sox

nol=recno()

do while .t.

count next 25 for sox=rx to ccl

goto nol

count next 50 for sox=rx+0.1 to cc2

do dsubint2 with nol,ccl,cc2

if sox<>10.0

rx=rx+0.1

loop

else

do while .t.

if .not.eof()

select 1

append blank

replace sox with dsole2->sox,soy with dsole2->soy,soz with ;

dsole2->soz

select 2

skip

loop

enddo

exit

endif

enddo

return
!

!

!

!

!

!

!

******************* PROGRAM NAME : DSUBINT2.PRG ************************

* USAGE : A SUBROUTINE OF DINTER2.PRG TO MAKE THE DISTANCE BETWEEN EVERY *

* TWO SLICES TO BE 0.05 INCH. *

* PROGRAMMER : PAUL N. LIN DATE : DEC_ 6, 1989 *

parameter nol,ccl,cc2

nno=nol

head=max(ccl,cc2)

tail=min(ccl,cc2)

cut=mod(head,tail)

if cut=0

pa=O

else

if head=ccl

pa=l

else

if head=cc2

pa=2

endif

endif _

endif

do case

case pa=0

num=0

do while num<2

go nol

ppl=ccl

irx=sox+(0.05*num)

do while ppl>0

noo=recno ( )

oy=soy

OZ=SOZ

sk=noo+ccl

go sk

dy=soy

dz=soz

ly= (dy-oy)/2

iz= (dz-oz)/2

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl-i

select 2

skip

loop

enddo

num=num+l

loop

enddo

nol=recno()

return

case pa=l

go nol

odd=mod(ccl,2)

do case

case odd=0

midd= (cci/2)
i

I

I

I

I

I

I

I

I

I

I

I

I

I

I

I

I

I

rr=ccl

do while rr>O

select 1

append blank

replace sox with dsole->sox,soy with dsole->soy,soz with ;

dsole->soz

rr=rr-I

select 2

skip

loop

enddo

num=l

do while num<5

go nol

ppl=l

irx=sox+(O.l*num)

do while ppl<=ccl

if ppl<=midd

noo=recno ()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly= (dy-oy)/5

iz= (dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

else

noo=recno()

oy=soy

oz=soz

sk=noo+cc2

go sk

dy=soy

dz=soz

ly=(dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

endif

enddo

num=num+l

|
I

I

!

i

I

I

I

!

I

I

I

I

I

loop

enddo

nol=recno ()

return

case odd=l

midd= (int (cci/2) )

rr=ccl

do while rr>O

select 1

append blank

replace sox with dsole->sox,soy with dsole->soy,soz with ;

dsole->soz

rr=rr-i

select 2

skip

loop

enddo

num=l

do while num<5

go nol

-ppl=l

irx=sox+(O.l*num)

do while ppl<=ccl

if ppl<=midd

noo=recno()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly= (dy-oy)/5

iz= (dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+ (iz *num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

else

noo=recno()

oy=soy

OZ=SOZ

sk=noo+cc2

go sk

dy=soy

dz=soz

ly=(dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+ (Iz *num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l
endcase

case pa=2

go nol

select 2

skip

loop

endif

enddo

num=num+l

loop

enddo

nol=recno()

return

odd=mod(ccl,2)

do case

case odd=O

midd=(ccl/2)

rr=ccl

do while rr>O

select 1

append blank

replace sox with dsole->sox,soy with dsole->soy,soz with ;

dsole->soz

rr=rr-I

select 2

skip

loop

enddo

num=l

do while num<5

go nol

ppl=l

irx=sox+(O.l*num)

do while ppl<=cc2

if ppl<=midd

noo=recno()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly= (dy-oy)/5

iz= (dz-oz)/5

go noo

iry=soy+(Iy*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

else

if ppl=midd+l

select 2

skip -i

endif

noo=recno ()
!

!

!

!

!

!

!

!

!

!

!

|

oy=soy

OZ=SOZ i

sk=noo+cc2

go sk

dy=soy

dz=soz

ly= (dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

endif

enddo

°

num=num+l

loop _:.

enddo

nol=recno()

return

case odd=l

midd=(int(ccl/2))+l

rr=ccl

do while rr>O

select 1

append blank

replace sox with dsole->sox,soy with dsole->soy,soz with ;

dsole->soz

rr=rr-i

select 2

skip

loop

enddo

num=l

do while hum<5

go nol

ppl=l

irx=sox+(O.l*num)

do while ppl<=cc2

if ppl<=midd

noo=recno()

oy=soy

OZ=SOZ

sk=noo+ccl

go sk

dy=soy

dz=soz

ly=(dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(Iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz
endcase

endcase

ppl=ppl+l

select 2

skip

loop

else

if ppl=midd+l

select 2

skip -i

endif

noo=recno()

oy=soy

oz=soz

sk=noo+cc2

go sk

dy=soy

dz=soz

ly=(dy-oy)/2

iz=(dz-oz)/2

go noo

iry=soy+(ly*num)

irz=soz+(Iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

endif

enddo

num= num+ 1

loop

enddo

nol=recno()

return
******************* PROGRAMNAME : DINTER3.PRG *************************

* PURPOSE: TO INSERT FOUR MORESLICES IN BETWEENi0.00 and 10.25 *

* ( 0.25->0.05 INCH ) *

* PROGRAMMER:PAUL N. LIN DATE: DEC. 6, 1989 *

close databases

select 1

use dsoleto3

select 2

use dsoleto2

do while .t.

hx=sox

if hx<>lO.O0

t

select 1

append blank

replace sox with dsoleto2->sox,soy with dsoleto2->soy,soz with ;

dsoleto2->soz

select 2

skip

loop

endif

exit

enddo

rx=sox

inx=sox

nol=recno()

count next 25 for sox=rx to ccl

goto nol

count rest for sox=rx+0.25 to cc2

do dsubint3 with nol,ccl,cc2

do while .t.

if .not.eof()

select 1

append blank

replace sox with dsoleto2->sox,soy with dsoleto2->soy,soz with ;

dsoleto2->soz

select 2

skip

loop

endif

exit

enddo

close databases

return

I

I

!

I
|

******************* PROGRAM NAME : DSUBINT3.PRG *************************

* PURPOSE: THE SUBROUTINE OF DINTER3.PRG TO ADD FOUR MORE SLICES *

* IN BETWEEN I0.00 AND 10.25 ( 0.25 -> 0.0.05 INCH ) *

* PROGRAMMER: PAUL N. LIN DATE: D_C. 6, 1989 *

parameter nol,ccl,cc2

nno=nol

head=max(ccl,cc2)

tail=min(ccl,cc2)

cut=mod(head,tail)

if cut=0

pa=O

else

if head=ccl

pa=l

else

if head=cc2

pa=2

endif

endif

endif

do case

case pa=0

num=0

do while num<5

go nol

ppl=ccl

irx=sox+(O.l*num)

do while ppl>O

noo=recno()

oy=soy

OZ=SOZ

sk=noo+ccl

go sk

dy=soy

dz=soz

ly= (dy-oy)/5

Iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+ (iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl-!

select 2

skip

loop

enddo

num=num+l

loop

enddo

nol=recno ()

return

case pa=l

go nol

odd=mcd(ccl,2)

do case

case odd=0

midd= (cci/2)
I

I

I

I

I

I

I

I

I

I

I

l

I

l

rr=ccl

do while rr>O

select l

append blank

replace sox with dsoleto2->sox,soy with dsoleto2->soy, ;

soz with dsoleto2->soz

rr=rr-I

select 2

skip

loop

enddo

num=l

do while num<5

go nol

ppl=l

irx=sox+(O.l*num)

do while ppl<=ccl

if ppl<=midd

noo=recno()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly= (dy-oy)/5

iz= (dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(Iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop i

else

noo=recno ( )

oy=soy

oz=soz

sk=noo+cc2

go sk

dy=soy

dz=soz

ly= (dy-oy )/ 5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

endif

enddo

num=num+l
!

|

|

!

!

|

!

I

!

i

!

!

1

I

I

I,

I

I

loop

enddo

nol=recno ()

return

case odd=l

midd= (int (cci/2))

rr=ccl

do while rr>O

select I

append blank

replace sox with dsoleto2->sox,soy with dsoleto2->soy,

soz with dsoleto2->soz

rr=rr-I

select 2

skip

loop

enddo

num=l

do while num<5

go nol

ppl=l

irx=sox+(O.l*num)

do while ppl<=ccl

if ppl<=midd

noo=recno ()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy _'

dz=soz

ly= (dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

else

noo=recno()

oy=soy

oz=soz

sk=noo+cc2

go sk

dy=soy

dz=soz

ly=(dy-oy)/5

Iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(Iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l
[

I

l

l

!

I

[

i

!

I

I

I

!

I

I

I

!

I

select 2

skip

loop

endif

enddo

num=num+l

loop

enddo

nol=recno()

return

endcase

case pa=2

go nol

odd=mod(ccl,2)

do case

case odd=O

midd= (cci/2)

rr=ccl

do while rr>O

w.

select 1

"append blank

replace sox with dsoleto2->sox,soy with dsoleto2->soy, ;

soz with dsoleto2->soz

rr=rr-i

select 2

skip

loop

enddo

num=l

do while num<5

go nol

ppl=l

irx=sox+(O.l*num)

do while ppl<=cc2

if ppl<=midd

noo=recno ()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly=(dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

else

if ppl=midd+l

select 2

skip -i

endif

noo=recno()
i

i

1

!

I

I

I

I

I

I

I

I

I_

1

I

I

I

I

I

oy=soy

oz=soz

sk=noo+cc2

go sk

dy=soy

dz=soz

ly= (dy-oy)/5

Iz= (dz-oz)/5

go noo

iry=soy+ (ly*num)

irz=soz+(Iz*num)

select 1

append blank

replace sox with irx,soy with iry, soz with irz

ppl=ppl+l

select 2

skip

loop

endif

enddo

"num=num+l

loop

enddo

nol=recno ()

return

case odd=l

midd=(int(ccl/2))+l

rr=ccl

do while rr>O

select 1

append blank

replace sox with dsoleto2->sox,soy with dsoleto2->soy, ;

soz with dsoleto2->soz

rr=rr-I

select 2

skip

loop

enddo

num=l

do while hum<5

go nol

ppl=l

irx=sox+(O.l*num)

do while ppl<=cc2

if ppl<=midd

noo=recno()

oy=soy

oz=soz

sk=noo+ccl

go sk

dy=soy

dz=soz

ly= (dy-oy)/5

iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(Iz*num)

select 1

append blank

replace sox with irx,soy with iry,soz with irz
endcase

endcase

ppl=ppl+l

select 2

skip

loop

else

if ppl=midd+l

select 2

skip -i

endif

noo=recno()

oy=soy

oz=soz

sk=noo+cc2

go sk

dy=soy

dz=soz

ly=(dy-oy)/5

Iz=(dz-oz)/5

go noo

iry=soy+(ly*num)

irz=soz+(Iz*num)

select 1

append blank

replace sox with irx, soy with iry,soz with irz

ppl=ppl+l

select 2

skip

loop

endif

enddo

num=num+l

loop

enddo

nol=recno()

return

!

!

!

!

!

!
******************* PROGRAM NAME : REBOI.PRG ****************************

* USAGE : TO CONVERT CONTOURS INTO ZIG ZAG SHAPE WHERE DISTANCE BETWEEN

* EVERY TWO CONTOURS IS 0.05 INCH.

* PROGRAMMER : NIENSUNG LIN DATE : OCT. 5 1989

***************************************************************************

close databases

select 2

use soleto3

select 1

use soleto2

rx=sox

sh=0

co=0

do while .t.

if sox=rx.and.(.not.eof())

select 2

append blank

replace sox with soleto2->sox,soy with soleto2->soy,soz with soleto2-:

select 1

skip

loop

else

if sox=rx+0.OS.and.(.not.eof())

CC=CC+ 1

skip

loop

else

if sox=rx+O.l.and.(.not.eof())

rx=sox

bb=cc

skip -i

do while .t.

if cc<>0

select 2

append blank

replace sox with soleto2->sox,soy with soleto2->soy,soz with soleto2->s

select 1

CC=CC-I

skip -i

loop

else

select 1

dd=recno()+bb+l

goto dd

exit

endif

enddo

loop

else

if eof()

exit

endif

endif

endif

endif

enddo
I

t

i

I

I

I

I

I

I

I

I

I

************************** PROGRAM NAME : IOS.PRG **********************

* USAGE : TO ADD A PROPER THICNESS TO THE SOLE AND TURN IT OVER FOR THE *

* NECESSITY OF MACHINING WHERE THE FOOT DATA IS OF 0.05 INCH *

* CONTOUR DISTANCE. _ ,

* PROGRAMMER : NIENSUNG LIN DATE : OCT. 5 1989 ,

**************************************************************************

close databases

select 1

use soleto5

select 2

use soleto4

rx=sox

inc= (2-i)/200

ba=-2

do while .t.

if sox<>rx+0.O5.and.(.not.eof())

iiz=ba-soz

select 1

append blank

replace sox with soleto4->sox,soy with soleto4->soy,soz with iiz

select 2

skip

loop

else

if (scx=rx+O.O5).and. (.not.eof())

rx=sox

ba=ba+inc

loop

else

if eof()

exit

endif

endif

endif

enddo

close databases

return
i

i

I

i

i

!

I

!

I

I

I

I

I

!

I

i

I

********************** PROGRAM NAME : FLATEDI.PRG ************************

* USAGE : TO FLAT THE EDGE OF THE SOLE AND MAKE IT SMOOTHER

* PROGRAMMER : NIENSUNG LIN DATE : OCT. 6 1989

close databases

select 2

use soleto5

ix=sox

do while .t.

if sox=(ix+0.05) .and. (.not.eof())

skip -i

iy=soy

skip -i

do while .t.

if iy<0.0001

if soy> (iy+0.5)

fx=sox

fy=soy

fz=soz

skip

do while .t.

if sox<> (ix+0.05)

SX=SOX

sy=soy

SZ=SOZ

m=(sz-fz)/(sy-fy)

if m>l

ssz=fz+ (sy-fy)

replace soz with ssz

endif

fx=sox

fy=soy

fz=soz

skip

loop

else

exit

endif

enddo

ix=sox

exit

else

skip -i

loop

endif

endif

if iy>-0. 0001

if soy< (iy-0.5)

fx=sox

fy=soy

fz=soz

skip

do while .t.

if sox<> (ix+0.05)

SX=SOX

sy=soy

SZ----SOZ

m= (sz-fz) / (sy-fy)

if m< (-i)

ssz=fz- (sy- fy)

|
replace soz with ssz

endif

fx=sox

fy=soy

fz=soz

skip

loop

else

exit

endif

enddo

ix=sox

exit

else

skip -i

loop

endif

endif

enddo

loop

else if (.not.eof())

skip

loop

I else

skip -i

iy=soy

do while .t.

if iy<O.O001

if soy>(iy+0.5)

_ fx=s°x fy=soy

fz=soz

skip

do while .t.

if (.not.eof())

sx=sox

sy=soy

sz=soz

m=(sz-fz) / (sy-f?)

if m>l

ssz=fz+(sy-fy)

replace soz with ssz

endif

l fx=sox

fy=soy

fz=soz

l skip loop

else

exit

l endif

enddo

exit

l else

_ skip -i

loop

l endif endif

if iy>-O.O001

!
l

!

I

I

!.

I

I

i

I

I

I

I

I

!

if soy<(iy-0.5)

fx=sox

fy=soy

fz=soz

skip

do while .t.

if (.not.eof())

sx=sox

sy=soy

sz=soz

m=(sz-fz)/(sy-fy)

if m< (-i)

ssz=fz- (sy-fy)

replace soz with ssz

endif

fx=sox

fy=soy

fz=soz

skip

loop

else

exit

endif

enddo

exit

else

skip -i

loop

endif

endif

enddo

skip -i

ix=sox

do while .t.

if sox=(ix-O.OS).and. (recno()<>l)

skip

iy=soy

skip

do while .t.

if iy<O.O001

if soy>(iy+0.5)

fx=sox

fy=soy

fz=soz

skip -i

do while .t.

if sox<>(ix-0.05)

sx=sox

sy=soy

sz=soz

m= (sz-fz) / (sy-fy)

if m>l

ssz=fz+ (sy-fy)

replace soz with ssz

endif

fx=sox

fy=soy

fz=soz

skip -i

loop
IIIIIIIIIII!III!II

else

exit

endif

enddo

ix=sox

exit

else

skip

loop

endif

endif

if iy>-O.O001

if soy<(iy-0.5)

fx=sox

fy=soy

fz=soz

skip -i

do while .t.

if sox<>(ix-O.05)

sx=sox

sy=soy

sz=soz

m= (sz-fz)/ (sy-fy)

if m< (-i)

ssz=fz-(sy-fy)

replace soz with ssz

endif

fx=sox

fy=soy

fz=soz

skip -i

loop

else

exit

endif

enddo

ix=sox

exit

else

skip

loop

endif

endif

enddo

loop

else

if (recno()<>l)

skip -i

loop

else

iy=soy

do while .t.

if soy<(iy-0.5)

fx=sox

fy=soy

fz=soz

skip -!

do while .t.

if (recno () <>i)

sx=sox

B
I

!

I

I

i

I

I

I

!

I

I

I

sy=soy

SZ=SOZ

m= (sz-fz) / (sy-fy)

if m< (-i)

ssz=fz-(sy-fy)

replace soz with ssz

loop

endif

fx=sox

fy=soy

fz=soz

skip -i

loop -.

else

exit

endif

enddo

SX=SOX

sy=soy

SZ=SOZ

m= (sz-fz) / (sy- fy)

if m< (-I)

ssz=fz- (sy- fy)

replace soz with ssz

loop

endif

return

else

skip

loop

endif

enddo

endif

endif

enddo

endif

endif

enddo

return
|

I

!

I

i

i

I

i

I

I

I

I

I

I

******************* PROGRAM NAME : DINFERI.PRG **************************

* USAGE : TO RAISE THE CUTTER TO A PROPER HEIGHT IF NECESSARY TO SOLVE

* THE MACHING INTERFERENCE PROBLEM.

* PROGRAMMER : PAUL N. LIN DATE : DEC. 6, _1989

***************************************************************************

close databases

select 1

use dsoleto7

select 2

use dsoleto6

ix=sox

iy=soy

iz=soz

skip

do while .t.

if sox=ix, and. (.not. eof ())

ux=sox

uy=soy

uz=soz

rr=(3/32)

pl=iz+rr

p2=uy-iy

p3 = (p2*p2) + (pl*pl) - (rr*rr)

if ((4*(pl*pl))-(4*p3))<-O.000001

select 1

append blank

replace sox with ix,soy with iy,soz with iz

select 2

ix=sox

iy=soy

iz=soz

skip

loop

endif

z1=((2"pl) +sqrt( (4* (pl*pl))-(4"p3) ) )/2

z2= ((2*pl) -sqrt ( (4" (pl*pl))- (4"p3)) )/2

if zl>z2

zz=z2

else

zz=zl

endif

if zz<uz

sigma=abs (zz-uz )

select 1

append blank

replace sox with ix,soy with iy,soz with (iz+sig_a)

select 2

ix=sox

iy=soy

iz=soz

skip

loop

else

select 1

append blank

replace sox with ix,soy with iy,soz with iz

select 2

ix=sox

iy=soy

iz=soz

I
|

|

|

|

|

!

!

!

skip

loop

endif

else

if sox<>ix.and.(.not.eof())

select 1

append blank

replace sox with ix,soy with iy,soz with iz

select 2

ix=sox

iy=soy

iz=soz

skip

loop

else

select 1

append blank

replace sox with ix,soy with iy,soz with iz

exit

endif

endif

enddo

close databases

return

!

!

!

!

!

!

! J

I
|

|

|

|

U

|

!

!

!

!

I

|

!

I

!

I

!

******************* PROGRAM NAME : DNCTO7.PRG

close databases

RE='$'

STA=' (DNCT07 ) '+RE

select 2

use dncto7

APPEND BLANK

REPLACE STAMENT WITH STA

select 1

use dsoleto7

N='N'

LI=I00

GI='G00 '

G2='G01'

F= 'F60 '

XX= 'X '

yy=,y,

ZZ='Z '

PE=' (E) '

M1 = 'M00 '

M2='M03 '°

S I=LTRIM (STR (LI, 4 ) )

S 2=LTRIM (STR (DSOLETO7->SOX, 8,4 ) )

S3=LTRIM (STR (DSOLETO7->SOY, 8,4 ) )

S4=LTRIM (STR (DSOLETO7->SOZ, 8,4 ) )

UP= '5 '

IF LEN (SI) <4

SI=,0,+SI

ENDIF

STA=N+S I+PE+ 'G90 '+RE

SELECT 2

APPEND BLANK

REPLACE STAMENT WITH STA

LI=LI+l

STA=N+ '0 '+LTRIM (STR (LI, 4 ) ) + ' (9 ) '+ 'M06 '+ 'T01 '+RE

SELECT 2

APPEND BLANK

REPLACE STAMENT WITH STA

LI=LI+I

STA=N+'0'+LTRIM(STR(LI,4))+' (9) '+'M03'+'S757'+RE

SELECT 2

APPEND BLANK

REPLACE STAMENT WITH STA

LI=LI+I

STA=N+' 0 '+LTRIM (STR (LI, 4) ) +PE+GI+XX+S2+YY+S3+ZZ+S4+RE

SELECT 2

APPEND BLANK

REPLACE STAMENT WITH STA

SELECT 1

SKIP

LI=LI+I

SI=LTRIM (STR(LI, 4) )

S2=LTRIM (STR (DSOLETO7 ->SOX, 8,4 ) )

S3=LTRIM (STR(DSOLETO7->SOY, 8,4) )

S4=LTRIM (STR (DSOLETO7->SOZ, 8,4) )

IF LEN (Sl) <4

SI= '0 '+SI

ENDIF

STA=N+S I+PE+G 2 +XX+S 2+YY+S 3 + Z Z+S 4 + F+RE

SELECT 2
1

I

I

I

I

|

|

|

!

!

I

!

!

I

I

!

I

APPEND BLANK

REPLACE STAMENT WITH STA

SELECT 1

SKIP L

DO WHILE .T.

IF .NOT. EOF ()

LI=LI+I

S I=LTRIM (STR (LI, 4 ) )

S 2=LTRIM (STR (DSOLETO7->SOX, 8,4 ) )

S 3=LTRIM (STR (DSOLETO7 ->SOY, 8,4 ) )

S4=LTRIM (STR (DSOLETO7->SOZ, 8,4 ) )

IF LEN(SI) <4

SI='0'+SI

ENDIF

STA=N+S I+PE+G2+XX+S 2+YY+S 3 +Z Z+S 4 +F+RE

SELECT 2

APPEND BLANK

REPLACE STAMENT WITH STA

SELECT 1

SKIP

LOOP

ELSE

LI=LI+l

STA=N+LTRIM (STR (LI, 4 ) ) +PE+ 'GO 1 '+ZZ+UP+RE

SELECT 2

APPEND BLANK

REPLACE STAMENT WITH STA

LI=LI+I

STA=N+LTRIM(STR(LI, 4) )+PE+'G00 '+XX+' 0.0 '+YY+' 0.0 '+ZZ+ '0.0 '+RE

APPEND BLANK

REPLACE STAMENT WITH STA

LI=LI+I

STA=N+LTRIM (STR (LI, 4 ) )+PE+ 'GI7 '+RE

APPEND BLANK

REPLACE STAMENT WITH STA

LI=LI+ 1

STA=N+LTRIM (STR (LI, 4 ) ) + ' (9 ) '+ 'M05 '+RE

APPEND BLANK

REPLACE STAMENT WITH STA

LI=LI+I

STA=N+LTRIM(STR(LI,4))+' (9) '+'M02'+RE

APPEND BLANK

REPLACE STAMENT WITH STA

LI=LI+I

STA=N+LTRIM(STR(LI,4))+' (9) '+'M30'+RE

APPEND BLANK

REPLACE STAMENT WITH STA

STA= 'END '+RE

APPEND BLANK

REPLACE STAMENT WITH STA

EXIT

ENDIF

ENDDO

CLOSE DATABASES

I

!
APPENDIX 3

J_

* Program : detachl.c

* Purpose : Mainly to replace "detach.c"

* Detach points below maximum width for each lattitude and regist

* them.

* Date : 11-Feb-1990

* Time : 14:35:42

To detach:

for each lattitude find a point with smallest z

set maxX and minX

for each lattitude

step up from that point to both direction to find maxX and minX

and register the vertices.

update vertices and extreme values.

for each lattitude

write only vertices between the extrema.

*/

calling:

wsole(_; writes sole array and initialize it.

pbottom ( _ );

wsolexyz( , , );

#include <stdio.h>

#include <malloc.h>

#include <math.h>

#define NUMLAT 59

#define NUMLON 64

struct coor (

long x;

long y;

long z;

};

struct lat {

struct coor xyz[NUMLAT]_

};

struct fat sI[NUMLON];

struct coor sole[NUMLON];

FILE *filein, *fileoutl, *fileout2; /* *fileout3, *fileout4; */

int Ig, lt;

int xplus, xminus_ Ionplus, lonminus;

main ()

{

printf ("enter readin()\n");

readin();

printf ("but readin() and enter solext\n");

origen()_

solext();

printf ("out solext(}\n")_

/*fcloseall (); */
filein = fopen ("ronXxX.rec", "r");

for (Ig = O; Ig < NUMLON;Ig++) {

for (It = O; It < NUMLAT; It÷+) {

fscanf (filein, "%D%D%O",

&sl[Ig].xyz[lt].x, &sl[lg].xyz[it].y, &slElg].xyz[lt].z);

}

)

fclose (filein);

origen() {

fileout2 = fopen ("Iong.lat","w");

/* fileout3 = fopen ("long.lip", "_")_ for lisp program */

for (It = O; it < NUMLAT; lt++) {

for (Ig = O; ig < NUMLON; lg++} {

fprintf (fileout2, "%ld Xld Xld\n",

sl[lg3.xyz[It].x, sl[lg].xyzElt].y, sl[Ig].xyz[lt].z);

/* fprintf (fileout3, "_ld\n%ld\nXld\n",

sl[Ig].xyz[lt3.x, sl[Ig].xyz[lt].y, sl[lg].xyzElt].z); */

}

/* fprintf (fileout3, "n\n")_ */

}

fclose (fileout2);

/* fclose (fileout3}; */

}

#define MIN (Iong)(-2147483647)

long zmax;

struct cyxyz {

long x;

long y;

long z;

struct cyxyz *ptrnext;

struct cyxyz *ptrprvs;

);

struct cyxyz *ptrfirst, *ptrthis, *ptrne_, *ptrZmax, *Iring, *rring;

solext()

{

printf ("start of solext()\n");

zmax = MIN;

fileoutl = fopen ("sole.dat","w");

/* fileout4 = fopen ("sole. lip","w");

xplus = O; xmiT_uS = 01

Ionp_us = lonminus;

// for lisp program */

f_

/*

}

printf ("sole×t loop entering\n");

for (It = O; It < NUMLAT; it++) {

printf ("enter makering()\n");

makering()_

printf ("enter widesole<)\n")_

widesole();

printf ("enter edgeadjust(}\n"};

edgead_ust();

printf ("enter writesole()\n");

writesole();

*/

relmem();//PENDING PENDING PENDING PENDING PENDING PENDING PENDING

makering()

{
f.

II

11

II

J*

II

II

II

;pr_nt_ ITlleoutl,"mailoc error at it _d Ig %O\n",Ig, It);

exit(l);

}

zmax = MIN;

ptrfirst : ptrthis = ptrnew;

ptrthis->x = sl[O3.xyz[lt].x;

ptrthis->y = sl[O].xyz[It].y;

ptrthis->z = sl[O].xyz[It].z;

ptrthis->ptrnext = <struct cyxyz *)NULL;

ptrthis->ptrprvs = (struct cyxyz *)NULL_

ptrZmax = ptrthis;

if (zmax < ptrthis->z) {

zmax = ptrthis->z;

ptrZmax = ptrthis;

}*/

for (lg = I; Ig < NUMLON; lg÷+) {

if ( (ptrnew = (struct cy×yz *) malloc (sizeof (struct cyxyz))) == NL

fprintf (fileoutl,"malloc error at Yt Xd Ig %d\n",lg, It);

exit(l);

}

ptrthis->ptrnext = ptrnew;

ptrnew->ptrprvs = ptrthis;

ptrthis = ptrnew;

ptrthis->x = sl[lg].xyzElt].x;

ptrthis->y = sl[lg].xyz[It].y;

ptrthis->z = sl[lg].xyz[It].z_

ptrthis->ptrne×t = (struct cyxyz *)NULL;

if (zmax < ptrthis->z) {

zmax = ptrthis->z;

ptrZmax = ptrthis;

}*/

}

ptrthis->ptrnext = ptrfirst;

ptrfirst-)ptrprvs = ptrthis;

widesole()

(

long xthis, xthat, xmax, diff;

struct cyxyz *this, *that;

this = that = Iring = rring = (struct cyxyz *)NULL;

this = ptrZmax->ptrnext;

that = ptrZma×->ptrprvs;

xthis = this->x;

xthat = that->x;

xmax = O;

/* diff = labs (xthat - xthis); */

diff = abs (×that -- xthis);

while (xmax < diff) (

xmax = diff;

Iring = that;

rring = this;

that = that->ptrprvs;

this = this->ptrnext;

xthat = that->x;

xthis = this->x;

/* diff = labs (xthat - xthis); */

diff = abs (xthat - xthis);
_oeTine nH_t_HL_ _U.U

#define RTOD57.29578

#define MAXRAD0.34906585

#define ANGLE(×,y)(atan2(y,x))

#define SLOPE(x,y) ((float) (y/x))

#define PI 3.1415927

#define M0.363970

edgeadjust() {

struct cyxyz *pO, *pl, *pm;

long xO, xl, zO_ zl, xm, zm, zadj_ xwatchl, xwatchr;

float diffx, diffz, anqle, slope;

printf ("start of edgeadjust()\n");

pO = pl = (struct cyxyz *)NULL;

f_

//

//

//

//

printf ("left edge\n");

/* left edge */

pO = Iring;

pl = lring->ptrnext;

do (

xO = pO->x; xl = pl->x;

zO = pO->z_ zl = pl->z;

pO = pl; pl = pl->ptrnext;

diffx = fabs ((float) (xl-xO)); diffz = labs ((float) (zl-zO));

if (diff× _= O) {

angle = (float) atan2 ( (double)diffz, (double)diffx );

}

else

angle = MAXRAO+I;

} while (angle > MAXRAD);

lring = pO; */

xwatchl = xO;

do {

pl = pO;

pO = pO->ptrprvs; pm = pO->ptrprvs;

xl = p1->x; xO = pO->x; xm = pm->×;

zl = pl->z; zO = pO->z;

if (xm <= xwatchl) (

xwatchl = xm;

diffx = (float) (xl-xO); diffz = (float) (zl-zO);

if (diffx != O) {

slope = diffx / diffz;

zadj = (Iong)(slope * (xm - xO) + zO);

} else

zadj = zO; */

zadj = (long)(M * (xm-xO)) + zO;

pm->z = zadj;

} else {

lring = pO;

pm = lring;

}

} while (pm != lring);

printf ("right edge\n");

/* right edge */

pO = rring;

pl = rring->ptrprvs;

do {

xO = pO->x; xl = pl->×;

zO = pO->z; zl = pl->z;

pO = pl; pl = pl->ptrprvs;

diffx = fabs ((float) (×l-×O)); diffz = labs ((float) (zl-zO));
angle = (_ioat) atan_ ( (douDle)dztCz, iQouOle_dl_Tx _

}

else

angle = MAXRAD+I;

} while (angle > MAXRAD)_

/* rring = pO_ */

xwatchr = xO_

do {

pl = pO;

pO = pO->ptrnext; pm = pO->ptrnext;

×I = pl->x_ xO = pO->x; xm = pm->x;

zl = pl->z; zO = pO->z;

if (xm >= xwatchr) {

xwatchr = xm;

diffx = (float) (xl-xO); diffz = (float) (zl-zO);

/* if (diffx != O) (

// slope = diffx / diffz;

// zadj = (Iong)(slope * (xm - xO) + zO);

// } else

-// zadj = zO_ */

zadj = (Iong)(-M * (xm-xO)) + zO;

pm->z = zadj;

} else {

rring = pO_

pm = rring_

}

} while (pm != rring);

arctan(x_z)

long x, z;

{

if (x == 0.0) {

if (z >= 0.0) (

return (PI);

}

else {

return (-PI);

}

} else return (atan2( z,x )};

writesole() /* with zigzag in mind! */

{

static int zigzag = O;

switch (zigzag) {

case O:

ptrthis = lring;

while (ptrthis != rring) {

fprintf (fileoutl_ "%Id %Id %Id\n",

ptrthis->×, ptrthis->y_ ptrthis->z);

ptrthis = ptrthis->ptrnext;

}

fprintf (fileoutl_ "%ld %Id %id\n",

ptrthis->×_ ptrthis-->y, ptrthis->z);
case I:

ptrthis = rring_

_hile.(ptrthis _= lring) {

fprintf (fileoutl, "%Id %ld %ld\n",

ptrthis->×, ptrthis->y_ ptrthis->z)_

ptrthis = ptrthis->ptrprvs;

}

fprintf (fileout19 "%ld %ld %Id\n",

ptrthis->×, ptrthis->yJ ptrthis->z)_

break_

}

if (zigzag == O) (

zigzag = 1_

} else {

zigzag = O;

}

relmem()

{

int i;

struct cyxyz *this_ *thatl

this = that = (struct cyxyz *)NULL;

this = ptrfirst;

that = this->ptrprvs;

this = that->ptrprvs;

for (i = OF i < NUMLON; i++) {

free ((void *) that);

that = this->ptrprvs;

this = that-->ptrprvs;

}
f*

,/

Program : insole.c

Purpose : to find the inner sole by elevating SOLE.DAT and get difference

between the data file and a plane.

Date : 20-Feb-1990

Time : 11:47:55

#include <stdio.h>

#include <math.h>

#include <malloc.h>

struct cyxyz {

long x;

long y;

long z;

struct cyxyz *next;

struct cyxyz *prvs;

};

struct cyxyz *head, *tail, *maxl, *max2;;

int numlinks = O,

numlat = OF

float zl, z2;

main ()

{

readin();

zlz2();

planequ();

path();

*/

}

/* read in SOLE.DAT and save it into a linked list. */

/* find 2 maximum Z by dividing area of searching into 2 */

/* generate a plane equation with parameters provided by zlz_

/* write a REAL sole derived by the above processes into a f_

/* Function name : readin()

/* Purpose : Read SOLE.DAT in and make a linked list whose structure is defiw

as the above global part.

readin()

{

struct cyxyz *now;

long tmox, tmpy, tmpz, refy;

FILE *filein;

filein = fopen ("sole.dat", "r");

head = tail = now = (struct cyxyz *) malloc (sizeof (struct cyxyz));

head->prvs = (struct cyxyz *) NULL;

tail->next = (struct cyxyz *) NULL;

fscanf (filein, "%D %D %D", &(head->x), &(head->y_, &(head->z));

rely = head->y;

numlinks+÷; numlat++;

while (fscanf (filein, "%D %D %D", &tmpx, &tmpy, &tmpz) != EOF) {

now = (struct cyxyz *) malloc (sizeof (struct cyxyz));

if (now == NULL)

printf ("error in now allocation. Exiting to system.\n");

exit (1);
now->prvs = tail;

tail = now;

tail->next = (struct cyxyz *) NULL;

tail->x = tmpx; tail->y = tmpy; tail->z = tmpz;

if (refy !: tmpy) {

rely = tmpy;

numlat++;

}

numlinks++;

}

fclose (filein);

/* Funtion name : zlz2()

/* Purpose : Search for e maximum z in two areas; first half and second half

the bottom part of the foot.

These 2 values are global and used in planequ() function.

#define MIN (long)(-2147483&47)

zlz2()

{

int count = O,

halflat;

long zmaxl = MIN,

zmax2 : MIN,

rely;

struct cyxyz *now;

maxl = max2 = (struct cyxyz *) NULL;

now = head;

rely = now->y;

halflat = numlat / 2;

while (count < halflat) {

if (zmaxl < now->z) {

zmaxl = now->zG

maxI = now;

}

if (refy != now->y) {

rely = now->y;

count++;

}

now = now->next;

/* printf ("lowcount = %d\n", count); */

}

/* printf ("zmaxl %ld zmax2 %Id\n", zmaxl, zmax2); */

while ((count <= numlat) && (now != NULL)) {

if (zmax2 < now->z> {

/* printf ("zmax2 = %IdSn", zmax2); */

zmax2 = now->z;

max2 = now;

)

if (rely != now->y) {

rely = non->y;

count++;

}

now = now->next;

f_ printf ("hi count = %d zmaxl %ld zmax2 %Id\n", count, zmaxl, zmax2);

*/

}

/* printf ("zmaxl %ld zmax2 %Id\n", zmaxl, zmax2}; */

}

/* Function name : planequ() */

/* Purpose : Generate a plane equation whose slope is

slope = (z2 + 25400) - (zl + 12700)
Calculate zpJanevalue and then rind difference with a point on

the heel.

Replace the z of that point by this difference.

planequ()

{

int count;

double zplane, diff;

double slope;

struct cyxyz *now;

long yl, zl;

slope = ((double)((max2->z + 12700) - (maxl->z + 25400))) /

((double)((max2->y) - (maxl->y)));

wj

yl = maxl-->y;

zl = maxl->z;

printf("slope = Xf\n", slope);

now = head;

while (now != NULL) {

zplane = slope * ((double)(now->y) - (double)(yl))

+ ((double)(zl) + (double)(25400));

printf ("slope = %2.4f zl,yl %id %Id zpl = %ld now->y = %Id now->z =

slope,maxl->z,maxl->y,(Iong)zplane, now->y, now->z);

diff= zplane -- (double)(now->z);

printf ("diffz = %Id\n", (long)diff);

now->z = (long) diff_

now = now->ne×t;

path()

{

struct cyxyz *now;

FILE *fileout;

fileout = fopen ("path.dat", "w");

/* fprintf (fileout, "%d %d\n", numlinks, numlat); */

no_ = head;

do {

/* if ((now == maxl) :: (now == max2)) {

// fprintf (fileout, "%id %ld %Id max\n", now->x, non->y, now->z);

// } else { */

fprintf (fileout, "%ld %Id %Id\n", now->x, now->y, now->z);

/* } */

w_lle inow != NULL_ ;