Three-dimensional printing has been used to create all sorts of things, from car parts and experimental rocket engines to entire houses. Now scientists at MIT have found a way to 3D print objects that can change shape almost instantaneously in response to magnetic fields.

So far the researchers have created a few demonstration objects with the new technology, which uses plastic “3D ink” infused with tiny iron particles and an electromagnet-equipped printing nozzle. These include a plastic sheet that folds and unfolds, a star-shaped object that can catch a ball and a six-pointed structure that scrunches up and crawls like a spider.

But the researchers see broad applications for small shape-changing devices — what some call "soft robots" — especially in medicine.

“You can imagine this technology being used in minimally invasive surgeries,” said Xuanhe Zhao, a professor of engineering at MIT and a member of the team that developed the 3D-printed shape-shifting technology. “A self-steering catheter inside a blood vessel, for example — now you can use external magnetic fields to accurately steer the catheter.”

Other uses could include magnetically controlled implants to control the flow of blood, and devices that could be guided by magnet through the body — to take pictures, clear a blockage or deliver drugs to a specific location, Zhao said.

The technology might one day make it possible to 3D print entire soft robots, Zhao said. These could have information stored as magnetic data directly inside their structural materials, instead of needing additional electronics.

“The MIT soft robotics development is very cool ... It's an important step in terms of being able to control materials,” said Jim McGuffin-Cawley, an engineering and materials science professor at Case Western Reserve University in Cleveland, who was not involved with the MIT project. He noted that the technology allows researchers to make precise changes to the shape-shifting materials by using magnetic fields to control very small moving parts inside the materials themselves.

MIT is releasing free software and a recipe for its magnetic ink so that other scientists around the world can use the technology and print their own shape-shifting materials, Zhao said.

“With these three components they can design their own untethered, fast-transforming soft robots,” he said. “We hope this method can find very important applications in the fields of soft robotics [and] materials.”

Want more stories about 3D printing?

FOLLOW NBC NEWS MACH ON TWITTER, FACEBOOK, AND INSTAGRAM.