Parametric moving, rotating and scaling

Is there any way to move, rotate and scale an object with storing its beginning position and the values which are needed to move, rotate and scale to its final position?

I align scans to the ground after exporting them from the scanning software. If I do re-export some parts of scans then I have to align all scans again because I don’t know the exact movement values of all objects related together. So I need the move all related objects from scratch. If movement and rotation would be stored then I would paste those values to a new imported scan and it would move into demanded position. For now, I`m doing it in Modo but I think how to do it in Rhino because I think it will have better handling of 60mln poly. Do you have some other tricks than GH to store movement, scale and rotation in parametric fashion?

you could write yourself a macro

When I will trigger macro after movement/rotate/scale then it won’t have access to the previous position, rotation and scale values.

Use either NamedPosition command or Bongo plugin. Bongo can also animate the movements and it can make videos of the animations. (Snapshots command is similar to the NamedPosition command.)

NamedPosition looks nice but please tell me how can I later read the current position/rotation of the object to apply the same to another object?

Use Orient3Pt command.

Thanks. I see that NamedPosition + Orient3Pt will do almost what I wanted to reach.

Please tell me is there any way to read that movement and rotation Orient3Pt did. I mean exact absolute values of movement and rotation between the beginning and the end? Is there any trick for that? With reading those values I can re-do them in other software only putting those values of movement and rotation.

You have to use something as reference. For example, you can make a triangle on separate layer that is generally hidden. This triangle defines original orientation of your first object. You can measure distance and angle with Distance command and Angle command.

1 Like

When I import a scan of a boat I create a small object with three lines, one parallel to the x-axis, one parallel to the y-axis, and one parallel to the z-axis. Each line is a different length, usually with the x-axis line being the longest and the z-axis the shortest. For example the x-axis may be 30 units long, the y-axis 20 units, and the z-axis 10 units. I put the lines on a separate layer named “Scan Axis Import” or similar, and Group the lines. I copy the layer with the lines with a new name such as “Scan Axis Revised”, and then usually lock the original layer to make it difficult to lines the original set of lines.

When I move, rotate or scale the scan I also make sure to also move, rotate or scale the axis lines.

To change any object back to correspond to the orientation and position of the scan when imported I use Orient3Pt using the ends axis as the input reference and target points.

Block instances can be used since they contain their transformation matrix. When you manually transform your starting geometry, include a block instance that begins with an identity transformation such as RefAxes.3dm (23.4 KB).

Then use
rhinopython/spb_transformPerBlockInstance.py at master · CADacombs/rhinopython · GitHub
to transform subsequent imported geometry.

TransformPerBlockInstance

1 Like

Thanks for those commands. I haven`t known that is possible to use them in that case.

Thanks for sharing your workflow. it’s very important to me to know how others work with scans in Rhino. It`s not a very popular thing.

It’s funny because today I was on your github and I watched your scripts library and I`ve thought how much titan work you did with creating all that amazing stuff :slight_smile:

You are doing brilliant work with your scripts.

I have a few questions about your current script:

  1. Is there any place where I could read that transformation matrix done over blocks (to copy that data and move to other software)?

  2. Does it work in that way?
    a) - import scan to Rhino
    b) - change 3d scan to block instance
    c) - move it how you like
    d) - import same 3d scan after revision (something changes there)
    e) - fire your script
    f) - click on old version to copy position and rotation from old one to a new one.
    Have I understood it well?

  1. You can view the block instance’s transformation matrix [TM] with _What. Once you learn how to use the matrix in other software, a script in Rhino can be created to print or export the matrix in a more compatible format.
  2. You can use it the way you described, but you can instead include a reference block when you “move it how you like”.
    a) import scan to Rhino
    b) _Import the RefAxes.3dm from my previous message. It is already a block instance with an identity TM.
    c) move geometry with reference block instance how you like
    d) import same 3d scan after revision (something changes there)
    e) fire the script
    f) Pick revised geometry, pick Identity option for starting TM, then pick translated reference block instance for the ending TM.
2 Likes

Thanks a lot :slight_smile:

I work with scanned boats as well, I usually pick a known point on the Scan and draw a line to 0,0,0.
I then move the scan along that line to 0,0,0. … SAVE THE LINE !
I do the same thing with rotation. I best fit a line from the mid stern to the bow, then use that to straighten the boat. Keep a copy of the line if you need to undo the rotation.
Mike.

1 Like

Note that if you work with something like Orient3Pt (combination translation and rotation) you can do the following without using blocks:

Define 3 original location points (like you would in Orient3Pt)
Create and name a custom CPlane with these three origin points
Decide the 3 destination points
(do your Orient here or later, doesn’t matter)
Create and name a custom CPlane with these three destination points

Then anytime you import new geometry or need the same translation (plane-to-plane) simply select the object(s) and use RemapCPlane. Then same plane-to-plane transformation will be executed on the selected objects. The custom named planes are saved in the file, so you have access to them anytime.

1 Like

@Helvetosaur Does the remap to Cplane method work when scaling is involved?

No, of course not, it’s a simple (rigid) Euclidean transformation. But despite the thread title, I assumed that for aligning scan data fragments, scaling may neither be needed nor desired…

I’m curious about that rotation line cause when you create that line you don`t know yet if that line length is enough for proper rotation. When the line is longer than you need then you don’t know in which exact place have you finished your rotation. Maybe I understand it badly. May you show it somehow?