public DBText DBTextToNative(Text text) { var _text = new DBText(); _text.TextString = text.value; _text.Height = ScaleToNative(text.height, text.units); _text.Position = (text["position"] != null) ? PointToNative(text["position"] as Point) : PointToNative(text.plane.origin); _text.Rotation = text.rotation; _text.Normal = VectorToNative(text.plane.normal); double widthFactor = text["widthFactor"] as double? ?? 1; _text.WidthFactor = widthFactor; return(_text); }
public MText MTextToNative(Text text) { var _text = new MText(); if (string.IsNullOrEmpty(text.richText)) { _text.Contents = text.value; } else { _text.ContentsRTF = text.richText; } _text.TextHeight = ScaleToNative(text.height, text.units); _text.Location = (text["position"] != null) ? PointToNative(text["position"] as Point) : PointToNative(text.plane.origin); _text.Rotation = text.rotation; _text.Normal = VectorToNative(text.plane.normal); return(_text); }
public Text TextToSpeckle(MText text) { var _text = new Text(); // not realistically feasible to extract outline curves for displayvalue currently _text.height = text.Height; var center = (text.Bounds != null) ? GetTextCenter(text.Bounds.Value) : text.Location; _text.plane = PlaneToSpeckle(new Plane(center, text.Normal)); _text.rotation = text.Rotation; _text.value = text.Contents; _text.richText = text.ContentsRTF; _text.units = ModelUnits; // autocad specific props _text["position"] = PointToSpeckle(text.Location); _text["isMText"] = true; return(_text); }
// Text public Text TextToSpeckle(DBText text) { var _text = new Text(); // not realistically feasible to extract outline curves for displayvalue currently _text.height = text.Height; var center = GetTextCenter(text); _text.plane = PlaneToSpeckle(new Plane(center, text.Normal)); _text.rotation = text.Rotation; _text.value = text.TextString; _text.units = ModelUnits; // autocad specific props _text["horizontalAlignment"] = text.HorizontalMode.ToString(); _text["verticalAlignment"] = text.VerticalMode.ToString(); _text["position"] = PointToSpeckle(text.Position); _text["widthFactor"] = text.WidthFactor; _text["isMText"] = false; return(_text); }