Rotate FamilySymbol on Face of Wall

Rotate FamilySymbol on Face of Wall

Anonymous
Not applicable
931 Views
2 Replies
Message 1 of 3

Rotate FamilySymbol on Face of Wall

Anonymous
Not applicable

Hi, when i place my FamilySymbol on wall face is placed upside down, i'm using : FamilyInstance instance = doc.Create.NewFamilyInstance(face, location, refDir, famsym.First()); to rotate my wrong placed FamilySymbol i'm using: LocationPoint lp = item.Location as LocationPoint; XYZ ppt = new XYZ(lp.Point.X, lp.Point.Y, lp.Point.Z); Line axis = Line.CreateBound(ppt, new XYZ(ppt.X, ppt.Y, ppt.Z + 10)); ElementTransformUtils.RotateElement(doc, item.Id, axis, (Math.PI / 180) * -180); in this case my FamilySymbol placed correctly, but shifts. if i'm using: LocationPoint lp = item.Location as LocationPoint; XYZ ppt = new XYZ(lp.Point.X, lp.Point.Y, lp.Point.Z); Line axis = Line.CreateBound(new XYZ(ppt.X, ppt.Y, ppt.Z - 10), new XYZ(ppt.X, ppt.Y, ppt.Z + 10)); ElementTransformUtils.RotateElement(doc, item.Id, axis, (Math.PI / 180) * -180); there is an error about the inability to rotate What i'm doing wrong? Please help

0 Likes
932 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Hi V

 

I found myself with the same problem.

As you i was just using ElementTransformUtils.RotateElement(doc, item.Id, axis, Math.PI) to rotate 180.

 

It seems to me ElementTransformUtils doesnt rotate if you havent set the Schedule Level parameter.
(Im inside the family editor here so your code would be a little different.)

 

Parameter parameter = instance.get_Parameter(BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM);
FilteredElementCollector cLevel = new FilteredElementCollector(familyDoc)
.OfClass(typeof(Level));

//always one here
if (parameter != null)
{
parameter.Set(cLevel.FirstElementId());
}

 

A bit strange  🙂

0 Likes
Message 3 of 3

FAIR59
Advisor
Advisor

You are trying to rotate with a vertical axis. If the instance is placed on a vertical wall face, the axis should be the normal of the face.

I think this can also work:

Line axis = Line.CreateBound(  ppt, ppt.Add(  instance.GetTransform().BasisZ));

 

0 Likes