Q : GH Python, Trimmed Surface in, Untrimmed Surface out

Hi there,

I tried to sort surfaces order and append those to a new list of surfaces.
Original surfaces are trimmed, but once appended, turned to be untrimmed surfaces.
I guess it is because of object type. I dont try yet but brep objects might not make any problem in same operation. I still wonder if there is a way to get trimmed surface without changing object type.
Please find attached files and give me some help.

Thanks,
PJ

test.gh (6.7 KB)
test_00.3dm (204.1 KB)

Hi Lepli
You should use rs.SurfaceAreaCentroid and rs.IntersectBreps function.
like this


I rarely use the ghpythonlib.components module,Because the ghpythonlib.components module is prone to errors.It is recommended to use the rhinocommon SDK or rhinoscriptsyntax module.
I hope this help you.
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
import ghpythonlib.components as gh

class fingerEDGE :
    
    def __init__(self, srf, srfID, thick, fSIZE, counterSrfList, counterSrfs):
        
        ##crvSelf = item
        ##crvOthers = list
        
        self.srf = srf
        self.srfID = srfID
        self.thick = thick
        self.fSIZE = fSIZE
        self.counterSrfList = counterSrfList
        self.counterSrfs = counterSrfs
        
        self.fingerIN = []
        self.fingerOUT = []
        
        
        #self.midpt = gh.Area(srf)[1]
        #uv = rs.SurfaceClosestPoint(srf, self.midpt)
        #self.nVec = rs.SurfaceNormal(srf, uv)
        #self.cpln = rs.PlaneFromNormal(self.midpt, self.nVec)
                        
        
    def fingerIN (self, srf, srfID):
        mid = rs.SurfaceAreaCentroid(srf)[0]
        #mid = gh.Area(srf)[1]
        print mid
        uv = rs.SurfaceClosestPoint(srf, mid)
        srfVec = rs.SurfaceNormal(srf, uv)
        srfCpln = rs.PlaneFromNormal(mid, srfVec)
        secLine = rs.IntersectBreps(self.srf,srf,0.001)[0]
        #secLine = gh.BrepXBrep(self.srf, srf)[0]
        pts = rs.DivideCurveLength(secLine, self.fSIZE)
        
        spt = pts[2]
        ept = pts[len(pts)-3]
        
        

classList = []


for i in range(len(srfs)):
    srfListNum = []
    counterSrfList = []
    interSecLine = []
    for j in range(len(srfs)):
        if i != j :
            test = rs.IntersectBreps(srfs[i], srfs[j],0.001)
            if test :
                srfListNum.append(j)
                counterSrfList.append(srfs[j])
    
    classList.append(fingerEDGE(srfs[i], i, thick, fSIZE, srfListNum, counterSrfList))
    

a = classList

b = srfs

test.gh (6.6 KB)

Did Naruto’s answer help you with this problem?