Example #1
0
void OrthoViews::set_primary(gp_Dir facing, gp_Dir right)   // set the orientation of the primary view
{
    primary.SetDirection(facing);
    primary.SetXDirection(right);
    gp_Dir up = primary.YDirection();

    // compute dimensions of part when orientated according to primary view
    width = abs(right.X() * bbox.LengthX() + right.Y() * bbox.LengthY() + right.Z() * bbox.LengthZ());
    height = abs(up.X() * bbox.LengthX() + up.Y() * bbox.LengthY() + up.Z() * bbox.LengthZ());
    depth = abs(facing.X() * bbox.LengthX() + facing.Y() * bbox.LengthY() + facing.Z() * bbox.LengthZ());

    if (views.size() == 0)
        add_view(0, 0);
    else
    {
        views[0]->set_projection(primary);
        set_all_orientations();                 // reorient all other views appropriately
        process_views();
    }
}