Someone very friendlily pointed out that the Family API labs available from The Building Coder are only provided for the Revit 2010 API and asked for a revised version based on Revit 2011. Due to the extent of the changes between the two API's, the previous samples do not run with Revit 2011.
Thank you for pointing that out!
Here is the current version of the Family API Labs for Revit 2011.
hi,jeremy,i encountered a question when creating an extrusion roof- the exception "invalid profile" occurred. Then i tested the SDK examples of revit 2011, the same error occurred. Do you know why?
here is the code:
var rvtApp = commandData.Application.Application;
var rvtDoc = commandData.Application.ActiveUIDocument.Document;
var appCreation = rvtApp.Create;
XYZ startPtBtm = new XYZ(0, 0, height-thickness);
XYZ startPtTop = new XYZ(0, 0, height);
XYZ endPtBtm = new XYZ(0, width, height-thickness);
XYZ endPtTop = new XYZ(0, width, height);
XYZ midPtBtm = new XYZ(0, width / 2, height + width / 3 - thickness);
XYZ midPtTop = new XYZ(0, width / 2, height + width / 3);
Line line1 = appCreation.NewLineBound(startPtBtm, startPtTop);
Line line2 = appCreation.NewLineBound(endPtTop, endPtBtm);
Arc arc1 = appCreation.NewArc(startPtTop, endPtTop, midPtTop);
Arc arc2 = appCreation.NewArc(startPtBtm, endPtBtm, midPtBtm);
CurveArray profile = appCreation.NewCurveArray();
profile.Append(line1);
profile.Append(arc1);
profile.Append(line2);
profile.Append(arc2);
XYZ bubbleEnd = new XYZ(0, 0, 0);
XYZ freeEnd = new XYZ(0, width, 0);
View view = rvtDoc.ActiveView;
ReferencePlane refPlane = rvtDoc.Create.NewReferencePlane(bubbleEnd, freeEnd, XYZ.BasisX, view);
RoofType roofType = new FilteredElementCollector(rvtDoc).OfClass(typeof(RoofType)).FirstElement() as RoofType;
ExtrusionRoof roof = rvtDoc.Create.NewExtrusionRoof(profile, refPlane, level02, roofType, 0, length);
Posted by: Account Deleted | April 03, 2012 at 03:39
Dear Lin Jerry,
Nope, no idea. All I can suggest is
http://thebuildingcoder.typepad.com/blog/2009/07/debug-geometric-form-creation.html
Good luck!
Cheers, Jeremy.
Posted by: Jeremy Tammik | April 03, 2012 at 03:55
Dear Jeremy,Thanks for your quick response! I'll try the suggestion from you!
Regards, Lin
Posted by: Account Deleted | April 03, 2012 at 05:01