Community
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); }
Solved! Go to Solution.
Solved by arvind.maurya37. Go to 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);
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.