RevitiAPI: How to create revision cloud?

中文链接

By Aaron Lu

Again, use RevitLookup, we can see the related class is RevisionCloud, so the creation method is either in Document.Create or in the static methods of the class itself.

Fortunately, there is a static method called Create:

public static RevisionCloud Create(Document document, View view, ElementId revisionId, IList<Curve> curves)

We should know the meaning of most of the arguments, except revisionId, where can we get it?

 

I tried to pass ElementId.InvalidElementId, it throws:

Autodesk.Revit.Exceptions.ArgumentException: revisionId is not a valid Revision.  Parameter name: revisionId

So we have to pass something meaningful.

At this moment, I found there is a property RevisionCloud.RevisionId which should be relevant, and that id is a Revision.

Inspect Revision, it also has a static Create method, now the solution is obvious, and simple:

var revision = Revision.Create(RevitDoc);
var revisionCloud = RevisionCloud.Create(RevitDoc,
RevitDoc.ActiveView, ElementId.InvalidElementId,
new List<Curve>() {
Line.CreateBound(XYZ.Zero, new XYZ(10,0,0))
});

 


Comments

One response to “RevitiAPI: How to create revision cloud?”

  1. I’d like to thank the author for writing such an insightful and informative blog post about revit api revision cloud that is not just useful to the readers but also revealing.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading