Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I use IndependentTag.Create method and it works, but I can not understand how point argument is working. In my case I can control only X value, while Y value always the same even if I set it manually.
Here is example, on the 1st picture I use calculated point in the middle of bounding box, on the 2nd picture I use point at 0, 0, 0.
Here is code:
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
var tagTypeId = new ElementId((long)281856); // tag
var viewId = new ElementId((long)282095); // view
var view = doc.GetElement(viewId) as ViewSection;
var elemToTagId = new ElementId((long)279311); // ригель
var elemToTag = doc.GetElement(elemToTagId);
var refer = new Reference(elemToTag);
var outline = elemToTag.get_BoundingBox(view);
//var pt = new XYZ((outline.Max.X + outline.Min.X) / 2, (outline.Max.X + outline.Min.X) / 2, 0);
var pt = new XYZ(0, 0, 0);
using (Transaction t = new Transaction(doc, "Создание тега"))
{
t.Start();
var tag = IndependentTag.Create(doc, tagTypeId, viewId, refer, false, TagOrientation.Horizontal, pt);
t.Commit();
}
return Result.Succeeded;
}
Solved! Go to Solution.