All Frameworks  Object Hierarchy  This Framework  Indexes   

InstanceFactory (Object)

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:

Method Index

AddInstance
Creates a new instance of a shape or hybrid shape.
BeginInstanceFactory
Initializes the instantiation process with the document containing the reference.
BeginInstantiate
Initializes the data of the reference.
EndInstanceFactory
Ends the instantiation process.
EndInstantiate
Ends the instantiation of the reference.
GetParameter
Retrieves a parameter of the reference by its name.
Instantiate
Instantiates the reference in the current document.
PutInputData
Sets a value to an input of the reference.

Methods


o Func AddInstance( iReference) As
Creates a new instance of a shape or hybrid shape.
Parameters:
iReference
The reference shape or hybrid shape.
Example:
This example creates the instance NewInstance in the part.
 Set NewInstance = instanceFactory.AddInstance(reference)
 
o Sub BeginInstanceFactory( iNameOfReference,
iNameOfDocument)
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:
 InstanceFactory.BeginInstanceFactory"NameOfReference","c:\tmp\NameOfDocument.CATPart"
 
o Sub BeginInstantiate()
Initializes the data of the reference.
Role: This is the first method of the second step of instantiation.
It is used to initialize all data of the reference in the factory.
Example:
The following example shows how to initialize the factory:
 InstanceFactory.BeginInstantiate
 
o Sub EndInstanceFactory()
Ends the instantiation process.
Role: Use this method to end the instantiation process.
In that method the document containing the reference is unlocked and released from the session.
Example:
The following example shows how to end the instantiation:
 InstanceFactory.EndInstanceFactory
 
o Sub EndInstantiate()
Ends the instantiation of the reference.
Role: This is the fifth and last method of the second step of instantiation.
It is used to end the instantiation: after this step, all the links to the reference are broken.
Example:
The following example shows how to end the instantiation:
 InstanceFactory.EndInstantiate
 
o Func GetParameter( iName) As
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")
 
o Func Instantiate() As
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.
Example:
The following example instantiates the reference:
 Set Instance = InstanceFactory.Instantiate
 
o Sub PutInputData( iName,
iInput)
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
Boundary object are possibly supported.
Example:
The following example sets a value to an input of the reference: The input is a point and its name is Input1.
 InstanceFactory.PutInputData "Input1",point1
 

Copyright © 2003, Dassault Systèmes. All rights reserved.