Revit API

Reply
Active Contributor
mfleming.stantec
Posts: 32
Registered: ‎10-06-2009
Message 1 of 6 (444 Views)

Reset Default Project Units?

444 Views, 5 Replies
09-21-2012 09:30 PM

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

ADN Support Specialist
jeremytammik
Posts: 407
Registered: ‎08-20-2007
Message 2 of 6 (422 Views)

Re: Reset Default Project Units?

09-25-2012 02:20 AM in reply to: mfleming.stantec

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

Active Contributor
mfleming.stantec
Posts: 32
Registered: ‎10-06-2009
Message 3 of 6 (388 Views)

Re: Reset Default Project Units?

10-13-2012 12:26 AM in reply to: jeremytammik

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

How do I go about doing that?

 

 

ADN Support Specialist
jeremytammik
Posts: 407
Registered: ‎08-20-2007
Message 4 of 6 (349 Views)

Re: Reset Default Project Units?

10-31-2012 04:15 AM in reply to: mfleming.stantec

Look at the ProjectUnit SDK sample.



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

Member
mfleming.stantec
Posts: 3
Registered: ‎05-10-2013
Message 5 of 6 (165 Views)

Re: Reset Default Project Units? Alive Again

03-02-2014 02:23 PM in reply to: jeremytammik

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

Member
mfleming.stantec
Posts: 3
Registered: ‎05-10-2013
Message 6 of 6 (141 Views)

Re: Reset Default Project Units? Alive Again

03-07-2014 09:09 PM in reply to: mfleming.stantec
Anyone have a working version of "ProjectUnit" from the SDK for Revit 2014?

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit

Twitter

Facebook

Blogs

Youtube