We have previously looked at how to handle the project location properties and more specifically how to handle the effect of a rotated Project North on an element azimuth.
Here is a question on the 'opposite' topic, how to set up a project north rotation in the first place:
Question: Is there any way to rotate the truth north using the Revit API?
It can be done in the user interface using the Manage > Project Location > Position > Rotate True North command:
Here is the English command with its expanded tooltip:
Answer: I believe the same effect can be achieved by rotating the Project North which is available in the API.
If this fits the bill, then here are some working code snippets making use of the related classes and methods:
ProjectLocation plCurrent = _doc.ActiveProjectLocation; // . . . ProjectPosition newPosition = _app.Create.NewProjectPosition( scaleToFT * cs.OriginX, scaleToFT * cs.OriginY, scaleToFT * cs.OriginZ, theRotationYouWant ); plCurrent.set_ProjectPosition( ptOrigin, newPosition );
You may have to do this for all project locations. A bit of 3D maths and brainwork may be required, but it should be doable.
Many thanks to Katsuaki Takamizawa and Miroslav Schonauer for this discussion and suggestion!