Rotate family instance

Rotate family instance

devX6MRR
Contributor Contributor
3,907 Views
5 Replies
Message 1 of 6

Rotate family instance

devX6MRR
Contributor
Contributor

Hi, 

I'd like to know if there is a way to rotate a just-inserted family instance as shown in the video below.

 

The video is from AutoCad

0 Likes
3,908 Views
5 Replies
Replies (5)
Message 2 of 6

MarryTookMyCoffe
Collaborator
Collaborator

are you sure that this is a right kind of forum for this post? It is forum for application programming interface.

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
0 Likes
Message 3 of 6

devX6MRR
Contributor
Contributor

I'm sure it's the right place Smiley Wink

 

I'm inserting family with the "PromptForFamilyInstancePlacement" and i'dlike to launch the command to rotate the programmatically.

 

In the video i attached rotation follows immediately the insertion because the program provide to it.

I hope being more clear now.

0 Likes
Message 4 of 6

IbrahimNaeem
Advocate
Advocate
public void RotateColumn(Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.Element element)
{
    XYZ point1 = new XYZ(10, 20, 0);
    XYZ point2 = new XYZ(10, 20, 30);
    // The axis should be a bound line.
    Line axis = Line.CreateBound(point1, point2);
    ElementTransformUtils.RotateElement(document, element.Id, axis, Math.PI / 3.0);
}

from the RevitAPI.CHM

 

Thanks, Ibrahim Naeem 

 

 

Message 5 of 6

Anonymous
Not applicable

Here Goes:

 

LocationPoint lp = familiyinstance.Location as LocationPoint;
 XYZ ppt = new XYZ(lp.Point.X, lp.Point.Y, 0);
Line axis = Line.CreateBound(ppt, new XYZ(ppt.X, ppt.Y, ppt.Z + 10));

using (Transaction t = new Transaction(Command.doc, "Rotate"))
{

t.Start();
 ElementTransformUtils.RotateElement(Command.doc,familiyinstance.Id, axis, (Math.PI / 180) * (angle);
 t.Commit();

}

 

Thanks & Regards

Sanjay Pandey

Message 6 of 6

devX6MRR
Contributor
Contributor

I'm sorry but i had a problem with another project and I could check solutions only this morning.

 

The solution best fit my problem is the @Anonymous's one.

 

I'd like to ask another thing: how can i get the variable angle the i saw in the snippet?

 

Thank you again 

Giorgio

0 Likes