Odd Behavior...Python Discontinuity/Scale

Hi, not sure how to title this.

I am getting an error when I extend two rectangles (one initial and a scaled version). For some reason, after I scale, the larger rectangle loses its dimensions. I think it may have to do with how I am calculating the discontinuities of the rectangle before? Thank you.

import rhinoscriptsyntax as rs

a = []

def squares(p0, depth):
    if depth > 1:
        depth -= 1
        
        vect = rg.Vector3d(0,0,1)
        rect = rs.AddRectangle(rs.WorldXYPlane(),size,size)
        lines = rs.ExplodeCurves(rect)
        
        for line in lines:
            points = []
            endPts = rs.CurveEndPoint(line)
            pts = rs.AddPoint(endPts)
            points.append(pts)
            print points
            
        scale = rs.ScaleObject(rect, points[0], (.33, .33, 0))
        a.extend([rect,scale])


def main():
    size = 5
    p0 = rs.AddPoint(0,0,0)
    plane = rg.Plane.WorldXY
    squares(p0, 2)
    
main()

Some initial mistakes - I can’t get it to run - in your def squares, you use a variable size but it’s not defined anywhere, while you also have p0 and depth which are passed in but not used for anything… Maybe you can fix your code…

–Mitch

Thanks Mitch,

I messed up the code a bit as it was prepared for GH Python. Here is the updated version. Still problematic. I attempted to use the rs.curvedisconinuity method, but it only returns 3 pts of the rect.

import rhinoscriptsyntax as rs
import Rhino.Geometry as rg

a = []

def square():
    
    p0 = rs.AddPoint(0,0,0)
    rect = rs.AddRectangle(rs.WorldXYPlane(),10, 10)
    lines = rs.ExplodeCurves(rect, False) 
    
    for line in lines:
        pts = []
        points = rs.CurveEndPoint(line)
        pts.append(points)
        print pts
        
    newRect = rs.ScaleObject(rect, pts[-1], (.33,.33,0))
    a.extend([rect,newRect])
    
square()