CurrentUIApplication.Application = not valid

Hey again,
Stumbled upon another supposedly simple issue, but that strangely enough just does not work. I would like to get the VersionNumber or VersionBuild of the current revit application from within a dynamo python node. My plan was to use app = DocumentManager.Instance.CurrentUIApplication.Application to ask for VersionNumber or VersionBuild, but when I assign ‘app’ i get the following:

image
I’ve seen this is more than one example, even from Autodesk (http://dynamoprimer.com/en/09_Custom-Nodes/9-5_Python-Revit.html). Whats wrong here?

Code below:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

OUT = DocumentManager.Instance.CurrentUIApplication.Application

Best

Jakob

Have a look at the Application.Version node in pkg Clockwork - it has the Python code you’ll need.

3 Likes

Hi @Andreas_Dieckmann,
Thanks, I found the node you recommended and indeed, it exhibits more or less the exact same code as posted above. Also, it exhibits the exact same error when the python node is run outside of the .dyf ( “The managed object is not valid”.
). When run from within the. dyf the node just produces 4 nulls in a list. Do the node work for you? Im running revit 2016 and Dynamo 1.3

What does this error message mean? Any thoughts on whats happenind here?

It’s a mystery to me how it can be so difficult to do these simple things and how little documentation, or even faulty documentation there is out there!

Hi @Andreas_Dieckmann
What are your software versions?

Not sure if I wrote this while in Revit 2017 or 2016. I did add some new 2018 API stuff but the script checks for the app version before calling that.

@Andreas_Dieckmann i meant to ask @jakob.lilliemarck :grin:. The node (and the code posted above) both work for me on 2017 and 2018.

As posted above I use 2016 and dynamo 1.3.

The node seems to work on my collegues 2017 version though, so upgrading as we speak. Still, I belive I’ve been following the 2016 API so not quite clear why it doesn’t work.

Hi @jakob.lilliemarck


2 Likes

After installing 2017 my current Dynamo version in 2016 changed from 1.3.1.0 to 0.9.1.0 and then both mine and your code works fine. I guess it seems like there’s an issue with Dynamo 1.3.1.0 with Revit 2016 altough it installs without errors?

Also Dynamo says it’s “up to date” in 2016 even though 0.9 clearly is not the latest version. Whats up with all this?!

image

@jakob.lilliemarck you need to reinstall 1.3.1 and make sure you check all this while you install
image

Already did altough I don’t have 2018 installed yet.
Just baffled by why these things happen and thinking that I’d report them so they may be fixed.

Just showed you incase if you have :slight_smile:

1 Like

Hey @Kulkul,

I know I’m replying to a very old post, but I’m seeing the same processes from many of my favorite package developers, so now I I have to ask: why does everyone import the entire library, and then import particular namespaces directly after that (e.g. - Import RevitServices, then from “blahblah” import “blahblahblah”). Sry if my syntax is incorrect, and my understanding limited; I have no formal coding background (but trying to learn)!