Move a model along a straight line by script

Dear friends
I have creat a model by Slicer, I can get the model’s node ID,

now I want to move the model along a straight line by script, let the direction of movement is parallel to this line.

I can creat a line by Markups module, then get the line’s nodeID.

or I just get two points’RAS on the line

Anyone can tell me how to write a python script? Thank you!

You should be able to copy the way the endoscopy module does this. Look for the self.transform and how it is used to move the cursor model along the path.

1 Like