node = hou.pwd()
geo = node.geometry()

# Add code to modify contents of geo.
# Use drop down menu to select examples.


#initialize the attributes from the map
blockType = geo.addAttrib(hou.attribType.Point, "blockType", "")
pointColor = geo.addAttrib(hou.attribType.Point, "Cd", (0.0, 0.0, 0.0))
#retrive the point groups from the map
pointGroups = geo.pointGroups()
#get the commercial group and set the color to green, then append "add" to list
commercialGroup = []


for group in pointGroups: #call pointGroup
    if group.name() == "commercialGroup": #if you name is commGroup
        for point in group.points(): #for each point in group
            point.setAttribValue("Cd", (0.0, 1.0, 0.0)) #set Cd to green
            commercialGroup.append(point.number()) #add the point to commGroup

            
#set the block type attributes
for point in geo.points(): #geo.points fetches all the points
    if point.number() in commercialGroup:#if the point number is in commGroup
        point.setAttribValue("blockType", "commercial") #set commercial
    elif point.number() not in commercialGroup: #if not set type to houses
        point.setAttribValue("blockType", "houses")
    else:
        pass 


node = hou.pwd()
geo = node.geometry()

# Add code to modify contents of geo.
# Use drop down menu to select examples.


#make the origin block position variable and initialize
originBlockPos = geo.addAttrib(hou.attribType.Point, "originBlockPos", (0.0, 0.0, 0.0))


#set original block pos for each point and move to center
for point in geo.points():
    position = point.position() #fetches the position of each point and stores it in variable
    point.setAttribValue("originBlockPos", position) #set attribVallue to position
    center = (0.0, 0.0, 0.0) #center position
    point.setPosition(center) #sets position of points and pass to center