I am trying to add points to a Topo in Revit via Python and Dynamo. I have managed to successfully create a topo using Python (getting points from locations of families) but i cannot seem to get a similar code to work to add points. It seems that the issue is somewhat related to needing to use TopographyEditScope and being unable to Commit that, but i really can’t tell.
Here’s the code for creating a topo if anyone comes across this thread in a search (the rest is the same as above…)
It seems like it should work as you have a ilist and they are xyz coordinates, what error does it give you?
You tried swapping the topoint to the xyz() command?
See line 55 - I am using (trying to use) AddPoints.
The issue is that to use AddPoints you first must enter into the TopographyEditScope mode (which seems to require some gymnastics to work around transaction modes if doing it via Dynamo). That’s what I’m looking for help with.
Just noticed you are forcing the closure of the transaction when it should be a commit function
It has something to do with that, but per the “0.6.3 to 0.7 migration” post on GitHub, there is no “Commit” for transactions in Dynamo. The usual “Transaction TaskDone” line resulted in an error (something about the model being in a read-only mode, and it referred back to the TopographyEditScope.Start line). Not by my computer right now so I cannot post a pic of what happens when I do that…
Replaced Line 57 with:
Below is an image of the resulting error :
Hi Ben, Would you mind posting your code on stackoverflow: I’ll have a look a bit later
I did give it a try. Unfortunately, it seems that Dynamo is incapable of initiating a proper “TopographyEditScope”. The python interpreter says that the TES is active, but any attempt to modify the input topo, results in an error. For reference, similar code executed in RevitPythonShell, runs without a hitch:
I suggest you file an issue report on this.
Alternatively, have you considered the following:
1)extract the points from the existing topo
2)delete the old topo
add the new points to the list of ex. points
create a new topo with all the points
Thanks Dimitar for not only verifying that it won’t work, but explaining why.
I will file a report on the problem.
I was trying to avoid the delete/recreate workaround because in principle I think that is the wrong thing to do (tags, dimensions, graphic overrides, etc all are toast after a delete/recreate). So close…and yet so far away.
Any updates for this issue? I’m attempting to add points; however, I’m getting this exception
In the meantime I’ll just go with the alternative of creating a new topo with the existing points.
A buggy solution for a buggy situation.
Simply ‘forget’ to Commit(failproc) the TopographyEditScope.
(just like Dynamo forgets to really Commit although you have politely asked for it)
Also ‘forget’ to end the TransactionManager.Instance.
Only add an OUT = WhateverList
With a bit of luck you will see that Revit is in Topography edit mode
and the changes are made. (I had result in R18)
Now you can only confirm all the changes.
(after confirmation you can still roll back in Revit itself)
This doesn’t work in DynamoPlayer.
Does this work?
Hello @Ben_Osborne and everyone.
What’s happening is that dynamo is still running while allowing Revit to take control in the edit scope mode, that’s causing Dynamo to through a several different warnings (including saying there’s already an active scope mode…etc)
So the solution would be to trick dynamo by using Transaction End in the python code or before it runs.
Simply add the following to the code :
clr.AddReference('RevitNodes') import Revit Revit.Transaction.Transaction.End(doc) TES.Start(surfelem.Id)
Here’s a video of a tool I created to help with topography grading by edges with Dynamo Player :
Available in Synthesize toolkit package it might save you some time.
whered your video go
wow man amazing package
Am really glad you liked it vanman, so many to discover in it