private void SetConstraints(Document familyDoc, Extrusion extrusion) { try { CurveArrArray curvesArr = new CurveArrArray(); curvesArr = extrusion.Sketch.Profile; foreach (CurveArray ca in curvesArr) { CurveArrayIterator itor = ca.ForwardIterator(); itor.Reset(); itor.MoveNext(); Line l = itor.Current as Line; _rightCon.Append(l.Reference); itor.MoveNext(); l = itor.Current as Line; _topCon.Append(l.Reference); itor.MoveNext(); l = itor.Current as Line; _leftCon.Append(l.Reference); l = itor.Current as Line; _botCon.Append(l.Reference); } ReferenceArrayArray conArray = new ReferenceArrayArray(); conArray.Append(_rightCon); conArray.Append(_topCon); conArray.Append(_leftCon); conArray.Append(_botCon); ConstructConstraint(familyDoc, _rightCon); ConstructConstraint(familyDoc, _topCon); ConstructConstraint(familyDoc, _leftCon); } catch (Exception ex) { TaskDialog.Show("Constraint Error", ex.Message); } }
private void SetConstraints(Document familyDoc, Extrusion extrusion) { CurveArrArray curvesArr = new CurveArrArray(); curvesArr = extrusion.Sketch.Profile; foreach (CurveArray ca in curvesArr) { CurveArrayIterator itor = ca.ForwardIterator(); itor.Reset(); itor.MoveNext(); Line l = itor.Current as Line; _rightCon.Append(l.Reference); itor.MoveNext(); l = itor.Current as Line; _topCon.Append(l.Reference); itor.MoveNext(); l = itor.Current as Line; _leftCon.Append(l.Reference); l = itor.Current as Line; _botCon.Append(l.Reference); } ReferenceArrayArray conArray = new ReferenceArrayArray(); conArray.Append(_rightCon); conArray.Append(_topCon); conArray.Append(_leftCon); conArray.Append(_botCon); //Line line = familyDoc.Application.Create.NewLine(_vert[0], _vert[1], true); ConstructConstraint(familyDoc, _rightCon); //line = familyDoc.Application.Create.NewLine(_vert[1], _vert[2], true); ConstructConstraint(familyDoc, _topCon); //line = familyDoc.Application.Create.NewLine(_vert[2], _vert[3], true); ConstructConstraint(familyDoc, _leftCon); //line = familyDoc.Application.Create.NewLine(_vert[3], _vert[0], true); //ConstructConstraint(familyDoc, _botCon, line); }