[python] custom scale or (BREP SOLID OFFSET)

Is there a way to set the scale in such a way that if the closed solid has an opening scaling the object would scale the opening as well.

in such a way that if the solid is scaled with factor larger than one the opening gets smaller with the scale-factor?

As if the original solid has been covered by a layer of foam (including the edge of the opening).

Can you give me some guidance what method to use?

Thanks in advance.

I think you’ll need to provide an illustration for this one

Thanks for the reply @dharman,

This is what I mean:

This is kind of expanding the material in all directions (in case of opening inwards)

Perhaps not scale but offset would be the way to go. :thinking:

Why can’t you use OffserSrf? In rhinocommon it’s Brep.CreateOffsetBrep

Is it your intent that the outer offset you show is not uniform?

1 Like

Thanks I guess this is exactly what I need.

Though, I can’t make it work:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

tol=sc.doc.ModelAbsoluteTolerance


def offset_brep():
    objid = rs.GetObject(message=None, filter=0, preselect=False, select=False, custom_filter=rs.filter.polysurface, subobjects=False) 
    brepobj = rs.coercebrep(objid)
    print type(brepobj)
    offsetbrep = brepobj.CreateOffsetBrep(brep=brepobj,distance=5.0, solid=False, extend=True, tolerance=tol)
    print type(offsetbrep)
    print offsetbrep
    #offsetbrep = Rhino.Geometry.Brep.CreateOffsetBrep(brep=brepobj, distance=20.0, solid=True, extend=True, tolerance=tol)
    #print offsetbrep
    if len(offsetbrep) == 1:
        sc.doc.Objects.AddBrep(offsetbrep)
    else:
        print "can't close the offset"
        return

offset_brep()

I did it:

import rhinoscriptsyntax as rs
import scriptcontext as sc

tol=sc.doc.ModelAbsoluteTolerance


def offset_brep():
    objid = rs.GetObject(message=None, filter=0, preselect=False, select=False, custom_filter=rs.filter.polysurface, subobjects=False) 
    brepobj = rs.coercebrep(objid)
    offsetbrep = brepobj.CreateOffsetBrep(brep=brepobj,distance=5.0, solid=False, extend=True, tolerance=tol)
    sc.doc.Objects.AddBrep(offsetbrep[0][0])


offset_brep()
1 Like