Change the columns as the diameter increases.
Takahiro Yamaguchi
Member, Employee Posts: 12
✭✭✭
I'm researching an approach with script in SpaceClaim to work parametrically change columns from 3-5-7 to become columns 4-6-8 or 5-7-9 etc as the diameter increases. Does anyone have similar solution with script?
Tagged:
0
Comments
-
@Gabriel Messager might have an idea ?
0 -
@Takahiro Yamaguchi
Here is an example:import math ClearAll() def create_cylinder(startPoint, endPoint, radius): direction = (endPoint - startPoint).Direction.ArbitraryPerpendicular pt1 = startPoint pt2 = endPoint pt3 = endPoint + (direction.UnitVector * radius) result = CylinderBody.Create(pt1, pt2, pt3) radius_large_cylinder = MM(60) radius_small_cylinder = MM(5) distance_axis = MM(15) nb_small_cylinders = 2*int((radius_large_cylinder-radius_small_cylinder*1.1)/distance_axis)+1 for i in range(nb_small_cylinders): startPoint = Point.Create(math.copysign(distance_axis*int(i/2+ i%2), i%2-0.5), 0, 0) endPoint = Point.Create(startPoint.X, startPoint.Y, MM(5)) create_cylinder(startPoint, endPoint, radius_small_cylinder) for i in range(nb_small_cylinders-2): startPoint = Point.Create(math.copysign(distance_axis*int(i/2+ i%2), i%2-0.5), distance_axis, 0) endPoint = Point.Create(startPoint.X, startPoint.Y, MM(5)) create_cylinder(startPoint, endPoint, radius_small_cylinder) startPoint = Point.Create(math.copysign(distance_axis*int(i/2+ i%2), i%2-0.5), -distance_axis, 0) endPoint = Point.Create(startPoint.X, startPoint.Y, MM(5)) create_cylinder(startPoint, endPoint, radius_small_cylinder) for i in range(nb_small_cylinders-4): startPoint = Point.Create(math.copysign(distance_axis*int(i/2+ i%2), i%2-0.5), distance_axis*2, 0) endPoint = Point.Create(startPoint.X, startPoint.Y, MM(5)) create_cylinder(startPoint, endPoint, radius_small_cylinder) startPoint = Point.Create(math.copysign(distance_axis*int(i/2+ i%2), i%2-0.5), -distance_axis*2, 0) endPoint = Point.Create(startPoint.X, startPoint.Y, MM(5)) create_cylinder(startPoint, endPoint, radius_small_cylinder) create_cylinder(Point.Origin, Point.Create(0, 0, -MM(30)), radius_large_cylinder)
0