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.

how to export a parasolid model

ccmeyer

New member
Hello, I am a really new ProToolkit user (about 3 days) so please bear with me.

I would like to export an asm file as a x_t (Parasolid) file.



I am using the method ProIntf3DFileWrite. Going through the example code

contained in the API docs, can export an igs file. When I try to export

the parasolid (as a flat-file asm-config, brep wireframe and solid = true)

I get the following error message to stdout(err?) =

"giving up- peer appn and/or msg module is not alive"



Does anyone have any thoughts as to what this indicates? Maybe a page in the

docs that explains more about this? How about a mapping that shows what
brep and config options are required for each export type?



Any advice would be greatly appreciated.

Thanks
 
ccmeyer,


You crashed your program! What that message means is that xtop.exe crashed and your program lost communication. If you post your code I may be able to help debug your function call. Otherwise look for where you might be passing an incorrect parameter to the function.
 
ProName name_wchar;

ProSolid model;

ProMdlType modelType;

ProError err;

ProIntf3DExportType output_format;

ProOutputAssemblyConfiguration asm_config = PRO_OUTPUT_ASSEMBLY_MULTI_FILES;

ProOutputBrepRepresentation brep_flags;



char *part_name;

char *export_format;



part_name = argv[1];

export_format = argv[2];

// increment consumes the plus

part_name++;

export_format++;



// here check if part is an asm or prt

modelType = getModelType(part_name);



ProStringToWstring (name_wchar,part_name);

err = ProMdlRetrieve (name_wchar,modelType,&model);

if( err != PRO_TK_NO_ERROR ){

printf("unable to retrieve model %s of type %s ... exiting ...\n",name_wchar,modelType);

}



// so we have the model loaded

output_format = getModelExportType(export_format);



// need to build a valid asm_config and ProOutputBrepRepresentation

// for the export type

// brep_flags = getBrepRepresentation(output_format);

err = ProOutputBrepRepresentationAlloc (&brep_flags);



if(output_format == PRO_INTF_EXPORT_PARASOLID){



printf("setting flags for PARASOLID");

err = ProOutputBrepRepresentationFlagsSet (brep_flags,




PRO_B_FALSE,




PRO_B_TRUE,




PRO_B_TRUE,




PRO_B_FALSE);



asm_config = PRO_OUTPUT_ASSEMBLY_FLAT_FILE;





}



// now output the model

err = ProIntf3DFileWrite( model, output_format ,"resultCadModel",asm_config,NULL,&brep_flags,NULL,NULL) ;



// apparently this is where I kill it

// been trying different things in terms of pointers/dereference, etc...
 
ccmeyer,


Ok, I see a couple of things. First off, go to the API Wizard and go to Pro/TOOLKIT Objects->Interface->Exporting 3D Models->Example 1: To Export a Model File to IGES Format. There is a function in this code: UserSolidIGESExportWithFlags that outlines how to do what you want to do.


1. By looking at the example I see that you are not verifying the support for your export. More specifically, you are not calling ProOutputAssemblyConfigurationIsSupported and ProOutputBrepRepresentationIsSupported. You need to call these two functions to make sure you are allowed to do the export.


2. In your call to ProIntf3DFileWrite you are passing "resultCadModel" (char *) for the output_file parameter. This parameter calls for a ProPath (wchar_t[260]) and you are passing a char*. This will definitely crash Pro.


Hope this helps!
 
OK. will look into that. The above code will export an IGS model though
(with proper change to asm_config and brep_flags), even with the char*
paramter versus the ProPath parameter. But will fix that. Thanks for
the advice.

I guess the main question is how does one determine the correct
configuration(s) for the differing export formats? Is it just a case of
trial and error to determine the correct matrix or if one has more
domain knowledge in CAD, is this the type of knowledge one just has ?
The main goal of my application is to take as input an asm or prt file
and a "flag" indicating the new file type and then export the model in
batch mode. So trying to figure out all correct configs for the
Wildfire 2 output formats.



Thanks again for your guidance. Will implement those changes and continue the experiment.
 
Thanks for the help, was invaluable... Things are exporting swimmingly now.

I guess one just has to implement some logic to try various
configurations of assy and brep settings in order to find some that are
supported for the chosen export and then just roll with those.

Thanks again.
 

Sponsor

Articles From 3DCAD World

Back
Top