InterOp:Connect/Translating to ACIS Assembly Models

From DocR21

Jump to: navigation, search

Connect also supports translating assembly files into ACIS assembly models in memory with the SPAIAcisDocument class. SPAIAcisDocument, which is a subclass of SPAIDocument, can be used as a destination document. The translation is performed as done with regular documents. After the Convert method is called and the translation is performed, the created models can be retrieved with the GetModels method of SPAIAcisDocument.

The following example illustrates how to use SPAIAcisDocument in order to translate a file into ACIS assembly models in memory:

#include "SPAIAcisDocument.h"
#include "SPAIConverter.h"
#include "SPAIDocument.h"
 
void translateIntoAcisModels( asm_model_list*& opAcisModels)
{
  SPAIDocument src("C:\\model.CATPart");
  SPAIAcisDocument dst;
 
  SPAIResult result=SPAX_S_OK;
 
  SPAIConverter converter;
  SPAIOptions options;
  SPAIValue representation("Assembly");
  result &= options.Add(SPAIOptionName::Representation, representation);
  result &= options.Add(SPAIOptionName::Flatten, false);
 
  converter.Convert(src, dst);
 
  dst.GetModels( opAcisModels);
  dst.DetachModels();
}

Important: The DetachModels method must be used in order for Connect to release the ownership of the created models and for the user application to acquire the ownership of those models. Otherwise, the created models, which are owned by the SPAIAcisDocument object, are destroyed when the SPAIAcisDocument is destroyed.


AcisAsmImport Sample

This sample demonstrates how to convert an input assembly file to ACIS assembly models and output an ASAT file. The input format can be specified with the argument -iformat (optional).

Usage

AcisAsmImport -i file [-iformat format ] -o file

Options

-i : input file
-o : output file
-iformat : input format
Personal tools
Live