/// <summary> /// Create a ModelText Element from a user selected Element. /// </summary> /// <param name="pt"></param> /// <param name="isRevitOwned"></param> /// <returns></returns> internal static ModelText FromExisting(Autodesk.Revit.DB.ModelText pt, bool isRevitOwned) { return(new ModelText(pt) { IsRevitOwned = isRevitOwned }); }
/// <summary> /// Check if the position of a ModelText has changed, given the original ModelText Element /// and the new position in the SketchPlane /// </summary> /// <param name="oldModelText"></param> /// <param name="newSketchPlane"></param> /// <param name="xCoordinateInPlane"></param> /// <param name="yCoordinateInPlane"></param> /// <returns></returns> private static bool PositionUnchanged(Autodesk.Revit.DB.ModelText oldModelText, Autodesk.Revit.DB.SketchPlane newSketchPlane, double xCoordinateInPlane, double yCoordinateInPlane) { var oldPosition = ((LocationPoint)oldModelText.Location).Point; var plane = newSketchPlane.GetPlane(); var newPosition = plane.Origin + plane.XVec * xCoordinateInPlane + plane.YVec * yCoordinateInPlane; return(oldPosition.IsAlmostEqualTo(newPosition)); }
private static Autodesk.Revit.DB.ModelText CreateModelText(XYZ normal, XYZ position, XYZ up, string text, ModelTextType mtt, double depth) { Autodesk.Revit.DB.ModelText mt = null; var xAxis = normal.CrossProduct(up).Normalize(); var yAxis = normal.CrossProduct(xAxis).Normalize(); var plane = new Autodesk.Revit.DB.Plane(xAxis, yAxis, position); var sp = Autodesk.Revit.DB.SketchPlane.Create(dynRevitSettings.Doc.Document, plane); mt = dynRevitSettings.Doc.Document.FamilyCreate.NewModelText(text, mtt, sp, position, HorizontalAlign.Left, depth); return(mt); }
public static ModelText Wrap(Autodesk.Revit.DB.ModelText ele, bool isRevitOwned) { return(ModelText.FromExisting(ele, isRevitOwned)); }
/// <summary> /// Initialize a ModelText element /// </summary> /// <param name="element"></param> private void InitModelText(Autodesk.Revit.DB.ModelText element) { InternalSetModelText(element); }
/// <summary> /// Internal constructor for wrapping a ModelText. /// </summary> /// <param name="element"></param> private ModelText(Autodesk.Revit.DB.ModelText element) { SafeInit(() => InitModelText(element)); }
/// <summary> /// Set the Element, ElementId, and UniqueId /// </summary> /// <param name="p"></param> private void InternalSetModelText(Autodesk.Revit.DB.ModelText p) { InternalModelText = p; this.InternalElementId = InternalModelText.Id; this.InternalUniqueId = InternalModelText.UniqueId; }