Project unit settings

revit

#1

Is there a way of querying a Revit project for the Project units format?

We work in both imperial and in metric and I’d like to make my function units agnostic so it caters for all, is robust and above all idiot proof.

I’d like to establish whether the figures I am feeding in to dynamo are in feet or millimeters so I could automatically toggle the relevant formulas or conversions.

 

Whilst I’m here I’d also like to ask what is the correct terminology for a Dynamo project.

Is it a graph? a function? a definition? Are all 3 correct or is one more valid?

Thanks…great product and support btw…very addictive :slight_smile:


Setting Project Units - From Millimetres to Metres Automatically
#2

Of course you can get query a current document of revit unit by python api

here is the sample

 


#3

Hi Johnes, I appreciate your reply :slight_smile: I’m a relative newbie to Dynamo and not all that familiar with python yet…just some codeblock basics. I tested your python script and indeed it can display metric or imperial units however if I altered the unit settings on the fly in Revit the Python script does not pick up the active state of the file. I can refresh by closing the dynamo graph and opening again. I’m wondering how it could pick up the current state of the active document? Further to this though I was looking to delve a bit deeper than identifying Metric or Imperial and find the unit format…whether that is in meters, millimeters, feet and inches etc. Looking at one of Jeremy Tammik’s posts on units http://thebuildingcoder.typepad.com/blog/2008/09/units.html I found that perhaps what I am looking to query is Parameter.DisplayUnitType ?? I’ve tried altering the code you provided to suit but haven’t been able to find the right syntax.

unit format


#4

 

Try this and here is the Table about the ProjectUnit from Jeremy Tammik blog

http://thebuildingcoder.typepad.com/files/projectunit.csv

http://thebuildingcoder.typepad.com/blog/2009/01/unit-types-and-format-options.html


#5

Franz,

To answer your question about having to shut down Dynamo in order for Python nodes to refresh, I can only suggest to instead hook up a boolean toggle input to it and toggle it to on/off. That will force Python node to refresh and re-run the code. Right now, as far as I am aware Python nodes cannot subscribe to Revit events hence making it difficult/not possible to create a node that will listen to changes in Revit document and automatically recompute when those happen. I talked to Dynamo dev team about that in hopes that it will be fixed but so far no luck. Also, if you don’t want to put a boolean toggle on it, you can just hit that little + sign to add an input and that will refresh the node. Then you can hit the little - sign to get it back to where it was.


#6

Konrad, thanks for your reply. I got snowed under in December so left this alone. Will pick it back up in the next week or so.


#7

Thanks for the links Johnes, very helpful.