Starting with CAD, you design an object that you plan to print. You make sure you don't make it too big for the printer, and you orient it so it will have strength, will stick to the bed, etc. All the printer info is in your head unless you're using sketchup which allows you to define the printer build volume and displays its while you do the design work. If you're designing multiple pieces to print together, it's best to ensure they're all sitting at the same Z level before exporting the STL file.
Next you slice. The slicer needs to know the printer characteristics and print material characteristics such as build volume, speed, number of extruders, melt temperatures, bed temperature, etc, so that it will produce printable gcode.
Once you have the gcode, you're ready to print. If you're using host software and you want it to display the object size and position relative to your build volume it has to know what the build volume of the printer is- that info is not stored in the gcode file.
A single gcode file is typically not very portable. You can easily move to an identical or larger printer, as long as the extruder nozzle and material are the same as in the original file, but that's about it. If you change color or spool of the same color of filament, you typically have to reslice because the new spool probably has a different diameter than the original. You can improve that by using volumetric slicing. In volumetric slicing, you lie to the slicer about the filament diameter (set it to 1.128379mm) and then manually set the actual diameter at print time. That way you don't have to reslice to change colors or spools of filament. If you set the extruder and bed temperatures to 0 when you slice, and then set them to the correct values at print time, you can even use the same gcode with different materials (you may have to manually disable a print cooling fan if switching from PLA to ABS). The more generalized/portable you try to make the gcode, the more input you will have to provide at print time.
You should always measure filament diameter before printing with it. I measure about 20 -30 places spread over several meters of filament using a digital caliper and calculate the average value to the nearest 0.01 mm. I mark that average value on the spool. Weigh new spools of filament and calculate the mass of the empty spool and mark it on the spool, too. I have seen that some filament makers don't mark the material type on the spool (silly!). It's a good idea to mark the spools with that info, too. Before starting a print job, if it isn't obvious that there's enough filament on the spool, weigh the spool and subtract the empty spool weight to ensure there is enough filament to complete the print. Enter the filament diameter into the printer (assuming you used volumetric slicing) and start printing.