IndependentTag.Create point relation

IndependentTag.Create point relation

denisyukJ
Advocate Advocate
114 Views
1 Reply
Message 1 of 2

IndependentTag.Create point relation

denisyukJ
Advocate
Advocate

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.

denisyukJ_0-1745488073578.pngdenisyukJ_1-1745488110664.png

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;
}
0 Likes
Accepted solutions (1)
115 Views
1 Reply
Reply (1)
Message 2 of 2

denisyukJ
Advocate
Advocate
Accepted solution

Sorry, it is section view so I should control Z value instead of Y.

0 Likes