« Pimp my AutoCAD or Revit Ribbon | Main | Comparing Element Id for Equality »

February 26, 2011

Comments

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);

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.

Dear Jeremy,Thanks for your quick response! I'll try the suggestion from you!
Regards, Lin

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)

Jeremy Tammik

AboutTopicsIndexSource