Hi Mehdi,
Great question.
The task to align computes the alignment, but doesn't apply it to the model.
When using alignment, you should listen for the response. The output from the response (if successful) will give you the transformation that you can then apply to the model.
Here's an example of the task to align
{"
Task":{
"Index":25,
"Type":"Align",
"Input":{
"source":18,
"target":19,
"rough":{
"method":"Ransac"
},
"fine":{
"method":"ICP"
}
}
}
}
And here is the response
{
"Task":{
"Index":25,
"Input":{
"fine":{
"method":"ICP"
},
"rough":{
"method":"Ransac"
},
"source":18,
"target":19
},
"Output":{
"rotation":[0.0005511405177050501,-0.00027000695495325454,0.00048314887313871024],
"translation":[-0.018215706469504767,0.008557386007080225,0.042987728096079536]
},
"State":"Completed",
"Type":"Align"
}
}
You'll notice there is a rotation and a translation component to the output. To apply this alignment to your project, simply call `TransformGroup` with the same ids of the groups, and the transform from the alignment.
{
"Task":{
"Index":27,
"Type":"TransformGroup",
"Input":{
"index":18,
"color":[],
"rotation":[0.0005511405177050501,-0.00027000695495325454,0.00048314887313871024],
"translation":[-0.018215706469504767,0.008557386007080225,0.042987728096079536]
}
}
}
Here is some Python code as an example:
# Run alignment on the project
print("Starting alignment...")
align_task = scanner.align(19, 14, rough=Align.Rough(method=Align.Rough.Method.Ransac))
if align_task.Error:
print(f"Error running alignment: {align_task.Error}")
return
print (align_task.Output);
transform_task = scanner.transform_group(19, translation=align_task.Output['translation'], rotation=align_task.Output['rotation'])
if transform_task.Error:
print(f"Error transforming group: {transform_task.Error}")
return
print (transform_task.Output);
print("Alignment completed successfully!")
Please see the full python code for more examples