ImportManager
You can import features from a representation into another with the option of keeping the position in the new instance or keeping a link to the original feature. The two main import options are: as reference and contextual import.
Name | Input/Output | Type | Comment |
---|---|---|---|
SourcePathString |
In | Feature/String | The input feature or path string to be copied (mandatory). |
TargetPathString |
In | Feature/String | The location where the result feature is created (mandatory). |
ImportResult |
Out | Feature | The copied feature. |
ImportWithLink |
In | Boolean | Creates a link between the source and result features. |
IsImportContextual |
In | Boolean | Keeps the source feature position when creating the result feature (default to FALSE). |
ExecutionStatus |
Out | Integer |
|
ExecutionMessage |
Out | String | The message that contains warnings and errors. |
CreateImport |
— | Function | Creates the new feature and valuates the result feature, the execution status, and the message. |
Create Import as Reference
To create an import as reference, meaning without taking the source feature spatial transformation into account, provide the SourcePathString, TargetPathString, valuate the options and get the result. For example:
// Create the manager let KnowlImportManager(ImportManager) KnowlImportManager = new(“KnowledgeImportManager”, “ImportManager”, NULL) // Get the source feature to copy and target location, either by code or by selection // let sourceToCopy, target (Feature) // Give them to the manager KnowlImportManager.SourcePathString = sourceToCopy KnowlImportManager.TargetPathString = target // Create the import KnowlImportManager.CreateImport() // Display the return code let exitStatus(Integer) let exitMsg(String) existStatus = KnowlImportManager.ExecutionStatus exitMsg = KnowlImportManager.ExecutionMessage Notify(“Import exited with status: #”, exitStatus) Notify(“Message: #”, exitMsg) // Get the import result if exitStatus <= 1 { let importResult(Feature) importResult = KnowlImportManager.ImportResult Message(“Feature created is #”, importResult.Name) }
Create a Contextual Import
To create a contextual import, meaning taking the spatial transformation of the source feature into account within the if required occurrence, modify the script above. Provide the feature path strings and the occurrence containing both representations. For example:
let rootOccurrence(ProductOccurrence) // can also be a VPMReference // Get the root occurrence // ... KnowlImportManager.PathRoot = rootOccurrence KnowlImportManager.SourcePathString = “path\to\source” KnowlImportManager.TargetPathString = “path\to\target” KnowlImportManager.IsImportContextual = TRUE
Link the Source Feature and the Result Feature
Link the source feature and the result feature by using the following script:
// Keep link with source KnowlImportManager.ImportWithLink = TRUE