Example #1
0
        /// <summary>
        /// Gets the segment curve at the given index.
        /// </summary>
        /// <param name="index">Index of segment to retrieve.</param>
        /// <returns>The segment at the given index or null on failure.</returns>
        /// <since>5.0</since>
        public Curve SegmentCurve(int index)
        {
            IntPtr ptr    = ConstPointer();
            IntPtr pCurve = UnsafeNativeMethods.ON_PolyCurve_SegmentCurve(ptr, index);

            return(GeometryBase.CreateGeometryHelper(pCurve, this, index) as Curve);
        }
Example #2
0
        /// <summary>
        /// Computes draft curve silhouettes of a shape.
        /// </summary>
        /// <param name="geometry">Geometry whose silhouettes need to be computed. Can be Brep, BrepFace, Mesh, or Extrusion.</param>
        /// <param name="draftAngle">The draft angle in radians. Draft angle can be a positive or negative value.</param>
        /// <param name="pullDirection">3d direction for the mold to be pulled in, directed away from the object.</param>
        /// <param name="tolerance">
        /// Tolerance to use for determining projecting relationships.
        /// Surfaces and curves that are closer than tolerance, may be treated as projecting.
        /// When in doubt use RhinoDoc.ModelAbsoluteTolerance.
        /// </param>
        /// <param name="angleToleranceRadians">
        /// Angular tolerance to use for determining projecting relationships.
        /// A surface normal N that satisfies N o cameraDirection &lt; Sin(angleToleranceRadians) may be considered projecting.
        /// When in doubt use RhinoDoc.ModelAngleToleranceRadians.
        /// </param>
        /// <param name="cancelToken">Computation cancellation token.</param>
        /// <returns>Array of silhouette curves.</returns>
        /// <since>7.0</since>
        public static Silhouette[] ComputeDraftCurve(
            GeometryBase geometry,
            double draftAngle,
            Vector3d pullDirection,
            double tolerance,
            double angleToleranceRadians,
            System.Threading.CancellationToken cancelToken
            )
        {
            IntPtr const_ptr_geometry = geometry.ConstPointer();

            ThreadTerminator terminator = null;

            if (cancelToken != System.Threading.CancellationToken.None)
            {
                terminator = new ThreadTerminator();
                cancelToken.Register(terminator.RequestCancel);
            }
            IntPtr ptr_terminator = terminator == null ? IntPtr.Zero : terminator.NonConstPointer();

            IntPtr ptr_silhouettes = UnsafeNativeMethods.TLC_Sillhouette3(const_ptr_geometry, draftAngle, pullDirection, tolerance, angleToleranceRadians, ptr_terminator);

            Silhouette[] rc = FromClassArray(ptr_silhouettes);
            UnsafeNativeMethods.TLC_SilhouetteArrayDelete(ptr_silhouettes);
            if (terminator != null)
            {
                terminator.Dispose();
            }
            GC.KeepAlive(geometry);
            return(rc);
        }
        public NurbsCurve ToNurbsCurve()
        {
            IntPtr const_ptr_this = ConstPointer();
            IntPtr ptr_nurbs_crv  = UnsafeNativeMethods.ON_BezierCurve_GetNurbForm(const_ptr_this);

            return(GeometryBase.CreateGeometryHelper(ptr_nurbs_crv, null) as NurbsCurve);
        }
Example #4
0
        /// <summary>
        /// Get a cubic, uniform, non-rational, NURBS curve that is on the
        /// edge's limit curve.
        /// </summary>
        /// <param name="clampEnds">
        /// If true, the end knots are clamped.
        /// Otherwise the end knots are(-2,-1,0,...., k1, k1+1, k1+2).
        /// </param>
        /// <returns></returns>
        /// <since>7.0</since>
        public NurbsCurve ToNurbsCurve(bool clampEnds)
        {
            IntPtr const_ptr_this = ConstPointer();
            IntPtr ptr_nurbscurve = UnsafeNativeMethods.ON_SubDEdge_LimitCurve(const_ptr_this, clampEnds);

            return(GeometryBase.CreateGeometryHelper(ptr_nurbscurve, null) as NurbsCurve);
        }
Example #5
0
        /// <summary>
        /// Removes any nesting of polycurves. If this polycurve has just a single segment, the segment is returned.
        /// If, after nest removal, there are adjacent segments which are polylines, they are combined into a single polyline.
        /// The new curve may have a different domain from this polycurve. If the start and end segments of a closed input are polylines,
        /// the result may have a different seam location since the start and end segments will be combined.
        /// </summary>
        /// <returns>A new curve that is not necessarily a polycurve if successful, null otherwise. </returns>
        /// <seealso cref="RemoveNesting"/>
        /// <since>7.0</since>
        public Curve CleanUp()
        {
            IntPtr ptr_const_this = ConstPointer();
            IntPtr ptr            = UnsafeNativeMethods.RHC_RhinoCleanUpPolyCurve(ptr_const_this);

            return(GeometryBase.CreateGeometryHelper(ptr, null) as Curve);
        }
Example #6
0
 /// <summary>
 /// Compute silhouettes of a shape for a parallel projection.
 /// </summary>
 /// <param name="geometry">Geometry whose silhouettes need to be computed. Can be Brep, BrepFace, Mesh, or Extrusion.</param>
 /// <param name="silhouetteType">Types of silhouette to compute.</param>
 /// <param name="parallelCameraDirection">Direction of parallel camera.</param>
 /// <param name="tolerance">Tolerance to use for determining projecting relationships.
 /// Surfaces and curves that are closer than tolerance, may be treated as projecting.
 /// When in doubt use RhinoDoc.ModelAbsoluteTolerance.</param>
 /// <param name="angleToleranceRadians">Angular tolerance to use for determining projecting relationships.
 /// A surface normal N that satisfies N o cameraDirection &lt; Sin(angleToleranceRadians) may be considered projecting.
 /// When in doubt use RhinoDoc.ModelAngleToleranceRadians.</param>
 /// <returns>Array of silhouette curves.</returns>
 /// <since>6.0</since>
 public static Silhouette[] Compute(
     GeometryBase geometry,
     SilhouetteType silhouetteType,
     Vector3d parallelCameraDirection,
     double tolerance,
     double angleToleranceRadians)
 {
     return(Compute(geometry, silhouetteType, parallelCameraDirection, tolerance, angleToleranceRadians, null, System.Threading.CancellationToken.None));
 }
Example #7
0
 /// <summary>
 /// Compute silhouettes of a shape for a perspective projection.
 /// </summary>
 /// <param name="geometry">Geometry whose silhouettes need to be computed. Can be Brep, BrepFace, Mesh, or Extrusion.</param>
 /// <param name="silhouetteType">Types of silhouette to compute.</param>
 /// <param name="perspectiveCameraLocation">Location of perspective camera.</param>
 /// <param name="tolerance">Tolerance to use for determining projecting relationships.
 /// Surfaces and curves that are closer than tolerance, may be treated as projecting.
 /// When in doubt use RhinoDoc.ModelAbsoluteTolerance.</param>
 /// <param name="angleToleranceRadians">Angular tolerance to use for determining projecting relationships.
 /// A surface normal N that satisfies N o cameraDirection &lt; Sin(angleToleranceRadians) may be considered projecting.
 /// When in doubt use RhinoDoc.ModelAngleToleranceRadians.</param>
 /// <returns>Array of silhouette curves.</returns>
 /// <since>6.0</since>
 public static Silhouette[] Compute(
     GeometryBase geometry,
     SilhouetteType silhouetteType,
     Point3d perspectiveCameraLocation,
     double tolerance,
     double angleToleranceRadians)
 {
     return(Compute(geometry, silhouetteType, perspectiveCameraLocation, tolerance, angleToleranceRadians, null, System.Threading.CancellationToken.None));
 }
Example #8
0
 /// <summary>
 /// Compute silhouettes of a shape for a specified projection.
 /// </summary>
 /// <param name="geometry">Geometry whose silhouettes need to be computed. Can be Brep, BrepFace, Mesh, or Extrusion.</param>
 /// <param name="silhouetteType">Types of silhouette to compute.</param>
 /// <param name="viewport">Projection.</param>
 /// <param name="tolerance">Tolerance to use for determining projecting relationships.
 /// Surfaces and curves that are closer than tolerance, may be treated as projecting.
 /// When in doubt use RhinoDoc.ModelAbsoluteTolerance.</param>
 /// <param name="angleToleranceRadians">Angular tolerance to use for determining projecting relationships.
 /// A surface normal N that satisfies N o cameraDirection &lt; Sin(angleToleranceRadians) may be considered projecting.
 /// When in doubt use RhinoDoc.ModelAngleToleranceRadians.</param>
 /// <returns>Array of silhouette curves.</returns>
 /// <since>6.0</since>
 public static Silhouette[] Compute(
     GeometryBase geometry,
     SilhouetteType silhouetteType,
     ViewportInfo viewport,
     double tolerance,
     double angleToleranceRadians)
 {
     return(Compute(geometry, silhouetteType, viewport, tolerance, angleToleranceRadians, null, System.Threading.CancellationToken.None));
 }
Example #9
0
        /// <summary>
        /// Constructs a light copy of this object. By "light", it is meant that the same
        /// underlying data is used until something is done to attempt to change it. For example,
        /// you could have a shallow copy of a very heavy mesh object and the same underlying
        /// data will be used when doing things like inspecting the number of faces on the mesh.
        /// If you modify the location of one of the mesh vertices, the shallow copy will create
        /// a full duplicate of the underlying mesh data and the shallow copy will become a
        /// deep copy.
        /// </summary>
        /// <returns>An object of the same type as this object.
        /// <para>This behavior is overridden by implementing classes.</para></returns>
        /// <since>5.0</since>
        public GeometryBase DuplicateShallow()
        {
            GeometryBase rc = DuplicateShallowHelper();

            if (null != rc)
            {
                rc.m_shallow_parent = this;
            }
            return(rc);
        }
Example #10
0
 /// <summary>
 /// Computes draft curve silhouettes of a shape.
 /// </summary>
 /// <param name="geometry">Geometry whose silhouettes need to be computed. Can be Brep, BrepFace, Mesh, or Extrusion.</param>
 /// <param name="draftAngle">The draft angle in radians. Draft angle can be a positive or negative value.</param>
 /// <param name="pullDirection">3d direction for the mold to be pulled in, directed away from the object.</param>
 /// <param name="tolerance">
 /// Tolerance to use for determining projecting relationships.
 /// Surfaces and curves that are closer than tolerance, may be treated as projecting.
 /// When in doubt use RhinoDoc.ModelAbsoluteTolerance.
 /// </param>
 /// <param name="angleToleranceRadians">
 /// Angular tolerance to use for determining projecting relationships.
 /// A surface normal N that satisfies N o cameraDirection &lt; Sin(angleToleranceRadians) may be considered projecting.
 /// When in doubt use RhinoDoc.ModelAngleToleranceRadians.
 /// </param>
 /// <returns>Array of silhouette curves.</returns>
 /// <since>7.0</since>
 public static Silhouette[] ComputeDraftCurve(
     GeometryBase geometry,
     double draftAngle,
     Vector3d pullDirection,
     double tolerance,
     double angleToleranceRadians
     )
 {
     return(ComputeDraftCurve(geometry, draftAngle, pullDirection, tolerance, angleToleranceRadians, System.Threading.CancellationToken.None));
 }
Example #11
0
 /// <summary>
 /// Compute silhouettes of a shape for a specified projection.
 /// </summary>
 /// <param name="geometry">Geometry whose silhouettes need to be computed. Can be Brep, BrepFace, Mesh, or Extrusion.</param>
 /// <param name="silhouetteType">Types of silhouette to compute.</param>
 /// <param name="viewport">Projection.</param>
 /// <param name="tolerance">Tolerance to use for determining projecting relationships.
 /// Surfaces and curves that are closer than tolerance, may be treated as projecting.
 /// When in doubt use RhinoDoc.ModelAbsoluteTolerance.</param>
 /// <param name="angleToleranceRadians">Angular tolerance to use for determining projecting relationships.
 /// A surface normal N that satisfies N o cameraDirection &lt; Sin(angleToleranceRadians) may be considered projecting.
 /// When in doubt use RhinoDoc.ModelAngleToleranceRadians.</param>
 /// <param name="clippingPlanes">Optional collection of clipping planes.</param>
 /// <param name="cancelToken">Computation cancellation token.</param>
 /// <returns>Array of silhouette curves.</returns>
 /// <since>6.0</since>
 public static Silhouette[] Compute(
     GeometryBase geometry,
     SilhouetteType silhouetteType,
     ViewportInfo viewport,
     double tolerance,
     double angleToleranceRadians,
     IEnumerable <Plane> clippingPlanes,
     System.Threading.CancellationToken cancelToken)
 {
     if (viewport.IsParallelProjection)
     {
         return(Compute(geometry, silhouetteType, viewport.CameraDirection, tolerance, angleToleranceRadians, clippingPlanes, cancelToken));
     }
     return(Compute(geometry, silhouetteType, viewport.CameraLocation, tolerance, angleToleranceRadians, clippingPlanes, cancelToken));
 }
Example #12
0
        /// <summary>
        /// Compute silhouettes of a shape for a perspective projection.
        /// </summary>
        /// <param name="geometry">Geometry whose silhouettes need to be computed. Can be Brep, BrepFace, Mesh, or Extrusion.</param>
        /// <param name="silhouetteType">Types of silhouette to compute.</param>
        /// <param name="perspectiveCameraLocation">Location of perspective camera.</param>
        /// <param name="tolerance">Tolerance to use for determining projecting relationships.
        /// Surfaces and curves that are closer than tolerance, may be treated as projecting.
        /// When in doubt use RhinoDoc.ModelAbsoluteTolerance.</param>
        /// <param name="angleToleranceRadians">Angular tolerance to use for determining projecting relationships.
        /// A surface normal N that satisfies N o cameraDirection &lt; Sin(angleToleranceRadians) may be considered projecting.
        /// When in doubt use RhinoDoc.ModelAngleToleranceRadians.</param>
        /// <param name="clippingPlanes">Optional collection of clipping planes.</param>
        /// <param name="cancelToken">Computation cancellation token.</param>
        /// <returns>Array of silhouette curves.</returns>
        /// <since>6.0</since>
        public static Silhouette[] Compute(
            GeometryBase geometry,
            SilhouetteType silhouetteType,
            Point3d perspectiveCameraLocation,
            double tolerance,
            double angleToleranceRadians,
            IEnumerable <Plane> clippingPlanes,
            System.Threading.CancellationToken cancelToken)
        {
            IntPtr const_ptr_geometry = geometry.ConstPointer();

            Plane[] planes      = null;
            int     plane_count = 0;

            if (clippingPlanes != null)
            {
                List <Plane> p = new List <Plane>(clippingPlanes);
                plane_count = p.Count;
                planes      = p.ToArray();
            }

            ThreadTerminator terminator     = null;
            IntPtr           ptr_terminator = IntPtr.Zero;

            if (cancelToken != System.Threading.CancellationToken.None)
            {
                terminator     = new ThreadTerminator();
                ptr_terminator = terminator.NonConstPointer();
                cancelToken.Register(terminator.RequestCancel);
            }

            UnsafeNativeMethods.SilEventType s = (UnsafeNativeMethods.SilEventType)silhouetteType;
            IntPtr ptr_silhouettes             = UnsafeNativeMethods.TLC_Sillhouette2(const_ptr_geometry, s, perspectiveCameraLocation, tolerance, angleToleranceRadians, planes, plane_count, ptr_terminator);

            Silhouette[] rc = FromClassArray(ptr_silhouettes);
            UnsafeNativeMethods.TLC_SilhouetteArrayDelete(ptr_silhouettes);
            if (terminator != null)
            {
                terminator.Dispose();
            }
            GC.KeepAlive(geometry);
            return(rc);
        }
Example #13
0
        /// <summary>
        /// Determines if two geometries equal one another, in pure geometrical shape.
        /// This version only compares the geometry itself and does not include any user
        /// data comparisons.
        /// This is a comparison by value: for two identical items it will be true, no matter
        /// where in memory they may be stored.
        /// </summary>
        /// <param name="first">The first geometry</param>
        /// <param name="second">The second geometry</param>
        /// <returns>The indication of equality</returns>
        /// <since>6.0</since>
        public static bool GeometryEquals(GeometryBase first, GeometryBase second)
        {
            if (first == null && second == null)
            {
                return(true);
            }
            if (first == null || second == null)
            {
                return(false);
            }

            IntPtr first_ptr  = first.ConstPointer();
            IntPtr second_ptr = second.ConstPointer();

            bool rc = UnsafeNativeMethods.RH_RhinoCompareGeometry(first_ptr, second_ptr);

            Runtime.CommonObject.GcProtect(first, second);
            return(rc);
        }
Example #14
0
        private Silhouette(IntPtr ptrSilEvent)
        {
            IntPtr ptr_curve = UnsafeNativeMethods.TLC_SilEvent_ExtractCurve(ptrSilEvent);

            Curve = GeometryBase.CreateGeometryHelper(ptr_curve, null) as Curve;
            ComponentIndex ci = ComponentIndex.Unset;
            var            et = UnsafeNativeMethods.TLC_SilEvent_Extract(ptrSilEvent, ref ci);

            switch (et)
            {
            case UnsafeNativeMethods.SilEventType.None:
                SilhouetteType = SilhouetteType.None;
                break;

            case UnsafeNativeMethods.SilEventType.Tangent:
                SilhouetteType = SilhouetteType.Tangent;
                break;

            case UnsafeNativeMethods.SilEventType.Projecting:
                SilhouetteType = SilhouetteType.Projecting;
                break;

            case UnsafeNativeMethods.SilEventType.TanProjects:
                SilhouetteType = SilhouetteType.TangentProjects;
                break;

            case UnsafeNativeMethods.SilEventType.Boundary:
                SilhouetteType = SilhouetteType.Boundary;
                break;

            case UnsafeNativeMethods.SilEventType.Crease:
                SilhouetteType = SilhouetteType.Crease;
                break;

            case UnsafeNativeMethods.SilEventType.DraftCurve:
                SilhouetteType = SilhouetteType.DraftCurve;
                break;
            }
            GeometryComponentIndex = ci;
        }
        /// <summary>
        /// Initializes a box that contains a generic piece of geometry.
        /// This box will be aligned with an arbitrary plane.
        /// </summary>
        /// <param name="basePlane">Base plane for aligned bounding box.</param>
        /// <param name="geometry">Geometry to box.</param>
        /// <since>5.0</since>
        public Box(Plane basePlane, GeometryBase geometry)
        {
            // David: this code is untested.
            m_dx = new Interval(+1, -1);
            m_dy = new Interval(0, 0);
            m_dz = new Interval(0, 0);

            m_plane = basePlane;
            if (!m_plane.IsValid)
            {
                return;
            }

            Transform   mapping = Geometry.Transform.ChangeBasis(Plane.WorldXY, m_plane);
            BoundingBox bbox    = geometry.GetBoundingBox(mapping);

            m_dx = new Interval(bbox.Min.m_x, bbox.Max.m_x);
            m_dy = new Interval(bbox.Min.m_y, bbox.Max.m_y);
            m_dz = new Interval(bbox.Min.m_z, bbox.Max.m_z);

            MakeValid();
        }
Example #16
0
        public Curve[] Explode()
        {
            Runtime.InteropWrappers.SimpleArrayCurvePointer curves = new Runtime.InteropWrappers.SimpleArrayCurvePointer();
            IntPtr pConstThis  = ConstPointer();
            IntPtr pCurveArray = curves.NonConstPointer();

            UnsafeNativeMethods.ON_PolyCurve_SegmentCurves(pConstThis, pCurveArray);

            int count = UnsafeNativeMethods.ON_CurveArray_Count(pCurveArray);

            Curve[] rc = new Curve[count];
            for (int i = 0; i < count; i++)
            {
                IntPtr pConstSegmentCurve = UnsafeNativeMethods.ON_CurveArray_Get(pCurveArray, i);
                if (IntPtr.Zero == pConstSegmentCurve)
                {
                    continue;
                }
                IntPtr pNewCurve = UnsafeNativeMethods.ON_Curve_DuplicateCurve(pConstSegmentCurve);
                rc[i] = GeometryBase.CreateGeometryHelper(pNewCurve, null) as Curve;
            }
            curves.Dispose();
            return(rc);
        }
Example #17
0
 /// <summary>
 /// Is called when a non-constant operation occurs.
 /// </summary>
 protected override void OnSwitchToNonConst()
 {
     m_shallow_parent = null;
     base.OnSwitchToNonConst();
 }
Example #18
0
        internal static GeometryBase CreateGeometryHelper(IntPtr pGeometry, object parent, int subobjectIndex)
        {
            if (IntPtr.Zero == pGeometry)
            {
                return(null);
            }

            var type = UnsafeNativeMethods.ON_Geometry_GetGeometryType(pGeometry);

            if (type < 0)
            {
                return(null);
            }
            GeometryBase rc = null;

            switch (type)
            {
            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Curve: //1
                rc = new Curve(pGeometry, parent, subobjectIndex);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_NurbsCurve: //2
                rc = new NurbsCurve(pGeometry, parent, subobjectIndex);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_PolyCurve: // 3
                rc = new PolyCurve(pGeometry, parent, subobjectIndex);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_PolylineCurve: //4
                rc = new PolylineCurve(pGeometry, parent, subobjectIndex);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_ArcCurve: //5
                rc = new ArcCurve(pGeometry, parent, subobjectIndex);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_LineCurve: //6
                rc = new LineCurve(pGeometry, parent, subobjectIndex);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Mesh: //7
                rc = new Mesh(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Point: //8
                rc = new Point(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_TextDot: //9
                rc = new TextDot(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Surface: //10
                rc = new Surface(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Brep: //11
                rc = new Brep(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_NurbsSurface: //12
                rc = new NurbsSurface(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_RevSurface: //13
                rc = new RevSurface(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_PlaneSurface: //14
                rc = new PlaneSurface(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_ClippingPlaneSurface: //15
                rc = new ClippingPlaneSurface(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Hatch: // 17
                rc = new Hatch(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_SumSurface: //19
                rc = new SumSurface(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_BrepFace: //20
            {
                int    faceindex = -1;
                IntPtr ptr_brep  = UnsafeNativeMethods.ON_BrepSubItem_Brep(pGeometry, ref faceindex);
                if (ptr_brep != IntPtr.Zero && faceindex >= 0)
                {
                    Brep b = new Brep(ptr_brep, parent);
                    rc = b.Faces[faceindex];
                }
            }
            break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_BrepEdge: // 21
            {
                int    edgeindex = -1;
                IntPtr ptr_brep  = UnsafeNativeMethods.ON_BrepSubItem_Brep(pGeometry, ref edgeindex);
                if (ptr_brep != IntPtr.Zero && edgeindex >= 0)
                {
                    Brep b = new Brep(ptr_brep, parent);
                    rc = b.Edges[edgeindex];
                }
            }
            break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_InstanceReference: // 23
                rc = new InstanceReferenceGeometry(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Extrusion: //24
                rc = new Extrusion(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_PointCloud: // 26
                rc = new PointCloud(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_DetailView: // 27
                rc = new DetailView(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Light: //32
                rc = new Light(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_PointGrid: //33
                rc = new Point3dGrid(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_MorphControl: //34
                rc = new MorphControl(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_BrepLoop: //35
            {
                int    loopindex = -1;
                IntPtr ptr_brep  = UnsafeNativeMethods.ON_BrepSubItem_Brep(pGeometry, ref loopindex);
                if (ptr_brep != IntPtr.Zero && loopindex >= 0)
                {
                    Brep b = new Brep(ptr_brep, parent);
                    rc = b.Loops[loopindex];
                }
            }
            break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_BrepTrim: // 36
            {
                int    trimindex = -1;
                IntPtr ptr_brep  = UnsafeNativeMethods.ON_BrepSubItem_Brep(pGeometry, ref trimindex);
                if (ptr_brep != IntPtr.Zero && trimindex >= 0)
                {
                    Brep b = new Brep(ptr_brep, parent);
                    rc = b.Trims[trimindex];
                }
            }
            break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Leader: // 38
                rc = new Leader(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_SubD: // 39
                rc = new SubD(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_DimLinear: //40
                rc = new LinearDimension(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_DimAngular: //41
                rc = new AngularDimension(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_DimRadial: //42
                rc = new RadialDimension(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_DimOrdinate: //43
                rc = new OrdinateDimension(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Centermark: //44
                rc = new Centermark(pGeometry, parent);
                break;

            case UnsafeNativeMethods.OnGeometryTypeConsts.ON_Text: //45
                rc = new TextEntity(pGeometry, parent);
                break;

            default:
                rc = new UnknownGeometry(pGeometry, parent, subobjectIndex);
                break;
            }

            return(rc);
        }