Pipe Tag Leader line vs Dynamo preview issue

Hey all!

I just started in Dynamo a little while ago so I apologize if I get some terms wrong.

I’m using REVIT 2019 and Dynamo core 2.0.3 and using only out of the box nodes and a few nodes from Rhythm.

Script is a bit long so I’ve attached it here for ease of viewing.
Working Tag Placement 7-10.dyn (188.8 KB)

I’ve been working on a script that will allow me to automatically place tags on piping and modify the leader line. I was able to get the script to place tags on the pipe and then offset the head position and the elbow position by using out of the box nodes and some of Rhythm’s nodes. The next day I tried my script out and the leader lines were nothing like what I had set up the night before. I even tried the script on the same test file I had used the night before, the leader lines were off.

After looking into this a bit I noticed that the Dynamo preview nodes (the blue squares) in the REVIT program were in the correct place and but the leader line didn’t locate itself at that point. Below is the correct looking leader lines from the night before and then the leader lines from this morning.

image
I’m not sure what has caused this issue and this is what I need help to figure out.

Here are a few things that I tried and the results, unfortunately I don’t know what they mean.

  1. I tried a simple change a value to the elbow coordinate, run script, reset coordinate to original location, and then run the script again. This resulted in the leader line looking like it should. However, as soon as I close the script the same issue happens. I’m not looking to have to do this every time in order to tag my pipes. Below is the section of my script that I had to alter the value of and revert back, node circled in red.

  2. The second thing I tried was to take the script segment above and remove everything else so that I can select specific elements rather than have the selection be based on the tags that were created. I also moved the coordinate for the elbow far away to see if that would help me figure out what might be going wrong. Running this script resulted in the leader lines getting close to the Dynamo preview in REVIT but running it a second time without changing anything resulted in the correct placement. Below is the script that I used for this test.


    After that I tried running the original script twice in a row and didn’t get the result desired.

Can anyone help me figure out why I’m getting this discrepancy between the Dynamo preview and what is being generated in REVIT?

Only guess at this point is order of operations. It could be that you’re trying to modify the leader in the same transaction that the tag is being created in and Revit doesn’t like that. Or it could be that Dynamo is trying to adjust the elbow before the tag is being placed. Either way I would look into splitting up the transaction or creating the tag with the elbow in the correct location (if that’s even possible.)

Thanks for looking at this Nick!

Is there any way to verify that the order of operation is the culprit? I thought that once a node got it’s inputs it would run, making the nodes that require the output to go next. I’m a beginner to this coding, so let me know if I have this wrong. Unless I have a looping node in there… I don’t think that there is a looping node in my code.

On my first test where I replaced a value and then reverted it back, the script worked until I closed out of the it. But while I had the script up and working, I could add pipe and still get a good result when running the script again. So it would seem to me, a novice, that the order of operation may not be the issue but something is confusing this script when it is first opened. However I haven’t been able to guess what that may be.

The second test did split up the transaction and it created the correct leader line, but that would mean that I have multiple scripts to have to run on projects. I was hoping that I could run it as one script.

You’re correct in that nodes are supposed to run once they have their inputs. But it doesn’t always end up working that way. This can be an issue if an element is being created and modified in the same transaction.

The good news is that using multiple transactions does not necessarily mean splitting up your graph. There are Start and Stop Transaction nodes that you can use to force Dynamo to run as separate transactions in Revit. You’ll only have to run your script once, but Revit will record it as multiple separate actions (you can see this in the Undo dropdown.)

I’ll have to play around with those and see what happens.

Looks like adding in those Start/Stop transactions fixed the issue.

Thanks Nick for the help!