What size black iron pipe should I use for a 45,000 BTU attached garage heater?
If the new heater would &quot;home run&quot; its supply pipe all the way to the meter then that pipe could be sized in isolation, but you've described a scenario in which the new heater would branch from existing piping. In this scenario the sizing of the entire system must be reconsidered. For a small appliance like your heater it's likely the existing piping can support the new load -- but for a heavier load, like another furnace or a new tankless water heater, it's likely that the existing piping ould not support the new load. In such a case one must upgrade some of the existing piping to a larger size, or else must run new pipe from the meter to supply the new appliance.
If you did run new pipe all the way back to the meter, the system of new pipe and its appliance(s) could be sized independently of the other system (the one that serves all the existing appliances in the house).
There are two common methods for sizing gas piping: &quot;longest length&quot; and &quot;branch length.&quot; Both methods are concerned only with the appliance BTU input ratings and the pipe length; counts of elbows and elevation change aren't considered. The following is based on the longest length method as described in the document &quot;Good Practices for Gas Piping and Appliance Installations&quot; by Questar Gas (acquired by Dominion Energy some years ago). Unfortunately this document is no longer available from the original source, but copies might be found on various document archive web sites.
Longest Length method

Determine the type of pipe and the pressure of the gas. Pipe capacity depends on both of these figures. This exercise assumes schedule 40 black iron or steel pipe with 4 ounce gas pressure.
Calculate the gas demand in cubic feet per hour for each appliance. For natural gas the ratio is usually in the range of 890-1000 BTU/hr per cubic foot of gas. For example, an appliance with input of 136,000 BTU/hr would consume 136000/1000=136 to 136000/890=152.8 CFH of gas. Consult the gas supplier for an appropriate figure for their gas, err on the side of caution by assuming a low value like 890, or whatever suits you...
Draw a graph of the gas piping system. Include the length of each segment of pipe and the CFH demand of each appliance.
Calculate footage of pipe-path from one appliance back to the meter. Repeat for all other appliances. Review the list of pipe-path lengths and select the largest one. This is the &quot;longest length.&quot; Round up to the nearest length shown in the pipe sizing table. Use this row of the table for all sizing in this system.
Beginning with the most distant appliance, working across the selected row in the sizing table, find the first column where the CFH capacity equals or exceeds the demand for this appliance. Use the pipe size corresponding to this column to build the line from this appliance to the nearest tee or branching point.
After the pipes downstream of a tee have been sized the pipe supplying the tee can be sized similarly. Determine the total CFH demand of things downstream of the tee, find the first column in the sizing table where CFH capacity equals or exceeds that demand, and use the indicated pipe size to connect from this tee to the next tee upstream.
Repeat steps 5 and 6 as needed until all pipes in the system have been sized.

An Example
Consider this example given in the Questar Gas document (images are copied from that document with annotations added by me).

Appliance A at 60 feet is the most distant. Use the 60 foot row in the capacity table.

The section of pipe from appliance A to Section 1 serves a demand of 34 CFH. Consulting the highlighted &quot;longest length&quot; row in the table below, we find that the 1/2&quot; pipe's capacity of 65 CFH is sufficient for this portion.
The section of pipe from appliance B to Section 1 carries 29 CFH. Again, 1/2&quot; pipe suffices.
With all loads served by Section 1 handled we can now size the pipe of Section 1. Its combined load is 63 (34+29), which is just within the capacity of 1/2&quot; pipe.
We now turn to appliance C. The segment of pipe from C to the joint with Section 1 and Section 2 serves only appliance C with demand of 85 CFH. Consulting the highlighted row in the table we find that 3/4&quot; is the smallest pipe having capacity equal to or greater than this demand.
Section 2 may now be sized. It carries the load of Section 1 (63 CFH) plus the load of appliance C (85 CFH) for a total load of 148 CFH. This is just a little too much for 3/4&quot; pipe, so we'll have to use 1&quot; pipe here.
The pipe from appliance D to the tee with Section 2 and Section 3 carries 153 CFH and must also be 1&quot;.
Section 3, the last piece of the trunk connecting to the meter, carries the entire load of the system: 301 CFH. The table shows that 1-1/4&quot; pipe is the smallest size capable of meeting meeting this demand.