Esempio n. 1
0
def makeDrains():
    drainLayers = ['openchannels',
              'gravitymains',
              'lateraldrains',
              ]
    drainColors = [
            System.Drawing.Color.MidnightBlue,
            System.Drawing.Color.Blue,
            System.Drawing.Color.CornflowerBlue,
            System.Drawing.Color.SkyBlue,
            ]

    for i in range(len(drainLayers)):
        lyr = drainLayers[i]
        newName = lyr+'-projected'
        lyrAtt = LayerUtils.layerAttributes(newName, drainColors[i]) # make the layer
        # get results
        resultPairs = IntersectionTools.smartCurveLayerProject(lyr, 'groundsurface', lyrAtt)
        # bake results
        for pair in resultPairs:
            scriptcontext.doc.Objects.AddCurve(pair[0], pair[1])
    # get the catchbasins
    srf = doc.Objects.FindByLayer('groundsurface')[0].Geometry
    rawPts = Smart.RhinoObjectsToSmartFeatures(doc.Objects.FindByLayer('catchbasins'))
    pt3ds = [pt.geom.Location for pt in rawPts]
    lowPts = Smart.replaceGeometries(rawPts, pt3ds)
    smrtPts = IntersectionTools.smartPointProject(lowPts, srf)
    newPts = [pt.geom for pt in smrtPts]
    circles = GeomTools.pointsToCircles(newPts, 0.5)
    smrtCircles = Smart.replaceGeometries(smrtPts, circles)
    lyrAtt = LayerUtils.layerAttributes('catchbasins-projected', drainColors[3])
    for circle in smrtCircles:
        doc.Objects.AddCircle(circle.geom, circle.objAttributes(lyrAtt))
Esempio n. 2
0
def makeDrains():
    drainLayers = [
        'openchannels',
        'gravitymains',
        'lateraldrains',
    ]
    drainColors = [
        System.Drawing.Color.MidnightBlue,
        System.Drawing.Color.Blue,
        System.Drawing.Color.CornflowerBlue,
        System.Drawing.Color.SkyBlue,
    ]

    for i in range(len(drainLayers)):
        lyr = drainLayers[i]
        newName = lyr + '-projected'
        lyrAtt = LayerUtils.layerAttributes(newName,
                                            drainColors[i])  # make the layer
        # get results
        resultPairs = IntersectionTools.smartCurveLayerProject(
            lyr, 'groundsurface', lyrAtt)
        # bake results
        for pair in resultPairs:
            scriptcontext.doc.Objects.AddCurve(pair[0], pair[1])
    # get the catchbasins
    srf = doc.Objects.FindByLayer('groundsurface')[0].Geometry
    rawPts = Smart.RhinoObjectsToSmartFeatures(
        doc.Objects.FindByLayer('catchbasins'))
    pt3ds = [pt.geom.Location for pt in rawPts]
    lowPts = Smart.replaceGeometries(rawPts, pt3ds)
    smrtPts = IntersectionTools.smartPointProject(lowPts, srf)
    newPts = [pt.geom for pt in smrtPts]
    circles = GeomTools.pointsToCircles(newPts, 0.5)
    smrtCircles = Smart.replaceGeometries(smrtPts, circles)
    lyrAtt = LayerUtils.layerAttributes('catchbasins-projected',
                                        drainColors[3])
    for circle in smrtCircles:
        doc.Objects.AddCircle(circle.geom, circle.objAttributes(lyrAtt))