############### ### DM2_w24 ### ### sorting ### ############### ############################## import rhinoscriptsyntax as rs import random, math, sys, os, time sys.path.append("C:\Weronika\erasmus Graz\Digitale Methoden - Python\DM_lib") ### import DM_lib as dm ### reload( dm ) ############################## ################### rs.ViewDisplayMode(view=None, mode="rendered") rs.EnableRedraw(0) dm.printDisplay(1) dm.PointRadius(displayModeX="all", rad=1, styl=3, verbose=0) ################### ######## need file "annapurna.3dm" dm.newEmptyLayer("FinalProjekt", [97,65,47]) mountain1 = rs.ObjectsByName("DEM_35_12_4_074_34_3", 0) ### sel by name coords1 = dm.getSurfacePoints( mountain1[0] ) ### get coords of surface-Control-points ! coordsSorted1 = sorted(coords1, key=lambda sKey: sKey[2]) ### that's essential ! (sort by z_coord) max1 = coordsSorted1[-1]#[2] rs.AddPoint(max1) mountain2 = rs.ObjectsByName("DEM_28_34_4_083_48_3", 0) ### sel by name coords2 = dm.getSurfacePoints( mountain2[0] ) ### get coords of surface-Control-points ! coordsSorted2 = sorted(coords2, key=lambda sKey: sKey[2]) ### that's essential ! (sort by z_coord) max2 = coordsSorted2[-1]#[2] rs.AddPoint(max2) mountain3 = rs.ObjectsByName("DEM_27_57_3_086_53_5", 0) ### sel by name coords3 = dm.getSurfacePoints( mountain3[0] ) ### get coords of surface-Control-points ! coordsSorted3 = sorted(coords3, key=lambda sKey: sKey[2]) ### that's essential ! (sort by z_coord) max3 = coordsSorted3[-1]#[2] rs.AddPoint(max3) mountain4 = rs.ObjectsByName("DEM_35_51_3_076_29_4", 0) ### sel by name coords4 = dm.getSurfacePoints( mountain4[0] ) ### get coords of surface-Control-points ! coordsSorted4 = sorted(coords4, key=lambda sKey: sKey[2]) ### that's essential ! (sort by z_coord) max4 = coordsSorted4[-1]#[2] rs.AddPoint(max4) crv = rs.AddLine(max1,max2) midPoint = dm.pntInbetween(max1,max2,0.5) peaks = [max1,max2,max3,max4,max1]