Hello,
I was able to capture the path of a circuit in Revit. Now I want to convert this data to line and insert a family of Detail Line. But look what is written in Revit API 2018
"The list of the electrical system circuit path node position is not valid. The length of the list should be more than one, the first node should be the position of the panel where the circuit begins at, the adjacent nodes should not be too close , and should be on the same level or on the same vertical line, to keep each segment of the circuit path always horizontal or vertical Also note that the first node position should be the position of the connector (the one connects to the circuit) of the panel, but not the origin of the panel instance. "
Code - GET CIRCUIT PATH
Now the problem is, I canât use this data to convert in points and then line.
There is the SetCircuitPath api but I canât use it either. Does anyone have a tip in this regard?
Get rid of your try except and you will see an exception and might even be able to resolve this yourselfâŚnever use try except indiscriminately otherwise all you end up doing is sweeping your problems under the carpet âso-to-speakâ, and suppressing otherwise useful exception messages which hinders your ability to debug - its one of the worst habits Iâve seen emerging in the Dynamo community. My advice; never use try catch unless youâve exhausted every other option.
3 Likes
I am not sure I would say âneverâ. I would probably say, if you will use try
and except
then at least use some sort of logging to output the error:
try:
errorReport = None
except:
import traceback
errorReport = traceback.format_exc()
if None == errorReport:
OUT = 0
else:
OUT = errorReport
I did caveat that with ânever use try catch unless youâve exhausted every other optionâ so we are in agreement. And sure - just donât use try except as âfix-allâ, or for flow control in general, especially when other statements are more appropriate and donât carry the overhead nor suppress useful exceptions. It sets a bad precedent if developers donât learn why allowing exceptions to occur is so useful. My point is to use try except only when there is no other option, not as a default go-to 
1 Like