def GetEllipse(rhObj):
	try:
		geo = rhObj.Geometry
		if geo.ToString() == "Rhino.Geometry.NurbsCurve":
			if geo.IsClosed and geo.IsRational:
				return rhEllipseToEllipse(geo)
	except:
		pass
Beispiel #2
0
def GetGeometry(rhObj):
    try:
        geo = rhObj.Geometry
        if geo.ToString() == "Rhino.Geometry.LineCurve":
            return rhLineToLine(geo)
        elif geo.ToString() == "Rhino.Geometry.ArcCurve" and geo.IsArc():
            return rhArcToArc(geo)
        elif geo.ToString() == "Rhino.Geometry.Point":
            return rhPointToPoint(geo)
        elif geo.ToString(
        ) == "Rhino.Geometry.NurbsCurve" and geo.IsClosed and geo.IsRational:
            return rhEllipseToEllipse(geo)
        elif geo.ToString() == "Rhino.Geometry.PolyCurve":
            return rhPolyCurveToPolyCurve(geo)
        elif geo.ToString() == "Rhino.Geometry.NurbsCurve":
            return rhSingleSpanNurbsCurveToCurve(geo)
        elif geo.ToString() == "Rhino.Geometry.Extrusion":
            brep = geo.ToBrep()
            return rhBrepToPolySurface(brep)
        elif geo.ToString() == "Rhino.Geometry.PolylineCurve":
            return rhCurveToPolyCurve(geo)
        elif geo.ToString() == "Rhino.Geometry.Mesh":
            return rhMeshToMesh(geo)
    except:
        try:
            geo = rhObj.Geometry
            if geo.ToString() == "Rhino.Geometry.Brep":
                brepFaces = geo.Faces
                faceList = []
                for i in range(0, brepFaces.Count, 1):
                    rhSurface = brepFaces.Item[i].UnderlyingSurface()
                    if rhSurface.ToString() == "Rhino.Geometry.NurbsSurface":
                        faceList.append(rhNurbsSurfaceToSurface(rhSurface))
                    elif rhSurface.ToString() == "Rhino.Geometry.RevSurface":
                        faceList.append(
                            rhNurbsSurfaceToSurface(
                                rhSurface.ToNurbsSurface()))
                return faceList
            elif geo.ToString() == "Rhino.Geometry.ArcCurve" and geo.IsCircle(
            ):
                return rhCircleToCircle(geo)
        except:
            try:
                geo = rhObj.Geometry
                if geo.ToString() == "Rhino.Geometry.Brep":
                    return rhBrepToPolySurface(geo)
            except:
                pass
def GetGeometry(rhObj):
	try:
		geo = rhObj.Geometry
		if geo.ToString() == "Rhino.Geometry.LineCurve":
			return rhLineToLine(geo)
		elif geo.ToString() == "Rhino.Geometry.ArcCurve" and geo.IsArc():
			return rhArcToArc(geo)
		elif geo.ToString() == "Rhino.Geometry.Point":
			return rhPointToPoint(geo)
		elif geo.ToString() == "Rhino.Geometry.NurbsCurve" and geo.IsClosed and geo.IsRational:
			return rhEllipseToEllipse(geo)
		elif geo.ToString() == "Rhino.Geometry.PolyCurve":
			return rhPolyCurveToPolyCurve(geo)
		elif geo.ToString() == "Rhino.Geometry.NurbsCurve":
			return rhSingleSpanNurbsCurveToCurve(geo)
		elif geo.ToString() == "Rhino.Geometry.Extrusion":
			brep = geo.ToBrep()
			return rhBrepToPolySurface(brep)
		elif geo.ToString() == "Rhino.Geometry.PolylineCurve":
			return rhCurveToPolyCurve(geo)
		elif geo.ToString() == "Rhino.Geometry.Mesh":
			return rhMeshToMesh(geo)
	except:
		try:
			geo = rhObj.Geometry
			if geo.ToString() == "Rhino.Geometry.Brep":
				brepFaces = geo.Faces
				faceList = []
				for i in range(0, brepFaces.Count, 1):
					rhSurface = brepFaces.Item[i].UnderlyingSurface()
					if rhSurface.ToString() == "Rhino.Geometry.NurbsSurface":
						faceList.append(rhNurbsSurfaceToSurface(rhSurface))
					elif rhSurface.ToString() == "Rhino.Geometry.RevSurface":
						faceList.append(rhNurbsSurfaceToSurface(rhSurface.ToNurbsSurface()))
				return faceList
			elif geo.ToString() == "Rhino.Geometry.ArcCurve" and geo.IsCircle():
				return rhCircleToCircle(geo)
		except:
			try:
				geo = rhObj.Geometry
				if geo.ToString() == "Rhino.Geometry.Brep":
					return rhBrepToPolySurface(geo)
			except:
				pass