예제 #1
0
 /// <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
     });
 }
예제 #2
0
        /// <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));
        }
예제 #3
0
        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);
        }
예제 #4
0
 public static ModelText Wrap(Autodesk.Revit.DB.ModelText ele, bool isRevitOwned)
 {
     return(ModelText.FromExisting(ele, isRevitOwned));
 }
예제 #5
0
 /// <summary>
 /// Initialize a ModelText element
 /// </summary>
 /// <param name="element"></param>
 private void InitModelText(Autodesk.Revit.DB.ModelText element)
 {
     InternalSetModelText(element);
 }
예제 #6
0
 /// <summary>
 /// Internal constructor for wrapping a ModelText.
 /// </summary>
 /// <param name="element"></param>
 private ModelText(Autodesk.Revit.DB.ModelText element)
 {
     SafeInit(() => InitModelText(element));
 }
예제 #7
0
 /// <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;
 }
예제 #8
0
 /// <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;
 }