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: 

Rotate project North

2 REPLIES 2
Reply
Message 1 of 3
l.virone
550 Views, 2 Replies

Rotate project North

Hello,

 

I want to rotate the project using the API like we can do using this button in Revit : Manage>Project location>Rotate project North. The result is a rotation of all 3D elements in the project.

 

I've found solutions about rotating the TrueNorth here but it's not the same method.

 

I've also tested the code bellow but it is similar to "specify coordinate at point" and do not modify the ProjectNorth, instead it change the coordinate of the Survey BasePoint and rotate it around the Project BasePoint :

//BasePoint pp = BuiltInCategory.OST_ProjectBasePoint, typeof(BasePoint);

//Rotate Project North
ProjectLocation plCurrent = doc.ActiveProjectLocation;

ProjectPosition newPosition = app.Create.NewProjectPosition(
                    pp.get_Parameter(BuiltInParameter.BASEPOINT_EASTWEST_PARAM).AsDouble(), //Keep this parameter value
                    pp.get_Parameter(BuiltInParameter.BASEPOINT_NORTHSOUTH_PARAM).AsDouble(), //Keep this parameter value
                    pp.get_Parameter(BuiltInParameter.BASEPOINT_ELEVATION_PARAM).AsDouble(), //Keep this parameter value
                    Math.PI/4); //angle

plCurrent.SetProjectPosition(pp.SharedPosition, newPosition);

 

Does anyone have a suggestion ? Where can I change the ProjectNorth angle using the API ?

 

Tks,

Virone Lorenzo

2 REPLIES 2
Message 2 of 3
RPTHOMAS108
in reply to: l.virone

Rotating project north is a drastic thing to do in a well developed model. Even the UI command leaves certain things wrong i.e. I have noticed in the past that while it rotates an overall layout of foundations it may keep the individual foundations orientated in the same direction. There is always a certain amount of manual clean-up required afterwards. If you want to do this via the API then you can post the UI command perhaps. 

 

I would not recommend attempting this task directly with the API especially when not even the UI command gets it all right all the time. It is not an easy prospect since the UI command is also trying to deal with section views/elevations/links and scope boxes etc. I think even filtering for all the objects you need to rotate is not straightforward. Essentially you have to collect everything and rotate it.

 

What would be the motivation for this if you are automating a task it's because you regularly do it? However rotating project north is probably something you should do the fewest times possible and only at the very early project stages. Project north has also become a bit of an irrelevance, some would instead use scope boxes to orientate plans on the sheet (although I still prefer changing project north).

 

 

Message 3 of 3
l.virone
in reply to: RPTHOMAS108

Hi @RPTHOMAS108 ,

 

We need to create houses in a huge site and each house is created in an individual Revit file. We want for the orientation in each houses to be the same as the site because when we export as IFC the models do not appear in the correct positions. I've already created a code to move the SurveyPoint and change it's values, and to ajust the "angle to north" value in the ProjectPoint. But when we export in IFC, the models have a wrong rotation because their north are not the same.

 

So I want to find a way to set the North with the same rotation as it is in the site (which is linked in each house file) so when we export in IFC it'll be okay.

 

Tks,

Virone Lorenzo

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

Post to forums  

Rail Community


Autodesk Design & Make Report