Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reset Default Project Units?

5 REPLIES 5
Reply
Message 1 of 6
mfleming.stantec
1089 Views, 5 Replies

Reset Default Project Units?

Hi

 

We are working on updating some of our Revit famiiies.  Some of them have been accidentaly tweaked in regards to the units setting from metric to imperial for both common and strucutral units.

ie. Length = mm, Volumn = Cubic Feet.

 

Is there an API avaialbe that can reset the current family back to default metric or default imperial units for all of Common, Structural, Electrical ect?

 

If not, how would I start building this?  Code example?

 

Thanks,

 

Matt

5 REPLIES 5
Message 2 of 6

Hi Matt,

 

basically, the units within the Revit database are always the same and cannot be changed:

 

http://thebuildingcoder.typepad.com/blog/units

 

What you see in the user interface is a different matter.

 

If your families have been tweaked to modify certain dimensions from a 'nice' number of feet to a 'nice' number of inches or vice versa, then all you can do is tweak them right back again.

 

Of course almost anything can be automated.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 6

I'm looking to change the units that are displayed within the family.

How do I go about doing that?

 

 

Message 4 of 6

Look at the ProjectUnit SDK sample.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 6

I have my add-in to Reset project units almost complete.  I'm able to reset both metric and imperial values of almost all of them.  I'm having difficulties with a few UnitTypes that I have tried for a day and half to get working with no success.

 

I have looked into the ProjectUnit SDK and that has helped for all other UnitTypes, but the following are not working in Revit 2014:


  •  

  • UT_Number
  • UT_SheetLength
  • UT_SiteAngle
  • UT_LinearForceScale

 

 

These particular ProjectUnit Names I'm not 100% sure on the UnitType names but I have tried UT_LinearForceScale, UT_MomentScale, 

UT_LinearMomentScale with no success:

 

  • Point Spring Coefficient (kip/in)
  • Line Spring Coefficient (kip/ft2)
  • Area Spring Coefficient (kip/ft3)
  • Rotational Point Spring Coeficient (kip-ft/degree)
  • Rotational Line Spring Coeficinet (kip-ft/degree/ft)

 

Snippet of code.

FormatOptions foMetNumber = unitsMetric.GetFormatOptions(UnitType.UT_Number);
            foMetNumber.DisplayUnits = DisplayUnitType.DUT_GENERAL;
            foMetNumber.Accuracy = 0.000001;
            foMetNumber.UnitSymbol = UnitSymbolType.UST_NONE;
            foMetNumber.SuppressTrailingZeros = false;
            //foMetNumber.SuppressLeadingZeros = 	n/a	;
            //foMetNumber.UsePlusPrefix = 	n/a	;
            foMetNumber.UseGrouping = false;
            //foMetNumber.SuppressSpaces = 	n/a	;

 

Maybe some of these cannot be set/changed like UT_SiteAngle... I'm not sure but I'm out of ideas.

 

Matt

Message 6 of 6

Anyone have a working version of "ProjectUnit" from the SDK for Revit 2014?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community