generally has to do with the 'space' around something: time-wise as well.
About to (...)
implies that you were just about to/in the middle of/just finished with 〇〇. lit. (it is the time around which I (...)) It is different from ばかり, in that it more generally talks about the time or space of doing an action, and not just afterwards.
今から家に帰るところです I am about to go home
ちょうど電話をするところだった I was just about to call you
食べているところだった It was around the time when I was eating food.
Sometimes abbreviated
撮影しているとこ I'm in the middle of filming.
Emphasis on how close you are cutting it can be done with {危|あや}うく
危うく遅刻するところだった。 I got VERY CLOSE to being late (I was just in time)
危うく期限が切れてしまう>ところだった。 I was about to narrowly miss the deadline.
発見が遅れたら、危うく死ぬところだった。 If they had found it later, I would have been on the verge of dying.
Youtube: Japanese Ammo with Misa - snippet of review covering ところです
bunpro ところだった 1
bunpro ところだった 2
ところが
denotes that s1 was expected, but then s2 happened.
Therefore it highlights unexpected things, and can therefore only be used involitional.
新しい洗濯機を買った。ところが、洗濯機が大きすぎていえに入らなかった。 I bought a new washing machine. However, it was unexpectedly so big, it didn't fit in my house.
今日は早く起きないといけなかったから、9時に寝た。ところが、目覚ましいが鳴らなかったから、寝坊した。 Today, I had to wake up early, so I went to bed at 9pm. However, my alarm didn't go off, so I overslept.
友達が勉強の手伝いを頼んだら嫌がると思っていた。ところが、喜んで手伝ってくれた。 I thought that if I offered my friend help with studying, he would get annoyed. However, he (against expectations) happily accepted the help.
ところで
Added with で,
is a sentence opener which means 'anyway-, ...'
it preludes a new topic that you thought of while talking about this thing.
This makes it different from ちなみに, which is used for "Now that you mention that, (...)", taking the current topic in a slightly different direction.
ところで、昨日の話しはどうなった? Anyway, what came of the thing you told me about yesterday?
ところで、彼は元気にしていますか? That makes me think- Is he doing well?