William P. Hammerly, 59, a retired mechanical and design engineer, died of cancer Tuesday at the Manor Care nursing home in Hyattsville.

He worked for the Department of Energy's Fossil Energy Group for a time before retiring for reasons of health.

Before that, Mr. Hammerly had worked in Washington since 1945 as an engineering consultant to a number of corporations, including General Electric, and the Martin Marietta Corp. He also had worked for a time for Atlantic Research.

He was a past-patron of Marlboro Chapter No. 61 of the Order of the Eastern Star. He was a Mason, and belonged to the American Legion post in Greenbelt and the Moose Lodge in College Park.

Mr. Hammerly was a member of the Holy Cross Lutheran Church in Greenbelt.

He had been president of the Silver Roller Club, a group of roller skaters formed in Silver Spring in the late 1930s.

Mr. Hammerly was born in Salisbury, Md., and reared near Seat Pleasant. He attended Northwestern University.

He served with the Army in the Pacific during World War II.

He is survived by his wife, the former Jeanne Marie Hawkins, of the home in New Carrollton, Md.; two sons, Navy Lt. William B., of Jacksonville, Fla., and Jeffery L., of Fort Lauderdale, Fla.; his mother, Evelyn W. Hammerly, and a brother, Edwin C., both of Stevensville, Md.; and two other brothers, Malcolm B. and Kenneth E., both of Lothian, Md.

The family suggests that expressions of sympathy be in the form of contributions to the Oncology Department of Children's Hospital.