ex05_cylinder
This is an example for a scripted ‘cylinder’ element.
Note
Please see offset_point_v2.md for a complete scripted elements example with detailed description.
Source code excerpt
1def dialog(context, params):
2 #[...]
3
4def calculation(context, params):
5 valid_results = False
6 # Calculating all available stages
7 for stage in context.stages:
8 # Access element properties with error handling
9 try:
10 # point = gom.Vec3d(params['point_x'], params['point_y'], params['point_z'])
11 # direction = gom.Vec3d(params['dir_x'], params['dir_y'], params['dir_z'])
12 context.result[stage] = {'default': {
13 'point': gom.Vec3d(params['point_x'], params['point_y'], params['point_z']),
14 'radius': params['radius'],
15 'direction': gom.Vec3d(params['dir_x'], params['dir_y'], params['dir_z']),
16 'inner': params['inner']
17 }}
18 context.data[stage] = {"ude_mykey": "Example 5"}
19 except Exception as error:
20 context.error[stage] = str(error)
21 else:
22 valid_results = True
23 return valid_results