Home
Reply
Regular Contributor
yadongshen
Posts: 44

trouble in acis prototype

my acis works fine in my computer. I tried a "hello_world" app in acis and it worked.

 

Then when i tried to create a easy block by calling api_make_cuboid function

 

However, when the code stepped in res = api_make_cuboid(100,50,200,block), the block is not succesfully created. The error message "Error Making Block" appeared every time i ran the code.

 

I called the license function: unlock_spatial_products_4207(); but i was still stuck in the error making block.

Plz see the attachment.

 

My code is actually copied from a book: 3D modeling with ACIS written by Jonathan Corney. So i guess nothing should be wrong in it.

 

The code is :

 

#include <stdio.h>

#include "stdafx.h"

#include "acis.hxx"

#include "api.hxx"

#include "kernapi.hxx"

#include "cstrapi.hxx"

#include "body.hxx"

#include "debug.hxx"

 

// Declaration of the ACIS licensing function.

void unlock_spatial_products_4207();

 

void main()

{

 

unlock_spatial_products_4207();

 

outcome res = api_start_modeller(0);

if(!res.ok()){ printf("Error Starting Modeller\n"); exit(1);}

 

res = api_initialize_constructors();//Initializes constructor library

if(!res.ok()){printf("Error in api_initialize_constructors\n");exit(1);}

 

BODY* block;

 

res = api_make_cuboid(100,50,200,block);

if(!res.ok()){printf("Error Making Block\n");exit(1);}

 

FILE *output = fopen("ball.dbg","w");

debug_size((ENTITY*)ball,output);

fclose(output);

 

res = api_terminate_constructors();

if(!res.ok()){printf("Error in api_terminate_constructors\n"); exit(1);}

 

res = api_stop_modeller();

if(!res.ok()){printf("Error Stopping Modeller\n");exit(1);}

 

}

error making block.jpg
Spatial Moderator
ybiyani
Posts: 223

Re: trouble in acis prototype

Can you modify

 

if(!res.ok()){printf("Error Making Block\n");exit(1);} 

 

with

 

 if (!res.ok())
  {                                       
    print_warnerr_mess("API", result.error_number(), stdout);   
 
  } 



to see if you get more information on why the api fails?

 

Regards,

Yogesh

Contributor
DrSlonix
Posts: 7

Re: trouble in acis prototype

Hello!!!!

The problem is that you call unlock_spatial_products_XXXX() before starting the modeler. Try to call this function before after api_start_modeller(0). ACIS-function spa_unlock_products(const char* unlock_str), which is based unlock_spatial_products_XXXX(), requries that the ACIS memory manager has already been initialized. The only case when unlock_spatial_products_XXXX() can be called before api_start_modeller(0), when is initialized component BASE. For example:



// construct config object

base_configuration base_config;


initialize_base( &base_config); // initialize the base

// insall license key

unlock_spatial_products_XXXX();
api_start_modeller(0);

 

Best regards!