Star Trek series past the original have famously featured "replicators," machines that through technology linked to transporters could create any substance out of pure energy. In my Troubles with Transporters bit on this blog I complained that if transporter technology really were able to work, it would have logical implications that are ignored in Star Trek, like being able to copy people at will. Not to mention there being serious issues with the realism of any transporter technology in the first place due to the Heisenburg Uncertainty Principle--it is impossible under the current understanding of physics to know where all the particles of your body or an object to be assembled really are, which would make it impossible to reassemble them with total accuracy...
But another approach to "replicators" is soon to enter service. A 3d printer is to fly in space on the International Space Station, as referenced in the linked article (by the way, I was steered to the article by Terri Main's publication Science News for Sci-Fi Writers). For those not familiar with 3d printer technology, what it essentially does is create a 3d object by laying down single layers of a film (typically a plastic), and building layer upon layer until an entire object is created.
Currently, rubber gaskets and seals or even a plastic toy or drinking cup are things well within the reach of a 3d printer. The main limits of this technology come from the materials used, though end-product complexity is also an issue. For an example of material limitations, you can't get a stainless steel wrench out of a 3d printer, because current technology isn't able to lay down layers of stainless steel (doing so would require an ambient heat that's quite high). But it's not inconceivable that advancements in 3d printer technology in the future could allow metal instruments to be fabricated. Though laying down layers of carbon fabric cemented with epoxy would work as well as metal for most items.
The ability to expand the types of materials laid down by an advanced 3d printer--I'll such a device here a "mechanical replicator"--would open up the possibility of creating virtually any inanimate object. Especially if combined with clever robotics technology using manipulator arms. Which would allow the separate creation of, with automatic assembly of, various complex interior parts. This could make mechanical replicators a replacement for virtually every other kind of manufacturing.
Note though that the main thing that Star Trek uses replicators for is about the last thing you'd want to use a mechanical replicator for--producing food and drink. Well actually, it's easy enough to imagine an automated system like I'm taking about being a whiz at baking and frosting pastries. And it might even do well in creating beverages by adding water, flavoring, CO2 if needed, and mixing it just so. And some other forms of basic cooking, especially cooking soup or something based on stored food items. But trying to make vegetables or something like roast beef from scratch, that would not work well.
Or would it? It is possible that a mechanical system could get so advanced that it would string individual protein molecules one at a time (or lipids or starches) to create food that would taste pretty good. Though it would seem much simpler to me to simply grow food, even on a spaceship, or carry it in stores. So I imagine a machine that advanced would always be expensive, no matter how far in the future you go. And also take more time to operate that Star Trek imagines, so a roast beef would take at least an hour or two to assemble. But for the very rich, owning a food replicator to obtain the flavors of items not available on the local market might become the height of status and prestige.
How does this concept impact science fiction storytelling? Since the idea I'm discussing is based in real science and steps are already being taken to use a precursor to what I'm mentioning in outer space, it's completely realistic for stories set in a technologically advanced future to have replicators of this type. Space explorers would be some of the first to use devices like these, because it isn't economical to carry along in storage every type of tool you could conceivably need. These machines will be larger, heavier, and slower than the whiz gizmos of Star Trek fame, and would require specific material inputs to work correctly. Raw energy will not be enough, you'd at least need stores of atoms of the elements used in the final product--though these could be in cartridges like the printer ink we're familiar with--creating situations where the sodium or boron or carbon cartridge is low and needs to be replaced or refilled.
Just as the ability to create an image on a screen and print it has transformed the world of publishing and art, so would reliable mechanical replicators transform the world of building ordinary objects. Anyone could make anything--limited to the size of the output tray of your replicator-like device...