Home
Reply
New Visitor
WallyKorchnak
Posts: 1

About Undo/Redo

Hi, everyone.



Recently, I want to implement Undo/Redo function for my application. I have some problems. I appreciate your help very much.

demo codes as follows:


int depth=0;

api_part_start_state(depth);

API_BEGIN

//many API functions such as:
api_solid_block();
api_transform_entity();
//
。。。。。

API_END

outcome result1 = api_part_note_state(outcome(API_SUCCESS), depth);

if (result1.encountered_errors())

{

error_info* m_error = result.get_error_info();

CString str_error = m_error->error_message();

AfxMessageBox(str_error);

}


When call this function: outcome result1 = api_part_note_state(outcome(API_SUCCESS), depth); the application crashed.
I don't know why!

I want to use the "history" , what should I take notice of?

I just want to implement Undo/Redo function.

Spatial Employee
asdf
Posts: 93

Re: About Undo/Redo

Hello Wally

 

I would recommend replacing 

 

api_part_note_state(outcome(API_SUCCESS), depth);

 

with

 

api_part_note_state(result, depth); // result is declared in the API_BEGIN macro above.

 

Do you know if you are using the part manager?  If you are not using the part manager, you may want to switch to api_note_delta_state.

 

If you need more detailed help, you might consider making a sample ap to illustrate the problem and submitting an incident to customer support.  With a call stack, an ACIS developer could give you a fairly quick diagnosis of why the api is failing: it is probably just a case of doing something simple incorrectly.

 

Eric

Contributor
littlecircle
Posts: 9

Re: About Undo/Redo

If i want to implement Undo/Redo using api_note_delta_state,should i use MACRO API_BEGIN and API_END pair everytime i use AICS api to create solid models?