Over the last 30 years, there has been a big move away from conventionally framed roof structures towards engineered structures. Specifically engineered trusses and load-bearing engineered beams like micro laminated and even steel.
I have been in so many attics where the engineered roofing or other load-bearing structures have been cut to accommodate equipment, wires, ducts and pipes.
First, we need to say that in the US all building codes are local or regional, so the exact codes may vary, but best practices do not.
For non-load bearing studs, boring and notching is generally OK so long as you don’t actually cut the thing in half.
For load-bearing conventional vertical studs you want to bore in the center and keep the hole 40% or less of the total width. Notches should be kept to under 25%.
But for engineered structures, steel beams, microlaminated beams and engineered trusses…
You can’t cut them unless the engineer has done specific calculations to allow for it or unless a specification can be referenced that shows what is allowable.
In general, if something is holding up the roof, don’t cut, bore or notch it. If it is a conventionally framed structure there may be some small allowance but I wouldn’t risk it.
Think before you drill or cut