Instance Family Transformation

Instance Family Transformation

navyabasavaraju01
Contributor Contributor
1,186 Views
2 Replies
Message 1 of 3

Instance Family Transformation

navyabasavaraju01
Contributor
Contributor

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);
		   }
0 Likes
Accepted solutions (1)
1,187 Views
2 Replies
Replies (2)
Message 2 of 3

arvind.maurya37
Contributor
Contributor
Accepted solution

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);
0 Likes
Message 3 of 3

navyabasavaraju01
Contributor
Contributor

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?

0 Likes