Vector2D

The Vector2D class is a data holder for a 2D vector. The Vector2D is internally represented by a x and y value. The value unit is mm.

There are the following groups of member functions with some examples of use:

  • construct the vector
    import NemAll_Python_Geometry as AllplanGeo
    
    vector1 = AllplanGeo.Vector2D()
    vector2 = AllplanGeo.Vector2D(1000, 2000)
    vector3 = AllplanGeo.Vector2D(vector2)
    ...
    
  • set and get the values
    vector1.X = 500
    vector1.Y = vector2.Y
    angle     = vector1.GetAngle()
    length    = vector1.GetLength()
    ...
    
  • changing the vector by basic mathematical operations like +, -, * and /
    vector4 = vector2 + vector3
    vector2 -= vector3
    vector5 = vector3 / 2
    ...
    
  • comparing vectors
    if vector2 == vector3:
       ...
    ...
    
  • general vector utilities like cross product, normalize, …
     vector3 = vector1.CrossProduct(vector2)
     dot_res = vector1.DotProduct(vector2)
    
     vector3.Normalize(1000)
     vector3.Reverse()
    ...
    
The Vector2DList class is a special list for Vector2D objects and can be used like
vector_list = AllplanGeo.Vector2DList()
vector_list.append(vector1)
vector_list.append(vector2)
vector_list.append(vector3)

The complete documentation of the members from the Vector2D and Vector2DList class can be found here: