Exemplo n.º 1
0
        public BoundingBox GetBoundingBox(bool accurate)
        {
#if RHINO_SDK
            RhinoObject parent_object = ParentRhinoObject();
#endif
            if (accurate)
            {
                BoundingBox bbox = new BoundingBox();
                Transform   xf   = new Transform();
#if RHINO_SDK
                // 3 July 2018 S. Baer (RH-46926)
                // When the object is non-const there is a good chance the geometry is
                // different than what is in the original parent object' geometry. Skip
                // using the parent's bbox getter when in this situation
                if (null != parent_object && !IsNonConst)
                {
                    IntPtr ptr_parent_rhinoobject = parent_object.ConstPointer();
                    if (UnsafeNativeMethods.CRhinoObject_GetTightBoundingBox(ptr_parent_rhinoobject, ref bbox, ref xf, false))
                    {
                        return(bbox);
                    }
                }
#endif
                AnnotationBase ann = this as AnnotationBase;
                if (ann != null)
                {
                    return(ann.InternalGetBoundingBox());
                }

                IntPtr ptr = ConstPointer();
                return(UnsafeNativeMethods.ON_Geometry_GetTightBoundingBox(ptr, ref bbox, ref xf, false) ? bbox : BoundingBox.Empty);
            }
            else
            {
                BoundingBox rc = new BoundingBox();
#if RHINO_SDK
                if (null != parent_object && !IsNonConst)
                {
                    IntPtr ptr_parent_rhinoobject = parent_object.ConstPointer();
                    if (UnsafeNativeMethods.CRhinoObject_BoundingBox(ptr_parent_rhinoobject, ref rc))
                    {
                        return(rc);
                    }
                }
#endif
                AnnotationBase ann = this as AnnotationBase;
                if (ann != null)
                {
                    return(ann.InternalGetBoundingBox());
                }

                IntPtr ptr = ConstPointer();
                UnsafeNativeMethods.ON_Geometry_BoundingBox(ptr, ref rc);
                return(rc);
            }
        }
Exemplo n.º 2
0
 /// <summary> Create Text geometry or null if input is invalid </summary>
 /// <param name="text"></param>
 /// <param name="plane"></param>
 /// <param name="style"></param>
 /// <param name="wrapped"></param>
 /// <param name="rectWidth"></param>
 /// <param name="rotationRadians"></param>
 /// <returns></returns>
 /// <since>6.0</since>
 public static TextEntity Create(string text, Plane plane, DimensionStyle style, bool wrapped, double rectWidth, double rotationRadians)
 {
     return(CreateWithRichText(AnnotationBase.PlainTextToRtf(text), plane, style, wrapped, rectWidth,
                               rotationRadians));
 }
Exemplo n.º 3
0
 /// <summary>
 ///  Creates a Leader geometry object
 /// </summary>
 /// <param name="text"></param>
 /// <param name="plane"></param>
 /// <param name="dimstyle"></param>
 /// <param name="points"></param>
 /// <returns></returns>
 /// <since>6.0</since>
 public static Leader Create(string text, Plane plane, DimensionStyle dimstyle, Point3d[] points)
 {
     return(CreateWithRichText(AnnotationBase.PlainTextToRtf(text), plane, dimstyle, points));
 }