Represents the CATIAInstanceFactory. Role:
This interface is used to create a new instance of a shape reference (ShapeInstance ) or a hybrid shape reference (
HybridShapeInstance ) in case of the instantiation of a User Feature. It is also used to instantiate a Power Copy reference.
This interface contains two protocols of instantiation:
The first protocol is dedicated to User Feature instantiation only.
It is defined by a single method:
AddInstance . It creates a shape or hybrid shape instance depending on the result of the User Feature.
Use this method when you want to perform only one instantiation of the reference.
Read the document containing the User Feature reference and instantiate it.
As the document containing the reference is released from the session at the end of the instantiation,
it is not recommmended to use this method if you want to perform several instantiations of the same reference in a loop.
In that case, prefer the second protocol of instantiation.
The second protocol is dedicated to both User Feature and Power Copy instantiations.
It is defined by several methods that must be called in order.
For User Feature instantiation, these methods are an alternative way of the
AddInstance method. It is recommended to use the second protocol to perform several instantiations of the same reference in a loop.
For Power Copy instantiation, it is the only way of instantiating a reference.
The instantiation process is composed of three major steps:
The first step
BeginInstanceFactory consists in initializing the
InstanceFactory with the reference and the document where it is stored. This step must be called once at the beginning whatever the number of instantiations are done.
The second step is the instantiation itself: it is composed of five methods that must be called in the order.
This set of five methods can be called in a loop in order to make several instantiations.
The method
BeginInstantiate is used to initialize all data of the reference.
The method
PutInputData is used to set a value to any input of the reference.
The method
GetParameter is used to retrieve any parameter of the reference in order to modify its value.
The method
Instantiate is used to duplicate the reference. It returns the created instance when it does exist.
The method
EndInstantiate is used to indicate that the instantiation is done.
The third step
EndInstantiateFactory consists in ending the instantiation and cleaning the
InstanceFactory. When doing several instantiations in a loop, this step must be called just once at the end of all instantiations.
Initializes the instantiation process with the document containing the reference.
Role:
Use this method to start instantiating a reference in the current document.
In that method, the document containing the reference is locked in session.
It will be unlocked in the last step
EndInstanceFactory .
Parameters:
iNameOfReference
The name of the reference to be instantiated.
iDocumentFileName
The name of the file containing the document where to find the reference to be instantiated.
Example:
The following example initializes the factory with a document and a reference:
Retrieves a parameter of the reference by its name.
Role:
This is the third method of the second step of instantiation.
This step is optional.
It is used to retrieve a parameter of the reference in order to change
its value, using the ValuateFromString method of the Parameter interface.
It has to be called on each parameter whose value has to be changed.
Parameters:
iName
The name of the parameter.
Example:
The following example retrieves a parameter on the reference:
Set parameter = InstanceFactory.GetParameter("Parameter1")
Instantiates the reference in the current document.
Role:
This is the fourth method of the second step of instantiation.
It is used to duplicate or instantiate the data of the reference.
In case of Power Copy instantiation, the data are duplicated and there is
no created instance.
In case of User Feature instantiation, the data are instantiated and an
instance is created and returned.
Sets a value to an input of the reference.
Role:
This is the second method of the second step of instantiation.
It is used to set a value to any input of the reference.
It has to be called on each input of the reference.
Parameters:
iName
The name of the input.
iInput
The element to set as the new value of the input.
All types of