###################################
### DM2_w22 # AGruber@tugraz.at ###
### ue_04 pixel_2_vector demo   ###
###################################

##############################
import rhinoscriptsyntax as rs      ###
import random, time, sys            ###
sys.path.append("P:/")              ### add LW P:/ to rhino's default search path AND
sys.path.append("P:/WWW/diag/")     ### add YOUR LW P:/WWW/user/ to rhino's default search path ...
import DM2_lib as dm                ### ... thus DM2_lib.py can be found !
##############################      reload (dm)


rs.UnitSystem(4)                                        # km = 5, meters = 4, cm = 3 etc
rs.ShowGrid(None, 0)                                    # grid > 0 = off
rs.ShowGridAxes(None, 1)                                # y/y/z axen display > 0/1 = off/on
rs.ViewDisplayMode(view=None, mode="Ghosted")			# shadeMode fuer current view
rs.Command("cplane w t enter", 0)						# cPlane World Top
dm.printDisplay(0)                                      # nomen est omen

rs.EnableRedraw(0)                                      ### 4_the_MACs: try 0/1 !
rs.UnselectAllObjects()
dm.newEmptyLayer( "Default")
dm.newEmptyLayer( "LODGE", [32, 32, 32] )
dm.newEmptyLayer( "LODGE::crv", [200,  20, 20] )
dm.newEmptyLayer( "LODGE::pnt", [ 100,  100, 100] )
### dm.newEmptyLayer( "LODGE::srf", [ 100,  100, 200] ) ### nixi_dixi :)
dm.newEmptyLayer( "LODGE::tmp",  [120,  120, 200] )
rs.Redraw()

def info():
    ##############################################
    """ LODGE
    Generate a small archetypal house, distorted along perspective algorithms
    A setup for the development of individual panels
    Inspired by
      Albrecht Duerer's "Underweysung" (1525)
      https://de.wikipedia.org/wiki/Perspektive#Geschichte
      https://en.wikipedia.org/wiki/Albrecht_Duerer
    And
      MVRDVs "Porterlodges for the National Park De Hoge Veluwe" (1996)
      https://mvrdv.com/projects/167/hoenderloo-lodge?photo=15877
      https://www.miesarch.com/work/2994
    Parameters:
      p_width (float, optional): Approx. panel width in units
      l_dist (float, optional): Approx. length of the lodge in units
      d_dist (float, optional): Approx. depth of the lodge in units
      h_dist (float, optional): Approx. height of the lodge in units
      x_pos (float, optional): Move origin of the lodge in x
      y_pos (float, optional): Move origin of the lodge in y
      d_grid (boolean, optional): Fixed depth grid on the the small sides
      d_distord (boolean, optional): Distord basic section of the house
      demo (boolean, optional): Run demo to get an object
      verbose (int, optional): talk & sleep / Print and depict generation of the lodge
    Returns:
      return[0] = list[][][] of all panels, containing groups of 4 points
      return[1] = list[][][] of just the sleeve's panels
      return[2] = list[][][] of just the right section's panels
      return[3] = list[][][] of just the left section's panels
      return[4] = list[][][] of the sections, containing groups of 5 points
      return[5] = list[][] of all the cvs on the sleeve
      return[6] = list[][] of all the cvs on the right section
      return[7] = list[][] of all the cvs on the left section
    Example:
      allData = dm.getLodge( verbose=1000, demo=1 )
      panels = allData[0]
      panels_sleeve = allData[1] // sleeve ~= hull
      panels_right = allData[2]
      panels_left = allData[3]
        sections = allData[4]
        cvs_sleeve= allData[5]
        cvs_right= allData[6]
        cvs_left= allData[7]
    ### allData = dm.getLodge( p_width=1.2, l_dist=10, d_dist=8, h_dist=6, pos_x=0, pos_y=0, d_grid=0, d_distord=1, demo=0, verbose=0 )
    """


### exec whenever ##################################
rs.CurrentLayer("LODGE::crv")                   ###
dm.allLodgeData = dm.getLodge( demo=0, verbose=0 )   ### activate this to get a new set of data
allLodgeData = dm.allLodgeData                            ### this set of data is generated @ startUp / when dm2_lib is loaded
####################################################

rs.CurrentLayer("LODGE::tmp")

if 1:                                           ### DEMO 0/1
    def myPanel( panelX ):
        pass
        rs.AddCurve( panelX, 1 )
        if i==0: dm.textDots( panelX )

    for i,panel in enumerate( allLodgeData[0]):
        pass
        myPanel( panel )

#_____________________________here you go:
def myPanel( panelX ):
    pass
    
for i,panel in enumerate( allLodgeData[0]):
    pass




#____________________________:here you end

########## EOS / EndOfScript
rs.EnableRedraw(1)  ### 4_the_MACs
dm.eDup()           ### delete duplocate objects 
dm.printDisplay(1)
rs.ZoomExtents()
rs.CurrentLayer("Default")