cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How to create General drawing view ?

ppandarkar-2
15-Moonstone

How to create General drawing view ?

Hi..

I want to create general view for orientation of TOP_VIEW ( drawing solid orientation) but getting difficulty to pass matrix.

i am creating general drawing view by below API.

status = ProDrawingGeneralviewCreate (p_drawing, (ProSolid)comp_mdl, 2, PRO_B_FALSE, pos, 0.2, matrix2, &view);

it gives me error due to matrix, So please can anybody suggest me how to pass matrix from drawing solid orientation ( TOP_VIEW).

If any sample code is there then it is better to create general drawing view from drawing solid view orientation.

Thanks,

Prashant Pandarkar

5 REPLIES 5

Hi Prashant -

I have used many of the ProDrawing API functions, but not ProDrawingGeneralviewCreate.

Prashant Pandarkar wrote:

I want to create general view for orientation of TOP_VIEW ( drawing solid orientation) but getting difficulty to pass matrix.

i am creating general drawing view by below API.

status = ProDrawingGeneralviewCreate (p_drawing, (ProSolid)comp_mdl, 2, PRO_B_FALSE, pos, 0.2, matrix2, &view);

Where are you getting the matrix value that you use here? Are you creating it with ProMatrixInit?

it gives me error due to matrix, So please can anybody suggest me how to pass matrix from drawing solid orientation ( TOP_VIEW).

If any sample code is there then it is better to create general drawing view from drawing solid view orientation.

What error value did you get? ProDrawingGeneralviewCreate does not have a specific error code for "bad orientation matrix", so I don't know why you believe the matrix is causing the error.

Another way you could go wrong with ProDrawingGeneralviewCreate is the position argument, which should be in screen coordinates. Mouse picks are, I believe, in screen coordinates. Otherwise, if you know the position in drawing coordinates, you need

  • Get the transformation matrix using ProDrawingSheetTrfGet
  • Invert that matrix using ProUtilMatrixInvert (not part of the Pro/Toolkit API, see protoolkit/protk_appls/pt_examples/pt_utils/UtilMatrix.c)
  • Transform the point from drawing to screen coordinates using ProPntTrfEval

This is one of the biggest nuisances of working with Creo Parametric Toolkit.

If any sample code is there then it is better to create general drawing view from drawing solid view orientation.

You should have these two examples for ProDrawingGeneralviewCreate installed with Creo Parametric Toolkit:

  • protoolkit/protk_appls/pt_examples/pt_graphics/TestDrwView.c
  • protoolkit/protk_appls/pt_userguide/ptu_drawing/UgDrawingViews.c

Unfortunately, neither of them address transforming points from drawing to screen coordinates.

I hope this helps. It is a lot of work to learn how to use these functions.

|+|  M a r k  |+|

Hi Marks,

Thanks for your reply.

  • protoolkit/protk_appls/pt_examples/pt_graphics/TestDrwView.c

in this example given some matrix value which i am not able to get where they take this value.


I just want to create general drawing view from model view

e.g. from front end we create general drawing view from RMB on screen and say insert general view then select orientation method as view name from model and select model view name (FRONT /TOP/ RIGHT /LEFT etc.)


Capture.JPG


Thanks,

Prashant Pandarkar

To place a drawing view using a model view, you will need to get the orientation matrix of that particular view. Take a look at ProView object.

One possible way to do it is to use "ProViewNameToView" function to initialize the model view. Once you have the view handle use "ProViewMatrixGet" to extract the orientation matrix.

You need to work with multiple matrices and, as Mark Stallard‌ already mentioned, this is something that is not documented well enough.

Hi Gabriel,

I tried with given way by extracting orientation by "ProViewMatrixGet" and passing it in to "ProDrawingGeneralviewCreate" but it gives me general error (- 1) after run the application.

Regards,

Prashant Pandarkar

try this between "ProViewNameToView[from 3d model]+ProViewMatrixGet[from 3d model]" and "ProDrawingGeneralviewCreate(in draw)": void MatrixNormalize(ProMatrix m) { int row, col; double scale; scale= sqrt(m[0][0]*m[0][0]+m[0][1]*m[0][1]+m[0][2]*m[0][2]); for (row = 0; row < 3; row++) for (col = 0; col < 3; col++) m[row][col] /= scale; m[3][0] = 0.0; m[3][1] = 0.0; m[3][2] = 0.0; }
Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags