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: 

Instance Family Transformation

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
navyabasavaraju01
1025 Views, 2 Replies

Instance Family Transformation

Can anyone guide me to transform the placed instance family.

Below is the code i am using to place the family at every model line ends.

            foreach (ModelLine mline in mLines)
                    {
                        LocationCurve lCurve = mline.Location as LocationCurve;
                        Line c = lCurve.Curve as Line;
                        XYZ pt1 = c.GetEndPoint(0);
                        XYZ pt2 = c.GetEndPoint(1);
                        FamilyInstance fi = _doc.Create.NewFamilyInstance(pt1, symbol, level, StructuralType.NonStructural);
                        Parameter para_1 = fi.LookupParameter("instance_x");
                        para_1.Set(pt1.X);
                        Parameter para_2 = fi.LookupParameter("instance_y");
                        para_1.Set(pt1.Y);
		   }
Tags (2)
2 REPLIES 2
Message 2 of 3

Create A transform :

Transform  modTransform = Transform.CreateRotationAtPoint(XYZ.BasisZ, rotAngle * (Math.PI / 180.0), new XYZ(0, 0,0));
foreach (ModelLine mline in mLines)
                    {
                        LocationCurve lCurve = mline.Location as LocationCurve;
                        Line c = lCurve.Curve as Line;
                        XYZ pt1 = c.GetEndPoint(0);
                        XYZ pt2 = c.GetEndPoint(1);
                        pt1 = modTransform.OfPoint(elementLocation);
                        pt2 = modTransform.OfPoint(elementLocation);
                        FamilyInstance fi = _doc.Create.NewFamilyInstance(pt1, symbol, level, StructuralType.NonStructural);
                        Parameter para_1 = fi.LookupParameter("instance_x");
                        para_1.Set(pt1.X);
                        Parameter para_2 = fi.LookupParameter("instance_y");
                        para_1.Set(pt1.Y);
		   }

apply transform to respective point:

  pt1 = modTransform.OfPoint(elementLocation);
Message 3 of 3

what is element location here.?

i tried with this

LocationPoint lc = (LocationPoint)fi.Location; 

but this returned 0.00,0.00 in pt1.X and pt1.Y ,any idea where i am doing wrong?

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

Post to forums  

Rail Community


Autodesk Design & Make Report