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.

export/import XML files via ProToolkit

hannes

New member
hello everybody!

can anybody help me for export an assembly to xml and import an xml-file to proe?
i wrote some code, which i added to this message, and it is not working and i do not know why. after i set the name of my export-file and pushed enter, proe completly closed! has anyone may be some other code or some help?
and it is possible to import an xml-file to proe? when yes, how? because i haven
 
hannes,


When you call ProFeatureElemtreeCreate(&feature, &elemtree); you do not first get a handle to a feature. You need to read the API Wizard definition for that function. You have to fill the feature parameter first before you can export it's element tree. Also, you can "import" a feature that is defined by an xml file with the function ProElemtreeFromXMLCreate. However there are subsequent functions that you need to call to actually create the feature. Read the API Wizard under User's Guide->Principles of Feature Creation.
 
hi williaps,

you mean i have to do the routine like it is described in the UgOADraftCreate.c that the feature parameter is filled for export an assembly to xml?

Ok, ProElemtreeFromXMLCreate() is for import xml files to proe. is there something where i have to look after?
for the first argument ProPath i set the path of the xml file - input_file, for ProElement elemtree and for ProXMLErrorlist i set errors.
then i would write the simple code line:
status = ProElemtreeFromXMLCreate (input_file, &elemtree, &errors);
is that all?

thanks for your help
 
hannes,


I would stop looking at example code and start reading the API Wizard like I suggested. My impression from your previous posts is that you are not only new to Pro/TOOLKIT but are new to programming as well. What I'm trying to say is that you need to build some foundational knowledge before diving into one of the most complicated areas of the API. To answer your questions:


>Ok, ProElemtreeFromXMLCreate() is for import xml files to proe. is there something where i have to look after?
I'm not sure what you are asking here.


>for the first argument ProPath i set the path of the xml file - input_file, for ProElement elemtree and for ProXMLErrorlist i set errors.
then i would write the simple code line:
status = ProElemtreeFromXMLCreate (input_file, &elemtree, &errors);
is that all?
You need to read the function prototype in the documentation for this one. The input_file parameter is an input parameter that you need to fill with the location of your XML file. The parameters elemtree and errors are output parameters (that is why the address of operator '&' precedes them) that receive data from the function. However this function does NOT create a feature for you. It only creates an element tree structure (or feature definition) in memory. You have to them call several other functions to actually create the feature.


In short, I strongly recommend you read the API Wizard to get a foundational set of knowledge before writing code to create features.
 
hi williaps,

you are right that i am new at programming toolkit. at my company i got the order to create a toll which imports xml files to proe. i am also german and to understand the api wizard is not really easy for me
 

Sponsor

Back
Top