Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Instance Family Transformation

navyabasavaraju01
Contributor

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
Reply
Accepted solutions (1)
1,100 Views
2 Replies
Replies (2)

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

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