a new blog post about a tool I created for the structural software RAM Elements integrating with pyRevit:
Let me know what you all think!
a new blog post about a tool I created for the structural software RAM Elements integrating with pyRevit:
Let me know what you all think!
Hi @atki224, nice work!
I have a few coding style suggestions:
sys.exit() to exit early; if the code is organized in function, a return would do the sameNudosRestric2 == 1 check directly inside the first query to save some memory and computation timeint(float(row.get("NudosX") or "0"))) and so on;GetElementIdIterator, use ToElements to directly get the elementspyrevit.revit.db.query module (there are too many I can’t remember  )
 ) generally you can wrap your code into a single transaction, so that if something goes wrong, nothing gets written to the database. If you use subtransaction, and an error occurs, your db could be in a “halfway state”. There are times when this is wanted, and sub-transaction are ok, though.
 generally you can wrap your code into a single transaction, so that if something goes wrong, nothing gets written to the database. If you use subtransaction, and an error occurs, your db could be in a “halfway state”. There are times when this is wanted, and sub-transaction are ok, though.elif tg.status == DB.TransactionStatus.Committed can just be an else since you already checked the opposite; and you can even remove the else if you exit the script in the if branchif result == "Yes", you can invert it and exit early; or you can keep that check and move everything below into a function (or more than one since that paet is huge)thank you for the feedback! definitely not a programmer by trade so wouldn’t otherwise know about many of your suggestions.
in particular your #7 suggestion regarding nested transactions, that sounds like a potential problem and will definitely work to get resolved. as to why I did it in the first place, I have no idea (lol).