public static object ToNative(this SpeckleAnnotation annot) { if (annot.Plane != null) { // TEXT ENTITIY var textEntity = new TextEntity() { Text = annot.Text, Plane = annot.Plane.ToNative(), FontIndex = Rhino.RhinoDoc.ActiveDoc.Fonts.FindOrCreate(annot.FontName, ( bool )annot.Bold, ( bool )annot.Italic), TextHeight = ( double )annot.TextHeight }; #if R6 var dimStyleIndex = Rhino.RhinoDoc.ActiveDoc.DimStyles.Add("Speckle"); var dimStyle = new Rhino.DocObjects.DimensionStyle { TextHeight = ( double )annot.TextHeight, Font = new Rhino.DocObjects.Font(annot.FontName, Rhino.DocObjects.Font.FontWeight.Bold, Rhino.DocObjects.Font.FontStyle.Italic, false, false) }; Rhino.RhinoDoc.ActiveDoc.DimStyles.Modify(dimStyle, dimStyleIndex, true); textEntity.DimensionStyleId = Rhino.RhinoDoc.ActiveDoc.DimStyles[dimStyleIndex].Id; #endif return(textEntity); } else { // TEXT DOT! var myTextdot = new TextDot(annot.Text, annot.Location.ToNative().Location); myTextdot.UserDictionary.ReplaceContentsWith(annot.Properties.ToNative()); return(myTextdot); } }
public static SpeckleAnnotation ToSpeckle(this TextDot textdot) { var myAnnotation = new SpeckleAnnotation(); myAnnotation.Text = textdot.Text; myAnnotation.Location = textdot.Point.ToSpeckle(); myAnnotation.GenerateHash(); return(myAnnotation); }
// Texts & Annotations public static SpeckleAnnotation ToSpeckle(this TextEntity textentity) { Rhino.DocObjects.Font font = Rhino.RhinoDoc.ActiveDoc.Fonts[textentity.FontIndex]; var myAnnotation = new SpeckleAnnotation(); myAnnotation.Text = textentity.Text; myAnnotation.Plane = textentity.Plane.ToSpeckle(); myAnnotation.FontName = font.FaceName; myAnnotation.TextHeight = textentity.TextHeight; myAnnotation.Bold = font.Bold; myAnnotation.Italic = font.Italic; myAnnotation.GenerateHash(); return(myAnnotation); }