Hello
Is it possible to get an example to create a Multi-rebar annotations, I search on the Revit SDK and found I have to use the MultiReferenceAnnotation class.
But I can't build an example with the current information.
For creating A normal Rebar Tag I'm using the Autodesk.Revit.Creation.Document.Create.NewTag method
I notice the independent tag has a property named MultiReferenceAnnotationId.
I'm using VS2012 c#, Revit 2014 and Windows 8 64bits
Thanks
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
Dear miguel.alanis,
Please note the MultiReferenceAnnotation.Create method taking a MultiReferenceAnnotationOptions argument.
The minimum options are probably the type and ElementsToDimension.
Here is an excerpt from an internal test suite I received from the development team:
var view = GetElement<View>(124186);
var rebarList = GetElements<Element>(RevitDoc, new[] { 280427 }).ToList();
Assert.IsTrue(rebarList.Count > 0, "There are no rebars in the document!");
IList<ElementId> elementIds = new List<ElementId>();
foreach (Element rebar in rebarList)
{
elementIds.Add(rebar.Id);
}
MultiReferenceAnnotationType type = GetElement<MultiReferenceAnnotationType>(RevitDoc, 260544);
Assert.IsNotNull(type, "the MultiReferenceAnnotationType does not exist!");
MultiReferenceAnnotationOptions options = new MultiReferenceAnnotationOptions(type);
options.TagHeadPosition = new XYZ(0, 100, 0);
options.DimensionLineOrigin = new XYZ(5, 5, 1);
options.DimensionLineDirection = new XYZ(0, 1, 0);
options.DimensionPlaneNormal = view.ViewDirection;
options.SetElementsToDimension(elementIds);
using (Transaction tran = new Transaction(RevitDoc, "Create_Rebar_Vertical"))
{
tran.Start();
var mra = MultiReferenceAnnotation.Create(RevitDoc, view.Id, options);
var dimension = GetElement<Dimension>(RevitDoc, mra.DimensionId);
tran.Commit();
}
I hope this helps.
Best regards,
Jeremy
Dear Miguel Angel,
Thank you for your response. I put it on The Building Coder as well to ensure it is easily found:
http://thebuildingcoder.typepad.com/blog/2013/09/multireferenceannotation-example.html
Cheers,
Jeremy
Hi,
I would like to refresh the topic because i cant found any information about option that i could manage orientation (vertical,horizontal) created tags. Is that possible?
Hi,
if you haven't found the solution yet you can use this :
Dear Łukasz,
Thank you for your answer, and also for the new question, which I already answered (as far as I am able to) in the comment on The Building Coder:
If you can determine the geometric location of the feature that each reference is associated with, you should be able to use that information to tell the two apart.
Cheers,
Jeremy
As it is done to locate the location of the reinforcements to place the dimension.
I'm trying to understand how geometry works in views. I imagine it could work like this.
Options opp = new Options();
opp.View = RevitTools.doc.ActiveView;
GeometryElement geoEl = r.get_Geometry(opp);
BoundingBoxXYZ box = geoEl.GetBoundingBox();
//Creo lista de elementos
List<ElementId> listIds = new List<ElementId>();
listIds.Add(r.Id);
//Opciones de Multirebar
MultiReferenceAnnotationOptions opt =
new MultiReferenceAnnotationOptions(ViewTools.MultiRebar);
opt.TagHasLeader = false;
//Ubicaciones
opt.TagHeadPosition = ?????;
opt.DimensionLineOrigin = ?????;
opt.DimensionLineDirection = ?????;
opt.DimensionPlaneNormal = RevitTools.doc.ActiveView.ViewDirection;
opt.SetElementsToDimension(listIds);
MultiReferenceAnnotation.Create(RevitTools.doc, r.Id, opt);
The intention is that it works for any view and any type of presentation.
Hello, I have a question with the above code.
How do you get a reference to the individual rebars elements within the rebar?
I have reviewed the messages indicated in the links and the API documentation (2022), but I have not found a way.
In the example code I need to know how to get the part with question marks:
public void RebarAnnotation(Document doc, View view, Rebar rebar){
// I already have it
MultiReferenceAnnotationType type = getAnnoType();
MultiReferenceAnnotationOptions options = getAnnoOptions(type);
// I need the part with question marks
IList<ElementId> elementIds = new List<ElementId>();
foreach (Element rbr in ???) {
elementIds.Add(rbr.Id);
}
options.SetElementsToDimension(elementIds);
// I already have it
using (Transaction tran = new Transaction(doc)) {
tran.Start("Rebar Annotation");
MultiReferenceAnnotation.Create(doc, view.Id, options);
tran.Commit();
}
}
Thank you.
(I have edited to correct some errors in the code)
Hello,
Thanks to the help of the development team (thanks to Naveen Kumar T) I have solved the previous question.
I leave the solution for future reference in case it helps someone else:
public void RebarAnnotation(Document doc, View view, Rebar rebar){
// I already have it
MultiReferenceAnnotationType type = getAnnoType();
MultiReferenceAnnotationOptions options = getAnnoOptions(type);
// With the reference to the set of bars it is enough.
IList<ElementId> elementIds = new List<ElementId>();
elementIds.Add(rebar.Id);
options.SetElementsToDimension(elementIds);
// I already have it
using (Transaction tran = new Transaction(doc)) {
tran.Start("Rebar Annotation");
MultiReferenceAnnotation.Create(doc, view.Id, options);
tran.Commit();
}
}
With the reference to the set of bars it is enough, it is not necessary to identify each individual bar.
Can't find what you're looking for? Ask the community or share your knowledge.