Coordinate modification z of a complex shape

I resume this old discussion of 2016 and I ask .... in the event that we find a complex form (MSDelementtyPecomplexshape) how the function should be changed to be able to elevate a shape that contains two arches and two lines.

Option Explicit

Sub TestMoveShape()

    Dim elemId As DLong
    elemId = DLongFromLong(1307192)
    
    Dim el As Element
    Set el = ActiveModelReference.GetElementByID(elemId)
    
    If (msdElementTypeShape = el.Type) Then
        processShape el.AsShapeElement
    End If
    
End Sub

Private Sub processShape(shape As ShapeElement)

    Dim numOfVertices As Long
    numOfVertices = shape.VerticesCount
    
    Dim index As Long
    
    For index = 1 To numOfVertices
        shape.vertex(index) = moveVertex(shape.vertex(index))
    Next
    
    shape.Rewrite

End Sub

Private Function moveVertex(vertex As Point3d) As Point3d

    Const zVal = 53.65
    
    moveVertex = vertex
    moveVertex.Z = zVal

End Function

Parents Reply
  • Hey Jan,

    Thank you for your quick reply. I do apologize for not formatting the code properly - will keep that in mind.

    You are probably right, I might have used the wrong 3dMatrix component. I am just looking for something that would do a translation along the Z axis (no rotation or scaling) and I was trying different things, in hope that something will work. I know I should multiply the Matrix3dIdentity by a translation matrix, but I am not sure what is the exact matrix that does that.

    Best regards,
    Paul

Children
No Data