[MEP SCRIPT] Conduit offset help with zaxy's references

Hello everyone, how are you doing?
Well, I managed to create a way to perform the “Conduit offset” for a reference line (model line or detail line), but I’m having issues when using other linear elements as a reference, such as a “conduit run” in 3D space. The script fails to offset elements that vary in the Z-axis, either going up/down or if the element is inclined.

I was tring to get element geometry from this node, but I know i could get it some other way.
image|395x500

I search for solutions here in the forum but I couldn’t find a way to ajust or adapt to my context, may anyone help me?
The reference files are provided below, feel free to explore.

Thnx Paulo.
PG - Criação de cabos em plano teste.dyn (75.3 KB)
Projeto1.rvt (920 KB)

Here is a example of the script result for the working situation:
image
(I select the model line, then select the conduit near as single reference) then run the script.