After working in Dynamo for 8+ years i am jumping into pyrevit. Right off the bat I am having issues with something related to Document Manager. Essentially the near standard frontend of any Dynamo script where you define doc seems to be failing:
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
app=DocumentManager.Instance.CurrentUIApplication.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
av=doc.ActiveView
however, if I add in the pyrevit revit lines and adjust the definition of doc - it does work
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from pyrevit import revit
#doc = DocumentManager.Instance.CurrentDBDocument
doc=revit.doc
app=DocumentManager.Instance.CurrentUIApplication.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
av=doc.ActiveView
From what I have been able to read here on the forum - this should have worked as it was - so i guess I am just curious as to is there something else i maybe doing wrong or something messed up in my pyrevit settings?
I know the pyrevit.revit stuff is there for convenience - but frankly if you are comfortable using RevitAPI docs and have lots of experience in Dynamo Python scripting - it’s actually harder to understand than just using more normal written methods (because now i have to remember two different ways to do the same thing instead of always using the same thing). i really want to avoid using the pyrevit revit methods and stick to normal Revit API (but pyrevit forms i’ll use all day )