找回密码 注册 QQ登录
一站式解决方案

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?快速3D打印 手板模型CNC加工服务在线3D打印服务,上传模型,自动报价
12
返回列表 发新帖
打印 上一主题 下一主题

[求助] 工程图的矩阵转换

[复制链接]
11
发表于 2011-5-30 15:06:46 | 只看该作者
10# hyccai

好像在裝配件下沒有各零件的矩陣關係
只能用 ProAsmcomppathTrfGet取得零件與裝配件的矩陣關係
在自己去換算了
12
发表于 2011-6-1 12:26:27 | 只看该作者
11# hust65 谢谢,论坛上的段代码,能不能帮看下错在哪
int UsrCreateSheet()
{   
ProError status;
    ProDrawing drawing;
    int sheet;
    ProSolid solid;
    ProVector pos,outpos;
    ProView view, pview;
    ProVector outline[2];
    ProMatrix matrix,inv_matrix,tem_matrix;
ProName   w_size;
ProMdlType type = PRO_PART;
wchar_t   wname[PRO_LINE_SIZE];
//char fname[30] = "sheets.txt";
    //FILE *fp=fopen(fname, "w");
/*--------------------------------------------------------------------*\     
Create a new sheet and make it current
\*--------------------------------------------------------------------*/
    status = ProMdlCurrentGet((ProMdl)&drawing);
    ProDrawingSheetCreate(drawing, &sheet);
    ProDrawingCurrentSheetSet(drawing, sheet);
/*--------------------------------------------------------------------*\     
Add a solid to the drawing
\*--------------------------------------------------------------------*/     
    ProStringToWstring(wname,"D:\\debuggingprogram\\cycs\\chabei.prt");
    ProMdlRetrieve(wname,type,(ProMdl*)&solid);
    ProDrawingSolidAdd(drawing, solid);
/*--------------------------------------------------------------------*\
Create a general view from the Z axis direction
\*--------------------------------------------------------------------*/
    ProUtilMatrixCopy(NULL, matrix);
    pos[0] = 200.0;
    pos[1] = 600.0;
    pos[2] = 0.0;

ProDrawingSheetTrfGet (drawing, 1, w_size, matrix);
ProUtilMatrixInvert(matrix,inv_matrix);
    ProUtilPointTrans(inv_matrix,pos,outpos);
ProPntTrfEval (pos, inv_matrix, outpos);
//我发现下面的status返回PRO_TK_GENERAL_ERROR,但是不知道是错在哪了
    status=ProDrawingGeneralviewCreate(drawing, solid, sheet, PRO_B_FALSE,
                outpos, 0.5, matrix, &view);

/*--------------------------------------------------------------------*\     
Get the position and size of the new view
\*--------------------------------------------------------------------*/
   ProDrawingViewOutlineGet(drawing, view, outline);
/*--------------------------------------------------------------------*\     
Create a projected view to the right of the general view
\*--------------------------------------------------------------------*/
    pos[0] = outline[1][0] + (outline[1][0] - outline[0][0]);
    pos[1] = (outline[0][1] + outline[1][1]) / 2.0;
    pos[2] = 0.0;
    ProDrawingProjectedviewCreate(drawing, view, PRO_B_FALSE, pos,
           &pview);
/*--------------------------------------------------------------------*\     
Create a projected view below the general view
\*--------------------------------------------------------------------*/
    pos[0] = (outline[0][0] + outline[1][0]) / 2.0;
    pos[1] = outline[0][1] - (outline[1][1] - outline[0][1]);
    ProDrawingProjectedviewCreate(drawing, view, PRO_B_FALSE, pos,
           &pview);
    return(1);
}

本帖最后由 hyccai 于 2011-6-1 12:28 编辑
13
发表于 2011-6-2 13:31:23 | 只看该作者
找到错在哪了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2025-2-3 09:06 , Processed in 0.021988 second(s), 9 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2025 www.iCAx.org

快速回复 返回顶部 返回列表