Jump to content

How to create facet point component with variable number of coordinates?


---
 Share

Recommended Posts

Dear GOM-Team,

as mentioned above I like to create a facet point component from predifined coordinates. This works fine for a fixed number of coordinates:

xPointList = [ 64, 64, 64, 64, 64, 30, 20, 30]             
yPointList = [ 125, 110, 200, 20, 280, 152, 20, 30]

MCAD_ELEMENT=gom.script.deformation.create_facet_point_component (
    computation={'accuracy': 0.04, 'break_accuracy_linked_facets': -1.0, 'break_accuracy_single_facets': 0.01, 'max_intersection_deviation': 0.3, 'max_iteration_number': 20, 'max_residual': 20.0, 'max_sampling_points': 0, 'min_iteration_number': 3, 'min_pattern_quality': 1.100000024, 'subpixel_interpolation': 'bilinear'}, 
    facet_size=fSize, 
    image_point_list=[{'pixels': [{'image': {'camera': 0, 'measurement': gom.app.project.measurement_series['Deformation 1'].measurements['D1']}, 'pixel': gom.Vec2d (xPointList[0], yPointList[0])}]},  # 54.34352183, 32.90344292
    
    {'pixels': [{'image': {'camera': 0, 'measurement': gom.app.project.measurement_series['Deformation 1'].measurements['D1']}, 'pixel': gom.Vec2d (xPointList[0], yPointList[0])}]},
    {'pixels': [{'image': {'camera': 0, 'measurement': gom.app.project.measurement_series['Deformation 1'].measurements['D1']}, 'pixel': gom.Vec2d (xPointList[1], yPointList[1])}]},
    {'pixels': [{'image': {'camera': 0, 'measurement': gom.app.project.measurement_series['Deformation 1'].measurements['D1']}, 'pixel': gom.Vec2d (xPointList[2], yPointList[2])}]},
    {'pixels': [{'image': {'camera': 0, 'measurement': gom.app.project.measurement_series['Deformation 1'].measurements['D1']}, 'pixel': gom.Vec2d (xPointList[3], yPointList[3])}]},
    {'pixels': [{'image': {'camera': 0, 'measurement': gom.app.project.measurement_series['Deformation 1'].measurements['D1']}, 'pixel': gom.Vec2d (xPointList[4], yPointList[4])}]},
    {'pixels': [{'image': {'camera': 0, 'measurement': gom.app.project.measurement_series['Deformation 1'].measurements['D1']}, 'pixel': gom.Vec2d (xPointList[5], yPointList[5])}]},
    {'pixels': [{'image': {'camera': 0, 'measurement': gom.app.project.measurement_series['Deformation 1'].measurements['D1']}, 'pixel': gom.Vec2d (xPointList[6], yPointList[6])}]},
    {'pixels': [{'image': {'camera': 0, 'measurement': gom.app.project.measurement_series['Deformation 1'].measurements['D1']}, 'pixel': gom.Vec2d (xPointList[7], yPointList[7])}]}],     
    
    incremental_facet_matching=False, 
    measurement_series=gom.app.project.measurement_series['Deformation 1'], 
    name='Facettenpunktkomponente 1', 
    pattern_recognition='standard', )

Unfortunately I wasn't able to adopt the "image_point_list"-variable to mach variable sizes of the coordinate lists above. (I tried to buid a str-list from the coordinates first or uesed the "exec"-command)

Do you have any recommendations to fix this problem?

 

Thank you very much,

Steffen

Edited
Link to comment
Share on other sites

Problem solved! 

I didn't remenber the "eval"-command to convert string to python source code:

for i in range(len(xPointList)):
    gom_coordinate = "{'pixels': [{'image': {'camera': 0, 'measurement': gom.app.project.measurement_series['Deformation 1'].measurements['D1']}, 'pixel': gom.Vec2d (" + str(xPointList[i]) + ", " + str(yPointList[i]) + ")}]}" 
    print(gom_coordinate)
    point_list.append(eval(gom_coordinate))
    
    
MCAD_ELEMENT=gom.script.deformation.create_facet_point_component (
    computation={'accuracy': 0.04, 'break_accuracy_linked_facets': -1.0, 'break_accuracy_single_facets': 0.01, 'max_intersection_deviation': 0.3, 'max_iteration_number': 20, 'max_residual': 20.0, 'max_sampling_points': 0, 'min_iteration_number': 3, 'min_pattern_quality': 1.100000024, 'subpixel_interpolation': 'bilinear'}, 
    facet_size=fSize, 
    image_point_list = point_list,     
    incremental_facet_matching=False, 
    measurement_series=gom.app.project.measurement_series['Deformation 1'], 
    name='Facettenpunktkomponente 1', 
    pattern_recognition='standard', )

Now, everything works fine.

Thnak you.

Link to comment
Share on other sites

 Share

×
×
  • Create New...