NX二次开发 UFUN根据视图名称获得视图矩阵 uc6433
//NX8.0+VS2010
#include <uf_assem.h>
#include <uf_part.h>
#include <uf_obj.h>
#include <uf_modl.h>
#include <uf_view.h>
#include <uf_draw.h>
//根据视图名称获得视图矩阵
bool AskViewMtx(const string sViewName, double mtx_3d[9])
{
char str[133] = "";
double values[9] = { 0.0 };
string temp;
temp = Trim(sViewName);
UF_MTX3_identity(mtx_3d);
if (0 == (int)temp.length())
{
if (uc6433("", values))
return false;
}
else
{
sprintf_s(str, "%s", temp.c_str());
if (uc6433(str, values))
return false;
}
double x_vec[2][3] = { 0.0 }, y_vec[2][3] = { 0.0 };
x_vec[0][0] = values[0];
x_vec[0][1] = values[1];
x_vec[0][2] = values[2];
y_vec[0][0] = values[3];
y_vec[0][1] = values[4];
y_vec[0][2] = values[5];
VEC3_unitize(x_vec[0], x_vec[1]);
VEC3_unitize(y_vec[0], y_vec[1]);
if (UF_MTX3_initialize(x_vec[1], y_vec[1], mtx_3d))
UF_MTX3_identity(mtx_3d);
return true;
}