Home
Reply
Contributor
Igorunius
Posts: 11

ACIS18 BinaryFile read problems

[ Edited ]

Hi!

 

There is no option 'binary_read_format' in ACIS18, so I have tried to write/read without it with 'api_restore_entity_list_file' and 'api_save_entity_list_file' functions. I think that save_entity_list_file saves the file that looks like it is good, but api_restore_entity_list_file operation is unsuccessful. By looking at BinaryFile options I understood that the api_save... function working with these options:

  big_end 0

  need_swap 0

  read_long_size -1

  write_long_size 4,

but after 'api_restore_entity_list_file' call they are set to

  big_end 0

  need_swap 0

  read_long_size 8

  write_long_size 4

 

I've tried to set these BinaryFile options by myself (to 0,0,4,4 and 0,0,8,8 both on read and write) but this is not changed the whole image and 'api_restore_entity_list_file' returns unsuccess.

 

How does it mean if read_long_size is equal to -1?

How can I write and then read my file in ACIS18 with BinaryFile class?

Message Edited by Igorunius on 07-23-2008 01:30 PM
Spatial Employee
Jeff
Posts: 38

Re: ACIS18 BinaryFile read problems

Hi Igorunius

 

The read and write formats are established by the read and write header methods respectively. This process relies on the ability to modify the read and write positions in the stream. I assume you have a custom FileInterface since you are using api_save/restore_entity_list_file. Have you implemented the set_mark and goto_mark methods correctly? Are you opening the streams correctly with "rb" and "wb"? Can you restore the file with the SchemeAIDE test application (or with api_restore_entity_list)?

 

Also, a read_long_size value of -1 simply means that it hasn't been set.

 

Best regards,

Jeff

Contributor
Igorunius
Posts: 11

Re: ACIS18 BinaryFile read problems

[ Edited ]

Hi Jeff,

 

Yes, I can read .sab file by another program that can work with sab files, so, these binary files are saved correctly.

 

Both, set_mark and goto_mark returned 0 before. So I have tried to calculate count of readed bytes and seek into this position, it starts to working good.Thanks.

 

So I see that format definition algorithm is:

1 - reading header string  "ACIS BinaryFile"

2 - then BinaryFile make attempt to read three LONG values

3 - if it can't read in one format, it seek current read position after last correct readed block and repeat (2) for next format
 etc...

Message Edited by Igorunius on 07-31-2008 03:19 PM
New Visitor
steve0
Posts: 3

Re: ACIS18 BinaryFile read problems

Good  info  !Thank you !