I'm trying to get NewSweep to work in a FamilyDocument, using the following code:
Sweep solid = famDoc.FamilyCreate.NewSweep( true, path, pathPlane, sweepProfile, 0, ProfilePlaneLocation.Start);
path is a curve object, obtained either from a ModelLine (Line) or a ModelCurve (Arc):
Here a Line:
+ sweepes.First().GetEndPoint(0) {(8.720219129, -1.734559431, -2.292233980)} Autodesk.Revit.DB.XYZ
+ sweepes.First().GetEndPoint(1) {(8.720219129, -1.734559431, 2.306425830)} Autodesk.Revit.DB.XYZ
sweepProfile was obtained by running
sweepProfile = famDoc.Application.Create.NewCurveLoopsProfile(curveArrArr);
curveArrArr = new CurveArrArray(); arr = new CurveArray(); curveArrArr.Append(arr); foreach (var item in profileLoop) arr.Append(item);
profileLoop contains the Profile built using a CurveLoop, obtained from the method below: getFamilyProfile
When I run NewSweep, I get the following error:
{"One of the conditions for the inputs was not satisfied. Consult the documentation for requirements for each argument."} System.Exception {Autodesk.Revit.Exceptions.ArgumentException}
Which condition is not met?
Regards, Dirk
CurveLoop getFamilyProfile(Autodesk.Revit.DB.Document famDoc, Plane LoopPlane, bool drawProfile) { var _profilepoints = new List<XYZ>() { FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-10,0)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-11.36,-7.7)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-14.15,-10.49)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-13,-16.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-11,-16.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-10.27,-13.78)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-9.41,-12.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-7.95,-12)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-6.49,-12.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-5.63,-13.78)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-4.91,-16.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-2.91,-16.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-2.18,-13.78)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-1.4,-12.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(0,-12)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(1.4,-12.5 )), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(2.18,-13.78)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(2.91,-16.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(4.91,-16.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(5.63,-13.78)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(6.49,-12.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(7.95,-12)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(9.41,-12.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(10.27,-13.78)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(11,-16.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(13,-16.5)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(14.15,-10.49)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(11.36,-7.7)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(10,0)), FAIR_Space.Extensions.MmToFootPlanePoint(LoopPlane,new UV(-10,0)) }; CurveLoop profileLoop = new CurveLoop(); for (int i = 0; i < (_profilepoints.Count - 1); i++) { Line line = Line.CreateBound(_profilepoints[i], _profilepoints[i + 1]); if (drawProfile) Creator.CreateModelLine(famDoc, _profilepoints[i], _profilepoints[i + 1]); profileLoop.Append(line); } return profileLoop; }
Solved! Go to Solution.
Solved by dirk.neethling. Go to Solution.
I solved the Problem. The plane needs to be the plane on which the path lies, turned such that the Profile has the desired orientation.
In the Project Document, using GeometryCreationUtilities.CreateSweptGeometry,one neds to transform the Profile explicitly, but in the FamylDocument it's taken care of by the API.
The Profile is drawn in the XY plane, and Revit automatically transforms it into the plane where the path lies.
The trick is to make sure that the path and the SketchPlane are on the same plane.