Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Getting Dimension ID value

rnd_doss

New member
Hi Everyone,


Could you please explain how tosupply predefined values for "ProDimensionVauleGet" function without selecting the model and dimension. For example if we know the Type, ID and Owner.


Thanks,


Murugadoss
 
ProDimension m_ModelItem;
double result;
ProError err;

m_ModelItem.id = id;
m_ModelItem.type = PRO_DIMENSION;
m_ModelItem.owner = owner;

err = ProDimensionValueGet(&m_ModelItem, &result);
 
Hi Murugan,


Here is the sample for your issue...


typedef struct dim_id
{


int *id;
int num;

}Dim_id;


ProError ProUtilFeatDimensionVisit(ProDimension* dim,ProError err,ProAppData appdata)
{


Dim_id *dim_data = (Dim_id* )appdata;

if(dim_data->num==0)
dim_data->id = (int *)malloc(sizeof(int));
else
dim_data->id = (int *)realloc(dim_data->id, (dim_data->num+1)*sizeof(int));



dim_data->id[dim_data->num]=dim->id;

dim_data->num++;


return (PRO_TK_NO_ERROR);


}





Dim_id dim;
dim.num=0;
int p;


status = ProSolidDimensionVisit(solid_handl,PRO_B_FALSE ,ProUtilFeatDimensionVisit,NULL,(ProAppData)&dim);


for(p=0;p<dim.num;p++)
{


status = ProModelitemInit(solid_handl,dim.id

,PRO_DIMENSION,&p_mdl_item);
}


What about your "Note" issue...Make your req't more clear then you can get some solution...


With regards,


Kishore V
 
Hi Kishore,


Thanks for your response.


My Note Creation issue is realated to the above one which i posted.


I am trying to get the dimension id's values, at the same time i have a plan to append the same value with drawing note.


I have attached my code snippet here. Please go through the same.


and let me know In what way i can accomplish this one.


2007-06-04_073510_Note.txt.zip


Regards,


Murugadoss
 
Hi Murugan,


I saw your code,there was major issue regarding your approach for getting the dimensions for the ProMdl which you want to get. Once you get the dimensions id's of the modle then olny you can use the ProDimensions API's.


There is a API ProSolidDimensionsVisit() it will retrieve all the dimesnions in the Solid(Including all the features).But i don't think it will solve your requirement.As i told you you can't get the dimension of the ProMdl or Model for which you are trying.


ProSolidOutlineCompute() it will give boundry dimensions of the ProMdl w.r.t to the default Csys.By getting the X,Yand Z by making some modification you can say the those are the dimensions of your model.


I think you brought the same with PTC Tech support, your approach need to be altered.


With regards,


Kishore V
 
Hi kishorev.
Is there any way to collect all the dimensions in a drawing
in an array which can be later called for further
operations like getting the value,getting the
tolerance,etc?
Thanks.
Edited by: hijacker
 
Hi,


Yes you have the collect and visit functions are availible in the pro\toolkit to get the drawing dimensions and view wise you can querty those as visible in view functions.


You have to differntiate the drawing dimensions are solid dimensions which are start withd 'd' and 'add',take care fo those in code,once you get the dimension handle then you can get the respecive tolerance values.


With regards,


Kishore V
 
Hi Kishore.Thanks for the reply.
I tried using -
ProDrawingDimensionVisit(drawing,PRO_DIMENSION,
(ProDimensionVisitAction)VisitDimension,NULL,
(ProAppData)&p_data)

But here,stuckup with what data has to be passed in &p_data
to the action function?
 
hijacker,


Almost all of the Visit functions in the Pro/TOOLKIT API allow the programmer to pass a void pointer parameter "appData" as the last programmer. This gives the programmer the opportunity to pass any data structure they desire. This is the power of the C/C++ void pointers.


Now, to answer your question. If you want to collect the drawing dimensions into an array to be used later follow these high level steps.


1. Call ProDrawingDimensionVisit passing the address of (&) a previously allocated ProArray object of type ProDimension**.


2.In the ProDimensionVisitAction function you should call ProArrayObjectAdd to add the visited ProDimension object to your ProArray of type ProDimension. Remember to type cast your appData to a ProDimension **. You'll have fun getting this right.


3.When visiting is complete you will have a ProArray of all drawing ProDimension objects.


I would encourage you to read the Wildfire 5.0 API Wizard under User's Guide->Annotations: Annotatiion Features and Annotations->Dimensions->Visiting Dimensions.
 
Hi williaps,Thank You for understanding my question and
giving me a precise and elaborate answer for the same.

Am quite a beginner in C and not quite aware of
typecasting and other such terminologies.Am working on
Pro/Toolkit Application,wherein i need to check if
dimensions are present in a view or not.Also i need to
get the tolerance value of the dimensions.
So for this,i was trying to store all dimensions in a
drawing in an array(just like we do with notes using
ProDrawingDtlnotesCollect()),which can be later called by
its handle to check if it is attached to any view.But as
in case of dimensions,it is known that we cannot directly
collect dimensions and we need to do the same through
visit functions.
Since am not that deep into C,am not able to write a
proper code in the Action function of the Dimension Visit
Function on how to assign dimensions to an array as you
mentioned.
Could you please give me an example of the same,so that i
could understand it more clearly and replicate it by
writing my own code.

Would be grateful if you could answer my concern.
Thank You.
 

Sponsor

Articles From 3DCAD World

Back
Top