- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Please help me! oput of this mistake??
using (Transaction pf = new Transaction(doc))
{
pf.Start("Place Instance");
foreach (PolyLine pLine in pLines)
{
XYZ firstP = pLine.GetOutline().MaximumPoint;
XYZ lastP = pLine.GetOutline().MinimumPoint;
XYZ midP = new XYZ((firstP.X+ lastP.X)/2 , (firstP.Y+ lastP.Y)/2, (firstP.Z + lastP.Z)/2);
IList<XYZ> PLineXYZ = pLine.GetCoordinates();
double l1 = Math.Round(UnitUtils.ConvertFromInternalUnits(PLineXYZ[0].DistanceTo(PLineXYZ[1]), UnitTypeId.Millimeters),0);
double l2 = Math.Round(UnitUtils.ConvertFromInternalUnits(PLineXYZ[1].DistanceTo(PLineXYZ[2]), UnitTypeId.Millimeters), 0);
double Length = l1 > l2 ? l1 : l2;
double Width = l1 < l2 ? l1 : l2;
string symName = Length.ToString() + "x" + Width.ToString() + "x500mm";
FamilySymbol sym = (syms.Where(s => s.Name == symName).FirstOrDefault()) ?? syms[0].Duplicate(symName) as FamilySymbol;
if (!sym.IsActive) sym.Activate();
FamilyInstance instance = doc.Create.NewFamilyInstance(midP, sym, level, StructuralType.Footing);
}
pf.Commit();
}
return Result.Succeeded;
Solved! Go to Solution.
