Scripting a Site

Hi, I am very new to scripting and thought it would be a good test for me to try and write a script to help with creating a simple site from an imported AutoCAD drawing. Basically I am extruding curves (selected by their layer name) through a surface (user defined), and spliting the surface using the extrusion as a cutting object. Then taking the split surface and offsetting it up to create a curb/sidewalk/grass area etc…

The problem is that when it splits the brep(surface) it does not do it clean. so the new split surface does not match up with the surface below it. and many times that shows through to upper surface.

I am not sure I explained that well at all, but either way here is the code:

import rhinoscriptsyntax as rs

Surface = rs.GetObject("Select Surface",8)


LayerData = [["--CURB",.5],["--SIDEWALK",.6],["--GRASS",.7]]

for Item in LayerData:
    CrvList = rs.ObjectsByLayer(Item[0],True)
    
    ExtList = []
    SplitList = []

    rs.EnableRedraw(False)

    for Curves in CrvList:
            Ext = rs.ExtrudeCurveStraight(Curves,[0,0,0],[0,0,-1000])
            Split = rs.SplitBrep(Surface,Ext,False)
            rs.DeleteObject(Split[0])
            SplitList.append(Split[1])
            rs.DeleteObject(Ext)
            rs.OffsetSurface(Split[1],Item[1],None,False,True)

I am guessing I should be doing this in a much different way. Any help is much appreciated!

Thanks!

My first thought is that this is an issue with the rendermesh settings. Try setting the mesh to smooth & slower or a custom setting.

Another issue might be the geometry is far from the world origin. What happens if you move it closer to the origin.

-Willem

It would be nice to have those mesh setting available as Python methods.

Last time I checked they were not implemented yet.

Dan

The rendermesh setting was the issue! Thanks Willem, you’re a genius!

-Dan

1 Like