Those 3-D printers use a type of fast prototyping called stereolithography, building parts in a chamber with plastic layer by layer, that's in its fifth generation or so by now.
For metal parts it's selective laser sintering
, which basically involves sweeping metal dust across the floor of a chamber then fusing it little by little with a laser beam then sweeping another thin layer of dust across, repeating the process until you've got your desired metal object formed and sitting in chamber full of metal dust.
Both require gravity. This new system NASA is testing out apparently doesn't, making it appropriate for the ISS, interplanetary craft, moon bases, etc.
Even moon dust could theoretically be formed into masonary by doing selective laser sintering outdoors on the moon but would require a lot of solar energy and time. It could be automated and create buildings while clearing the area of pesky moon dust, which sticks to everything and would be nice to have cleared away from a moon base, anyway.
By the way, there are commercial shops now that will have their machines build a detailed starship model if you bring them a mesh file compatible with Lightwave, etc. and are willing to pay the price to have it rendered in plastic.