โปรแกรม จะถาม และ ใส่ให้เอง โดยอัตโนมัติ ที่กลางกำแพงจากค่า mytag
private static IndependentTag CreateMyTag(Autodesk.Revit.DB.Document document, Wall wall,String mytag)
{
// check 2D
Autodesk.Revit.DB.View view = document.ActiveView;
TagMode tagMode = TagMode.TM_ADDBY_CATEGORY;
TagOrientation tagorn = TagOrientation.Horizontal;
// Find Mid wall
LocationCurve wallLoc = wall.Location as LocationCurve;
XYZ wallStart = wallLoc.Curve.GetEndPoint(0);
XYZ wallEnd = wallLoc.Curve.GetEndPoint(1);
XYZ wallMid = wallStart + (wallEnd - wallStart) / 2.0;
IndependentTag newTag = document.Create.NewTag(view, wall, true, tagMode, tagorn, wallMid);
if (null == newTag)
{
throw new Exception("Create Wall Tag Failed.");
}
//find some param
WallType type = wall.WallType;
Parameter foundParameter = type.LookupParameter("Type Mark");
bool result = foundParameter.Set(mytag);
newTag.HasLeader = false;
newTag.TagHeadPosition = wallMid;
return newTag;
}