Archives   

<<< Bulletin Board Chapters Debug Functionality >>>

Contents

[back to top]


100.1 Introduction

Archiving is the process of saving the data in Parasolid’s internal memory to external storage. Your application can archive one or more parts, or the contents of a partition, into a single logical file or block of data.

Parasolid archives are intended to fit into whatever archiving system is used by your application. This could take the form of a controlled directory structure on the host computer, or some kind of database. The nature of this storage depends on your application’s frustrum.

Parasolid does not provide any means of deleting parts from archive, or listing keys which have been used to archive parts, either in the current session or in previous sessions. Your application must keep track of the keys used. Your application’s frustrum should also trap attempts to write new archive data to a place which already exists (i.e. re-use of keys).

See Chapter 2, “File Handling”, of the Parasolid Downward Interfaces manual for further information about the frustrum functions required to implement archiving.

See Chapter 22, “Assemblies And Instances”, for further information on the use of assemblies in archiving.

For an example of this functionality, see the code example in the C++\Code Examples\Application Support\Archiving\Transmit folder, located in example_applications in your Parasolid installation folder.

 

Related Topics:

100.1.1 Parasolid terminology

To save or write data from Parasolid to an external store is referred to as transmitting information.

To load or read data from an external source into the current Parasolid session is referred to as receiving information.

[back to top]


100.2 Transmitting a part

PK_PART_transmit and PK_PART_transmit_u transmit one or more parts to a logical block of data through the frustrum. You supply these functions with a key string which the frustrum can use, for example, as a filename or an index into a database.

 

Note: If you want to use PK_PART_transmit_u to transmit data regardless of whether or not the key string contains Unicode characters, you must handle this in your UCOPWR frustrum function.

In addition, you can use PK_PART_transmit_b to transmit one or more parts to application memory.

For all three of transmit functions:

100.2.1 Transmit format

There are five formats that can be used for the archive, which should be provided in your application’s frustrum as required.

 

Format

Frustrum requirements

text

These use the FFOPWR frustrum function, or the UCOPWR frustrum function if it is defined.

machine-dependent binary

machine-independent binary

neutral binary

 

“applio” (call application-registered functions)

This format uses the application frustrum functions which are registered by PK_SESSION_register_applio_2.

“indexio” (call application registered indexing functions)

This format uses the application frustrum functions which are registered by PK_SESSION_register_indexio. Parts transmitted in this format may be subsequently received on a “per-face” basis. See Section 100.2.3, “Transmitting indexed files”, for more information.

For further information about transmit formats see Chapter 2, “File Handling”, of the Parasolid Downward Interfaces manual.

100.2.2 Transmit version - save as earlier version

A part may be transmitted so that it can be received by a version of Parasolid earlier than the current version (the version doing the transmitting).

This means that parts modeled in the current version of Parasolid can also be archived in any format from V7 onward, and thereafter received by an application using that earlier version of Parasolid.

You use the transmit_version option in PK_PART_transmit_o_t to specify the version you want to use.

Parasolid provides two methods for supporting backwards compatibility in XT data:

 

Method

Description

Embedded schemas

By default ( transmit_version = 0), data saved in Parasolid V14.0 and later is backwards compatible at least as far as the previous major version. Thus, any data transmitted using Parasolid V15.x can be opened in Parasolid V14.x without any loss of information. All information associated with the part is contained within the saved data, including information that may not be recognised by the earlier version.

Non-embedded schemas

Setting transmit_version explicitly to a non-zero integer saves the part using the precise format of the specified version. For example to save a data for use in Parasolid V10.1, specify a transmit_version of 101. For Parasolid V9.0, use a transmit_version of 90.

The oldest version that you can specify is 7.0. For versions before 9.0, a part file can only contain a single part. The current version of Parasolid is allowed.

Any information in the part that is not recognised by the earlier version of Parasolid is lost.

 

Note: If saving a part in a format earlier than Parasolid V12.1, the part must not contain certain non-printing characters, such as carriage return and line feed, in attribute string fields. Attempting to save a part containing such characters raises the error PK_ERROR_bad_text_conversion in the call to PK_PART_transmit.

Parts saved in Parasolid V12.1 format or later can contain these non-printing characters, and no error is raised.

100.2.3 Transmitting indexed files

When you transmit one or more parts, you can opt to transmit the files using a format that allows specific faces to be received by subsequent Parasolid sessions, rather than an entire part. This is particularly useful if you are transmitting large parts with the expectation that users will only need access to certain information from those parts during future editing sessions.

In order to transmit files with the required indexing information, you need to do a number of things:

Once you have transmitted a part as an indexed file, you can still receive the whole part into a Parasolid session as normal; the only difference is that an indexed part file is slightly larger than a non-indexed part file, and a number of received nodes will be deleted immediately after receiving the part.

Section 100.3.3, “Receiving specific faces from a part”, describes how you can receive a specific face from a part that has been transmitted with indexing information.

100.2.4 Transmitting mesh data

You can transmit mesh data to separate files or embed the data within the part file using the transmit_meshes option. The transmit_meshes option has the following values:

 

Value

Description

PK_transmit_meshes_separate_c

Transmit meshes to a separate file, which is controlled by the file handling functions in your frustrum.

PK_transmit_meshes_embedded_c

Transmit meshes within the part file.

When the transmit_meshes option is set to PK_transmit_meshes_embedded_c:

 

Note: The transmit_meshes option is ignored in PK_PART_transmit_b as the meshes are always embedded within the application memory block.

100.2.5 Contents of a part archive

When a part is archived, the following items are saved:

And optionally, in a separate place:

100.2.6 Identifiers

Identifiers are integer values which are attached to all entities within a part, except for fins and the part itself. The identifiers within a part are distinct. Unlike tags, they are saved when a part is archived, so identifiers can be stored with a part key in an external database to keep a handle on a particular entity.

See Section 2.4.4, “Identifiers”, for more general information about identifiers.

There is no guarantee that the same entities have the same tags when loaded into another session. The decision as to whether your application should use identifiers depends upon whether it needs to reference specific entities within archived parts in different modeling sessions.

If you do need to use identifiers, then it is important that you record the identifiers for all entities that you may wish to access in a new session, prior to transmitting the part. You do this by calling PK_ENTITY_ask_identifier for each entity that you are interested in.

When receiving the part in a new session, you need to find the tags of those entities whose identifiers you previously recorded. Do this by calling PK_PART_find_entity_by_ident for all of your recorded identifiers.

Naturally, you need to save the list of saved identifiers between sessions, independently of the part itself.

The following table summarizes the differences between identifiers and tags with respect to archiving and Parasolid sessions:

 

 

Tags

Identifiers

Uniqueness:

unique during session

unique within a part

Result when a part is archived:

not archived

archived with part

Result when a part is changed:

not changed*

changed when entity is transferred between owning entities

Effect between sessions:

not maintained

maintained

* caution must be applied as a change of tag could appear to occur when an entity is replaced by a similar entity

[back to top]


100.3 Receiving a part

PK_PART_receive and PK_PART_receive_u receive one or more parts from a logical file or data block through the frustrum, using the key string given by the application.

It is your application’s responsibility to ensure that Parasolid can find the archive data for the part. This is mostly dependent on the frustrum. If the key cannot be found by the frustrum (for instance because it simply treats keys as filenames and has no information on which directory to look in) then PK_PART_receive and PK_PART_receive_u fail.

 

Note: If you want to use PK_PART_receive_u to receive data regardless of whether or not the key strings contain Unicode characters, you must handle this in your UCOPRD frustrum function.

In addition, you can use PK_PART_receive_b to receive one or more parts from application memory, provided these parts have been transmitted in the same, or an earlier, version of Parasolid. You can use PK_PART_receive_version, PK_PART_receive_version_b, or PK_PART_receive_version_u to obtain the version of Parasolid used to create part transmit data.

For all three receive functions:

Parts are transmitted with a reference to a specific Parasolid schema file. Once you have updated the version of Parasolid used by your application, its frustrum must retain schema files for each version used, or else your application is unable to receive old parts. You can find out what the current schema version is using PK_SESSION_ask_schema_version.

100.3.1 User fields

To receive user fields archived with the entities of a part, the length of the archived user fields must be the same as, or shorter than, that set for the current session by PK_SESSION_start.

If they are not, you can prevent PK_PART_receive and PK_PART_receive_u from trying to read them by setting the receive_user_fields option to false. This makes Parasolid do the following:

For further information see the “User fields” section in Chapter 115, “Session Support”.

100.3.2 Attributes

If a part has user-defined attributes attached, the attributes and their definitions are transmitted with the part. When the part is then received into a session, the kernel automatically loads the attribute definition of the attributes, if there is no definition with the same name already in the session.

If the attribute definition already exists in the new session, and matches the definition saved with the part, the part can be retrieved.

If the attribute definition already exists in the new session, but does not match the definition saved with the part, you can use the attdef_mismatch option to control the behaviour. This option takes the following values:

 

Value

Description

PK_ATTDEF_mismatch_fail_c

If mismatched attribute definitions are found, the receive operation fails, and returns the error PK_ERROR_attr_defn_mismatch. This is the default.

PK_ATTDEF_mismatch_ignore_c

If mismatched attribute definitions are found, the receive operation succeeds, but any mismatched attribute definitions and their associated attributes are stripped out before the part is received into the session.

No warning is given if mismatched attribute definitions are stripped out using this value. PK_ATTDEF_mismatch_ignore_c is therefore best used after an attempt to use PK_ATTDEF_mismatch_fail_c has failed.

 

Note: System defined attributes attached to a part are always received successfully.

100.3.3 Receiving specific faces from a part

If a part has been previously transmitted with indexing information (as described in Section 100.2.3, “Transmitting indexed files”), then you can opt to receive specific face from the part, rather than the whole part. This can be particularly useful if the part file is very large, and you are only interested in working with some of the information it contains.

To do this, you need to specify the following options when receiving the part. These are all available in the PK_PART_receive_o_t options structure:

 

Option

Description

transmit_format

When receiving specific faces, this should be set to PK_transmit_indexio_c. The received XT file must have been transmitted using this option as well.

part_index

For use only when receiving an XT file that contains several part files, this is an index that specifies which of the available parts the required faces should be drawn from.

n_identifiers
identifiers

The number of identifiers, together with a list of the identifiers, of the faces that you want to receive into the session. Currently, only a single face can be received in a single call: n_identifiers must be 1. See Section 100.2.6, “Identifiers”, for more information.

receive_indexed_context

A pointer to indexing data stored by your application. The context is a way for your application to communicate with the functions defined in the indexed frustrum.

In addition, you can optionally use key_is_partition to receive a specific face from a part stored in partition data. If this option is PK_LOGICAL_true, then the specified key is assumed to contain partition data (created as described in Section 100.4, “Transmitting a partition”). In this case, the ordering of the bodies used to define part_index is the same as that returned by PK_PARTITION_ask_bodies.

 

Note: You can only receive a specific face from a part if you have registered an indexed frustrum using PK_SESSION_register_indexio

100.3.4 Receiving compound bodies in part files

You can receive compound bodies into a session by using any of the standard receive functions: PK_PART_receive, PK_PART_receive_u, or PK_PART_receive_b. See Section 15.12.1.4, “Receiving compound bodies into a session”.

100.3.5 Receiving mesh data

How mesh data is received into a session depends on whether it is embedded in the XT file or is in a separate XMM file, and can be controlled using the receive_using_seek option. This takes the following values:

When the transmit_meshes option is set to PK_transmit_meshes_embedded_c:

 

Value

Description

PK_receive_using_seek_no_c

Mesh data for the part is loaded into the session sequentially during the PK receive operation before any of the data is needed.

PK_receive_using_seek_yes_c

Mesh data for the part is only loaded into the session when it is needed.

When the transmit_meshes option is set to PK_transmit_meshes_separate_c the mesh data is in a separate XMM file therefore the receive_using_seek option has no effect and mesh data will be loaded into the session when it is needed.

 

Note: The receive_using_seek option is ignored in PK_PART_receive_b as mesh data is always received and loaded into the session immediately.

If you wish to optimise the receive_using_seek option, you need to register the frustrum seek function FFSKXT using PK_SESSION_register_fru_2. See Section 5.3, “Registered frustrum” in the Downward Interfaces manual for more information.

100.3.6 Receiving parts with mixed geometry

The receive_mixed option allows you to control whether to receive parts containing a mixture of classic and facet geometry in your application. On receiving data into a Parasolid session, you can choose to set receive_mixed to one of the following values:

 

Value

Description

PK_receive_mixed_fail_c

An error of PK_ERROR_mixed_geometry is returned on encountering a part with mixed geometry. Default

PK_receive_mixed_allow_c

Allow parts containing mixed geometry to be received into your application.

Note: If the part being received does not contain mixed geometry, then this value will have no effect. To receive mixed parts, facet geometry must be enabled. See Chapter 82, “Overview Of Convergent Modeling” for more information on enabling support for mixed geometry.

[back to top]


100.4 Transmitting a partition

PK_PARTITION_transmit and PK_PARTITION_transmit_u transmit a partition as a logical block of data through the frustrum. PK_PARTITION_transmit_b transmits a partition to application memory. As for part data:

 

Note: Light partitions may not be transmitted.

100.4.1 Transmitting partition history

By default, PK_PARTITION_transmit transmits the current state of a given partition. If required, you can transmit the history of the partition as well, in terms of its pmarks and delta information. You use the transmit_deltas and pmarks options to do this:

The transmit_deltas option takes the following values:

 

Value

Description

PK_PARTITION_xmt_deltas_none_c

Do not transmit any delta information; only the current state of the partition is transmitted. This is the default.

PK_PARTITION_xmt_deltas_all_c

Transmit delta information for all pmarks in the partition.

PK_PARTITION_xmt_deltas_main_c

Transmit delta information for just those pmarks in the “main line”, that is, from the initial pmark to the current pmark. In Figure 100-1, if P1 is the initial pmark, and P6 the current pmark, then the main line consists of P1, P2, P4, and P6.

PK_PARTITION_xmt_deltas_later_c

Transmit deltas at a later time, rather than in the current function call. If you use this value, you can transmit the partition’s deltas via a later call to PK_PARTITION_transmit_delta.

 

Figure 100-1 Transmitting pmarks in the main line

If you use transmit_deltas , then:

The pmarks option lets you override the deltas to transmit, by providing a specific set of pmarks. The way these pmarks are interpreted depends on the setting of transmit_deltas :

 

If transmit_deltas is ...

then ...

PK_PARTITION_xmt_deltas_none_c

pmarks represents the pmarks that are transmitted with the partition.

PK_PARTITION_xmt_deltas_all_c

pmarks represents the pmarks that are not transmitted with the partition. All pmarks not in the specified pmarks are transmitted instead.

PK_PARTITION_xmt_deltas_main_c

pmarks represents the main line pmarks that are not transmitted with the partition, similar to PK_PARTITION_xmt_deltas_all_c. All main line pmarks not in the specified pmarks are transmitted instead. Pmarks that are not in the main line are omitted.

PK_PARTITION_xmt_deltas_later_c

the function call fails with PK_ERROR_bad_option_data. Do not use pmarks if transmit_deltas is PK_PARTITION_xmt_deltas_later_c. Instead, use the pmarks option in the subsequent call to PK_PARTITION_transmit_delta.

When transmitting specific pmarks using this option, pmarks are transmitted on the fly without affecting the current session, and the deltas are merged and relinked in the transmitted data.

 

Note: You should always transmit the initial and current pmarks. In addition, you must transmit a junction pmark if pmarks from more than one of its branches are transmitted.

In Figure 100-2, if you do not want to transmit P5, then the junction pmark P4 is not required. However, if you want to transmit P5 , then junction pmark P4 is required. In both cases, P1 and P6 also need to be transmitted, because they are the initial and current pmarks.

 

Figure 100-2 Transmitting junction pmarks

100.4.2 Contents of a partition archive

When a partition is archived, the following items are saved:

and optionally:

and optionally, in a separate place:

If the transmit_all_attdefs option is left at the default value of PK_LOGICAL_true, then all attribute definitions available in the Parasolid session are transmitted. If you set transmit_all_attdefs to PK_LOGICAL_false then only those attribute definitions that are actually used in the partition are transmitted. In order to minimise the size of partition files, you are advised to set transmit_all_attdefs to PK_LOGICAL_false.

 

Note: Transmitting deltas is not guaranteed to work when using the transmit_version option of PK_PARTITION_transmit or PK_PARTITION_transmit_u to transmit a file using a previous Parasolid version.

100.4.3 Transmitting mesh data in a partition

You can transmit mesh data into a separate file or embed it within the partition file using the transmit_meshes option as described in Section 100.2.4, “Transmitting mesh data”.

[back to top]


100.5 Receiving a partition

PK_PARTITION_receive and PK_PARTITION_receive_u receive a partition from a logical file through the frustrum. PK_PARTITION_receive_b receives a partition from application memory.

You can specify a number of options when receiving partitions, including the following:

 

Options

Description

receive_deltas

Specify whether to load the partition’s pmarks and deltas. This takes the following values:

  • PK_PARTITION_rcv_deltas_yes_c: load the pmarks and deltas in the partition.
  • PK_PARTITION_rcv_deltas_no_c: do not load the pmarks and deltas in the partition.
  • PK_PARTITION_rcv_deltas_later_c: delay loading the pmarks and deltas in the partition. If you use this value, you can load the partition’s pmarks and deltas at a later stage using PK_PARTITION_receive_deltas_2.
Note: If this option is set to PK_PARTITION_rcv_deltas_yes_c or PK_PARTITION_rcv_deltas_later_c and the partition contains mesh data, Parasolid will load all of the meshes in that partition immediately. For more information, see Section 100.5.1.1, “Receiving mesh data and deltas in a partition”.

receive_all_attdefs

Choose whether to receive all attribute definitions stored with the partition, or only those defining attributes in the partition and its deltas. This option mirrors the PK_PARTITION_transmit option transmit_all_attdefs , described in Section 100.4.2.

  • If PK_LOGICAL_true (the default), all attribute definitions in the received partition are integrated into the session.
  • If PK_LOGICAL_false, only the attribute definitions that define attributes in the partition and its deltas are integrated into the session. Attribute definitions defining attributes in the partition are available immediately, while attribute definitions defining attributes in the deltas are available once PK_PARTITION_receive_deltas_2 has been called.

This option only has an effect when receive_deltas is PK_PARTITION_rcv_deltas_later_c.

attdef_callback
attdef_callback_on
attdef_context

Use these options to resolve any mismatches between existing attribute definitions and definitions in the received partition, where a received definition has the same name as an existing definition, but other parts of their standard form differ. See the documentation for PK_PARTITION_receive_o_t for more information.

allow_missing_deltas

If receive_deltas is PK_PARTITION_rcv_deltas_yes_c, use this option to allow PK_PARTITION_receive to succeed even if the delta file is not available (in other words, as if receive_deltas was PK_PARTITION_rcv_deltas_no_c).

If you use this option and need to tell whether a delta file was present or not, you should do one of the following:

  • Use PK_PARTITION_ask_pmarks_2 to examine the number of pmarks in the new partition: if deltas were missing, there is one pmark, but if deltas were present, there is more than one pmark.
  • Use PK_PARTITION_ask_pmark and check the is_at_pmark return: this is PK_LOGICAL_false if the delta file was missing, because there is only one pmark in this case, and the new partition cannot be on that pmark after receiving the partition.
receive_using_seek

How mesh data in the partition is handled if it is not immediately needed. See Section 100.3.5, “Receiving mesh data” for more information.

receive_compound

You can receive compound bodies into a session by using any of the standard partition receive functions: PK_PARTITION_receive, PK_PARTITION_receive_u, and PK_PARTITION_receive_b. See Section 15.12.1.4, “Receiving compound bodies into a session”.

receive_mixed

Choose whether to receive parts containing a mixture of classic and facet geometry in your application. See Section 100.3.6, “Receiving parts with mixed geometry” for more information.

100.5.1 Receiving a partition’s pmarks and deltas

PK_PARTITION_receive_deltas_2 receives the pmark graph and deltas for a given partition from a logical file through the frustrum:

Deltas can only be received for a partition if that partition was received earlier in the session, with option PK_PARTITION_rcv_deltas_later_c, and the pmark which the partition was at immediately after being received, has not been deleted. However, the partition may be modified, and pmarks created, between receiving the partition and receiving its deltas. This is illustrated in Figure 100-3 (current pmarks are shown in blue).

 

Figure 100-3 Pmark graph as transmitted

If you use session marks (see Section 97.4, “Session rollback”, for more information) and session roll forward is switched off, you can use the new_at_mark option in PK_PARTITION_receive_deltas_o_t to manage correct deletion of pmarks received via deltas when rolling the session back to a previous mark.

By default, when you receive pmarks into a partition via deltas, the “age” of those pmarks is denoted by the point at which the delta was received into the partition, even though the partition itself was received earlier. Pmarks received via deltas in this way are deleted when rolling the session back to a point before the delta was received, even if the partition itself had already been received at that point.

In order to avoid this, set new_at_mark to PK_PMARK_new_with_partition_c. This ensures that pmarks received via deltas are not deleted when rolling the session back to a point before the delta was received: any pmarks received via deltas are only deleted if the session is rolled far enough back that their owning partition no longer exists. Figure 100-4 shows a simple example of this in use (current pmarks are shown in blue).

 

Figure 100-4 Controlling deletion of pmarks when rolling the session back

 

Note: If your application does not use session marks, you can ignore the new_at_mark option.

100.5.1.1 Receiving mesh data and deltas in a partition

Parasolid’s meshes are optimised not to load their mesh data until it is needed for an operation (i.e. the meshes are lazily loaded).

However, if the partition received (via PK_PARTITION_receive) contains mesh data and the receive_deltas option is set to either PK_PARTITION_rcv_deltas_yes_c or PK_PARTITION_rcv_deltas_later_c, Parasolid will load all of the meshes in that partition immediately. Any subsequent calls to the PK_PARTITION_receive_meshes function have no effect. If you are using PK_PARTITION_receive and you want to load meshes lazily, the receive_deltas option must be set to PK_PARTITION_rcv_deltas_no_c.

Furthermore, if a pmark is created in a partition, Parasolid will load all meshes into the session that have not previously been loaded. Therefore you need to ensure your frustrum is capable of handling multiple calls to the relevant frustrum functions when loading a partition (or part) that contains mesh data. See Section 5.3, “Registered frustrum” in the Downward Interfaces manual for more information.

 

Related Topics:

 

[back to top]

<<< Bulletin Board Chapters Debug Functionality >>>