def makeTerrainSurfaces(): ptGrid = GeomTools.pointGrid(76, 76, 8, 8) # get the mesh try: mesh = doc.Objects.FindByLayer('tin_pts')[0].Geometry # make the points interpPoints = IntersectionTools.interpolatePointsToTerrainMesh(ptGrid, mesh) # make the surface srf = Rhino.Geometry.NurbsSurface.CreateFromPoints(interpPoints, 76, 76, 3, 3) except: print 'No contents on "tin_pts" layer' print 'flat ground created' srf = Rhino.Geometry.NurbsSurface.CreateFromPoints(ptGrid, 76, 76, 3, 3) # put it on the layer srfAtt = LayerUtils.layerAttributes('groundsurface', System.Drawing.Color.LightGray) doc.Objects.AddSurface(srf, srfAtt) srfBrep = Brep.CreateFromSurface(srf) contours = IntersectionTools.contourBrepInZ(srfBrep, 0.5) bigAtt = LayerUtils.layerAttributes('bigcontours', System.Drawing.Color.Black) smallAtt = LayerUtils.layerAttributes('smallcontours', System.Drawing.Color.DimGray) for i in range(len(contours)): if i % 10 == 0: # make a big contour for crv in contours[i]: doc.Objects.AddCurve(crv, bigAtt) else: # make a small contour for crv in contours[i]: doc.Objects.AddCurve(crv, smallAtt)
def makeTerrainSurfaces(): ptGrid = GeomTools.pointGrid(76, 76, 8, 8) # get the mesh try: mesh = doc.Objects.FindByLayer('tin_pts')[0].Geometry # make the points interpPoints = IntersectionTools.interpolatePointsToTerrainMesh( ptGrid, mesh) # make the surface srf = Rhino.Geometry.NurbsSurface.CreateFromPoints( interpPoints, 76, 76, 3, 3) except: print 'No contents on "tin_pts" layer' print 'flat ground created' srf = Rhino.Geometry.NurbsSurface.CreateFromPoints( ptGrid, 76, 76, 3, 3) # put it on the layer srfAtt = LayerUtils.layerAttributes('groundsurface', System.Drawing.Color.LightGray) doc.Objects.AddSurface(srf, srfAtt) srfBrep = Brep.CreateFromSurface(srf) contours = IntersectionTools.contourBrepInZ(srfBrep, 0.5) bigAtt = LayerUtils.layerAttributes('bigcontours', System.Drawing.Color.Black) smallAtt = LayerUtils.layerAttributes('smallcontours', System.Drawing.Color.DimGray) for i in range(len(contours)): if i % 10 == 0: # make a big contour for crv in contours[i]: doc.Objects.AddCurve(crv, bigAtt) else: # make a small contour for crv in contours[i]: doc.Objects.AddCurve(crv, smallAtt)