Cell - place scaled + rotated


The VBA method CreateCellElement2 allows to place a cell from an attached cell library.
Additional parameters allow to scale and rotate the cell with placement.

The following VBA code example shows how to use the method CreateCellElement2 and is placing a cell with name "mycell" at point (xyz) = 10,20,30 with Scale (xyz) = 2.5,2.5,1 and 45° rotation:

Option Explicit

Sub placeCellScaledAndRotated()
Dim pScale As Point3d       ' the scale of the cell
Dim pOrigin As Point3d      ' origin of cell
Dim rotat As Matrix3d       ' cell rotatiom
Dim oCell As CellElement    ' cell object
Dim sCellname As String     ' name of the existing cell from attached library

    sCellname = "mycell"
    pOrigin = Point3dFromXYZ(10, 20, 30)
    pScale = Point3dFromXYZ(2.5, 2.5, 1) ' cell will be scale in x and y direction with factor 2.5
    rotat = Matrix3dFromAxisAndRotationAngle(2, Pi / 4)  ' 45° rotation about z (axis = 2)
    Set oCell = CreateCellElement2(sCellname, pOrigin, pScale, True, rotat) ' creating cell
    ActiveModelReference.AddElement oCell   ' Adding cell (place cell) into active model
End Sub

After the cell is placed the properties dialog shows the expected value: