public static ModelTextType Wrap(Autodesk.Revit.DB.ModelTextType ele, bool isRevitOwned) { return(ModelTextType.FromExisting(ele, isRevitOwned)); }
/// <summary> /// Create a ModelText Element in the Family Document by providing the text, SketchPlane Element host, coordinates (within the plane of the SketchPlane), /// the depth of the text, and the text type name /// </summary> /// <param name="text"></param> /// <param name="sketchPlane"></param> /// <param name="xCoordinateInPlane"></param> /// <param name="yCoordinateInPlane"></param> /// <param name="textDepth"></param> /// <param name="modelTextType"></param> /// <returns></returns> public static ModelText ByTextSketchPlaneAndPosition(string text, SketchPlane sketchPlane, double xCoordinateInPlane, double yCoordinateInPlane, double textDepth, ModelTextType modelTextType) { if (!Document.IsFamilyDocument) { throw new Exception("ModelText Elements can only be created in a Family Document"); } if (text == null) { throw new ArgumentNullException("text"); } if (sketchPlane == null) { throw new ArgumentNullException("sketchPlane"); } if (modelTextType == null) { throw new ArgumentNullException("modelTextType"); } return(new ModelText(text, sketchPlane.InternalSketchPlane, xCoordinateInPlane * UnitConverter.DynamoToHostFactor, yCoordinateInPlane * UnitConverter.DynamoToHostFactor, textDepth * UnitConverter.DynamoToHostFactor, modelTextType.InternalModelTextType)); }
/// <summary> /// Create a ModelText Element in the Family Document by providing the text, SketchPlane Element host, coordinates (within the plane of the SketchPlane), /// the depth of the text, and the text type name /// </summary> /// <param name="text"></param> /// <param name="sketchPlane"></param> /// <param name="xCoordinateInPlane"></param> /// <param name="yCoordinateInPlane"></param> /// <param name="textDepth"></param> /// <param name="modelTextType"></param> /// <returns></returns> public static ModelText ByTextSketchPlaneAndPosition(string text, SketchPlane sketchPlane, double xCoordinateInPlane, double yCoordinateInPlane, double textDepth, ModelTextType modelTextType) { if (!Document.IsFamilyDocument) { throw new Exception(Properties.Resources.ModelTextCreationFailure); } if (text == null) { throw new ArgumentNullException("text"); } if (sketchPlane == null) { throw new ArgumentNullException("sketchPlane"); } if (modelTextType == null) { throw new ArgumentNullException("modelTextType"); } return(new ModelText(text, sketchPlane.InternalSketchPlane, xCoordinateInPlane * UnitConverter.DynamoToHostFactor(UnitType.UT_Length), yCoordinateInPlane * UnitConverter.DynamoToHostFactor(UnitType.UT_Length), textDepth * UnitConverter.DynamoToHostFactor(UnitType.UT_Length), modelTextType.InternalModelTextType)); }
/// <summary> /// Create a ModelText Element in the Family Document by providing the text, SketchPlane Element host, coordinates (within the plane of the SketchPlane), /// the depth of the text, and the text type name /// </summary> /// <param name="text"></param> /// <param name="sketchPlane"></param> /// <param name="xCoordinateInPlane"></param> /// <param name="yCoordinateInPlane"></param> /// <param name="textDepth"></param> /// <param name="modelTextType"></param> /// <returns></returns> public static ModelText ByTextSketchPlaneAndPosition(string text, SketchPlane sketchPlane, double xCoordinateInPlane, double yCoordinateInPlane, double textDepth, ModelTextType modelTextType ) { if (!Document.IsFamilyDocument) { throw new Exception("ModelText Elements can only be created in a Family Document"); } if (text == null) { throw new ArgumentNullException("text"); } if (sketchPlane == null) { throw new ArgumentNullException("sketchPlane"); } if (modelTextType == null) { throw new ArgumentNullException("modelTextType"); } return new ModelText(text, sketchPlane.InternalSketchPlane, xCoordinateInPlane, yCoordinateInPlane, textDepth, modelTextType.InternalModelTextType); }