PyGeometry is failing if I increase number of loops to create a geometry

Suneel
Suneel Member Posts: 13
First Comment
**

Hi All,
I am doing an excersise to understand how much time required to create an geometry and I am comparing between standalone Sc and PyGeometry. For this excersise I have taken a simple plate with a hole geometry. The code works somthing like below

where 50 indicates number of loops.

Following is the code

`
st = time.time()

modeler = launch_modeler(mode="spaceclaim")

outer_hole_radius = Distance(0.5, UNITS.m)
j = 0
k = 0

design = modeler.create_design("ExtrudedPlate")

for i in range (50):
originX = j
oroginY = k

point1X = originX-4
point1Y = oroginY+5
point2X = originX+4
point3Y = oroginY-5

center1X = originX+3
center1Y = oroginY+4
center2X = originX-3
center2Y = oroginY-4

sketch = Sketch()
(
    sketch.segment(start=Point2D([point1X, point1Y], unit=UNITS.m), end=Point2D([point2X, point1Y], unit=UNITS.m))
    .segment_to_point(end=Point2D([point2X, point3Y], unit=UNITS.m))
    .segment_to_point(end=Point2D([point1X, point3Y], unit=UNITS.m))
    .segment_to_point(end=Point2D([point1X, point1Y], unit=UNITS.m))
    .box(
        center=Point2D([originX, oroginY], unit=UNITS.m),
        width=Distance(3, UNITS.m),
        height=Distance(3, UNITS.m),
    )
    .circle(center=Point2D([center1X, center1Y], unit=UNITS.m), radius=outer_hole_radius)
    .circle(center=Point2D([center2X, center2Y], unit=UNITS.m), radius=outer_hole_radius)
    .circle(center=Point2D([center2X, center1Y], unit=UNITS.m), radius=outer_hole_radius)
    .circle(center=Point2D([center1X, center2Y], unit=UNITS.m), radius=outer_hole_radius)
)

body = design.extrude_sketch(f"PlateLayer"+str(i), sketch, Quantity(2, UNITS.m))

board_named_selection = design.create_named_selection("Plate"+str(i), bodies=[body])

j = j+8
k = k+10

et = time.time()

elapsed_time = et - st
print('Execution time:', elapsed_time, 'seconds')

`

The code is working fine for up-to range = 50 if I increase the range values greater than 50 the code is failing, following is the error

Any idea why it is failing

Answers