AdvisorAction.Run()
Runs a macro with arguments. It is up to you to check that the macro
which is run is not going to cause an infinite loop or result in a system
crash.
Signature
AdvisorAction.Run([valueOrFeature: ObjectType, ..])
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
valueOrFeature |
In |
No |
ObjectType |
Corresponds to the macro argument. Macros have
arguments that have a particular order. Values assigned to
arguments have to be passed in the same order. |
Example
You must have created the VB Script.1 macro before creating the rule below:
if PartBody\Pad.1.HasAttribute(String.1) == true
`VB Script.1` .Run(PartBody\Pad.1.GetAttributeString(String.1) ,PartBody\Pad.1.Name() )
AdvisorParameterSet.GetDrivingParameters()
You
can get driving parameters.
Signature
AdvisorParameterSet.GetDrivingParameters(DrivingParameters : List)
Arguments
| Name |
Input/Output |
Required? |
Type |
Comment |
DrivingParameters |
Out |
|
List |
-
|
DTSheetType.CellAsBoolean()
Applies to a design table sheet. Returns the contents of a cell located
in a column intended for Boolean values. Returns false if the cell does not contain
a Boolean or if the method arguments are not properly specified.
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
rowIndex |
In |
Yes |
Integer |
Configuration number. Integer from 1 to
n. |
columnIndex |
In |
Yes |
Integer |
Index of the table column. Integer from 1 to
n. |
Example
Boolean2=Relations\DesignTable1\sheet_name->CellAsBoolean(1,5)
if (Boolean2 <> true)
{
Message("Error !!!")
}
DTSheetType.CellAsReal()
Applies to a design table sheet. Returns the contents of a cell located
in a column intended for real values. Returns zero if the cell does not contain a
real or if the method arguments are not properly specified.
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
rowIndex |
In |
Yes |
Integer |
Configuration number (integer from 1 to n)
|
columnIndex |
In |
Yes |
Integer |
Column number |
DTSheetType.CellAsString()
Applies to a design table sheet. Returns the contents of a cell located
in a column. Returns an empty string if the cell is empty or if the method arguments
are not properly specified.
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
rowIndex |
In |
Yes |
Integer |
Configuration number |
columnIndex |
In |
Yes |
Integer |
Column number |
Example
CString=Relations\DesignTable1\sheet_name->CellAsString(1,5) if (CString == )
{
Message("No value read !!!")
}
DTSheetType.ClearSheet()
The
ClearSheet function is used to clear the contents of the sheet (DTSheetType) such as
a design table or product table.
Signature
DTSheetType.ClearSheet()
Example
//Retrieve the root object of current editor
let root(VPMReference)
root = GetEditorRoots("VPMReference").GetItem(1)
if (root == NULL)
exit
//Get the Design Table named "DesignTable" inside 3DPart
let myDesignTable (DesignTableType)
myDesignTable = root->Find("DesignTableType","x.Name==\"DesignTable\"",TRUE)
if(myDesignTable == NULL)
exit
let DesignTableSheet (DTSheetType)
DesignTableSheet = myDesignTable.Sheet
//Clear the sheet contents
DesignTableSheet.ClearSheet()
DTSheetType.CloserConfig()
Finds the closest configuration of a design table according to criteria
that mix greater than (or equal to) and smaller than (or equal to).
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
columnName |
In |
Yes |
String |
Columns names in the design table source
file. |
sortType |
In |
Yes |
String |
Strings that can only take the following
values : "<", "<=", ">", ">=", "==", "!=" |
minValue |
In |
No |
Literal |
|
Example
Sheet->CloserConfig("column1",
"<",
10mm, "column2",
">=",
20deg,
"column3",
"!=",
"standard")
The example above can be interpreted as follows:
- the value in column1 is
strictly smaller than 10mm
- the value in column2 is
greater than or equal to 20deg
- the value in column3 is
different from the standard string.
Note:
Remember:
- If several configurations are
valid, you will find the configuration whose values are as close as
possible to the "bounds". If still several configurations are valid, the
first valid one is returned.
- If no configuration is valid,
the returned value is 0.
DTSheetType.CloserInfConfig()
Applies to a design table sheet. Returns the configuration which
contains the largest values less or equal to the values of the given arguments. When
several configurations meet this condition, the method sorts out the possible
configurations with respect to the column order as it is specified in the argument
list.
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
columnName |
In |
Yes |
String |
Must be put in quotes. It must correspond to a
name of a column of the table. |
maxValue |
In |
No |
Literal |
Units must be specified. |
Note:
You can use this method with one couple (column name / value) or several
couples.
Example
Given the design table below:
| |
SketchRadius(mm) |
PadLim1(mm) |
PadLim2(mm) |
| 1 |
120 |
60 |
10 |
| 2 |
130 |
50 |
30 |
| 3 |
120 |
60 |
20 |
| 4 |
140 |
50 |
40 |
The statement below:
Relations\DesignTable1\sheet_name->CloserInfConfig(PadLim1,60mm, SketchRadius, 130mm, PadLim2, 40mm)
Returns 3.
The values of lines 1 , 2 and 3 are all less or equal to the values specified in
the method arguments.
- As the first parameter specified in
the argument list is PadLim1, the method scans the lines 1, 2 and 3 and
searches for the largest PadLim1 value which is less or equal to 60 mm. Two
configurations meet the condition: configuration 1 and configuration 3.
- As the second parameter specified
is SketchRadius, the method scans the configurations 1 and 3 and searches
for the largest SketchRadius value less or equal to 130 mm. Again, the
function finds two configurations meeting the criteria.
- Then it rescans lines 1 and 3 and
searches for the largest PadLim2 value less or equal to 40mm. The result is
line 3.
DTSheetType.CloserSupConfig()
Applies to a design table sheet. Scans the values of a column and
returns the greatest cell value which is the nearest to a specified one. Returns 0
if no value is found or if the method arguments are not properly
specified.
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
columnName |
In |
Yes |
String |
Index of the table column. Integer from 1 to
n. |
minValue |
In |
No |
Literal |
Value searched for. Must be a real. |
Example
ValueSup=Relations\DesignTable1\sheet_name->CloserValueSupInColumn(1, 80mm)
Message(Closest sup value is # (0.08 is expected), ValueSup)
DTSheetType.CloserValueInfInColumn()
Applies to a design table sheet. Scans the values of a column and
returns the smallest cell value which is the nearest to a specified one. Returns 0
if no value is found or if the method arguments are not properly
specified.
Signature
DTSheetType.CloserValueInfInColumn(columnIndex: Integer, value: Real) : Real
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
columnIndex |
In |
Yes |
Integer |
Number or index of the table column. Integer
from 1 to n. |
value |
In |
Yes |
Real |
Value searched for. Must be a real. |
Example
Message(Closest inf value is # , Relations\DesignTable1\ sheet_name->CloserValueInfInColumn(2,41mm))
DTSheetType.CloserValueSupInColumn()
Applies to a design table sheet. Scans the values of a column and
returns the greatest cell value which is the nearest to a specified one. Returns 0
if no value is found or if the method arguments are not properly
specified.
Signature
DTSheetType.CloserValueSupInColumn(columnIndex: Integer, value: Real) : Real
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
columnIndex |
In |
Yes |
Integer |
Index of the table column. Integer from 1 to
n. |
value |
In |
Yes |
Real |
Value searched for. Must be a real. |
Example
ValueSup=Relations\DesignTable1\sheet_name->CloserValueSupInColumn(1, 80mm)
Message(Closest sup value is # (0.08 is expected), ValueSup)
DTSheetType.CreateMapFromColumns()
The CreateMapFromColumns method transforms the data from a spreadsheet/csv to
the key-value pair in the Map. Multiple columns of a spreadsheet/csv can be used to
form a combined key which gets appended with a hyphen sign in the map. Retrieve the
value from the map of a combined key by concatenating all columns specified for the
key with a hyphen sign. See the example below.
Signature
DTSheetType.CreateMapFromColumns(iKeyList: List, iColumnValue: String) : Map
Table 1. Arguments
| Name |
Input/Output |
Required? |
Type |
Comment |
oMap |
Out |
Yes |
Map |
Map
containing the transformed data from spreadsheet/csv. |
iKeyList |
In |
Yes |
List |
List containing column names of spreadsheet/csv
which are consolidated to form a key. |
iColumnValue |
In |
Yes |
String |
Inputs column name from the spreadsheet/csv which
will form the list containing values for the map. |
Example
// Defines a sheet
Let sheet (DTSheetType)
Let filePath (String)
Let columnValue (String)
Let iKeyList (List)
Let oMap (Map)
Let combinedKey (String)
Let getCombinedKeyValue (String)
filePath = "D:\\MapReadExcel.xlsx"
sheet = CreateSheet(filePath)
columnValue = “B”
iKeyList.Append(“Color”)
iKeyList.Append(“R”)
oMap = sheet ->CreateMapFromColumns(iKeyList, columnValue)
combinedKey = “pink-255” // The keys are appended with a ‘-‘ hyphen sign in case of combined key
getCombinedKeyValue = oMap->Get(combinedKey)
DTSheetType.Filter()
The
filter function filters the items in the Design Table (DT) sheet such as design and
product tables.
Signature
DTSheetType.Filter(type : String, List : List:)
Arguments
| Name |
Input/Output |
Required? |
Type |
Comment |
type |
In |
Yes |
String |
Query to make. |
List |
Out |
Yes |
List |
List of output items. |
Examples
//Search for 3Dpart in database
let results(List)
let currentResult(PLMQueryResult)
let myQuery (PLMQuery)
let PartWithSheet(VPMReference)
//Create Generic model search query based on V_Name search
myQuery = CreatePLMQuery("VPMReference")
myQuery->AddCriterion("V_Name","3DPart")
results = myQuery->RunQuery()
//We check whether exist a unique generic model.
if (results.Size() <> 1)
exit
currentResult = results[1]
set PartWithSheet = currentResult->LoadResult()
if(PartWithSheet == NULL)
exit
//Get the Design Table named "DesignTable" inside 3DPart
let fmlDesignTable (DesignTableType)
fmlDesignTable = PartWithSheet->Find("DesignTableType","x.Name==\"DesignTable\"",TRUE)
if(fmlDesignTable == NULL)
exit
let DesignTableSheet (DTSheetType)
DesignTableSheet = fmlDesignTable.Sheet
// Running first query
let query (string)
query = "PadLength >= 50mm AND Frequency >= 14"
Trace(1,"Query to run : ", query)
let sheetout(list)
sheetout = DTSheetType.Filter(query)
Trace(3,"Number of filtered items from sheet: ", sheetout.Size())
let i = 0
for i inside sheetout
{
Trace(3,"Row number for first query : ", i)
}
// Running second query
query = "PadLength >= 50mm OR Frequency <= 14"
Trace(1,"Query to run : ", query)
sheetout = DTSheetType.Filter(query)
Trace(3,"Number of filtered items from sheet: ", sheetout.Size())
for i inside sheetout
{
Trace(3,"Row number for second query : ", i)
}
// Running third query
query = "PadLength >= 50mm OR Name == \"Config_1\""
Trace(1,"Query to run : ", query)
sheetout = DTSheetType.Filter(query)
Trace(3,"Number of filtered items from sheet: ", sheetout.Size())
for i inside sheetout
{
Trace(3,"Row number for third query : ", i)
}
// Running fourth query
query = "PadLength >= .04m OR Name == \"Config_1\""
Trace(1,"Query to run : ", query)
sheetout = DTSheetType.Filter(query)
sheetout = DTSheetType.Filter(query)
Trace(3,"Number of filtered items from sheet: ", sheetout.Size())
for i inside sheetout
{
Trace(3,"Row number for third query : ", i)
}
// Running fifth query
query = "PadLength > 50mm AND Frequency >9 AND Name <> \"config10\""
Trace(1,"Query to run : ", query)
sheetout = DTSheetType.Filter(query)
Trace(3,"Number of filtered items from sheet: ", sheetout.Size())
for i inside sheetout
{
Trace(3,"Row number for third query : ", i)
}
DTSheetType.ImportAttributes()
Imports attributes. This method is the equivalent of the Import button
in the Formula editor.
Signature
DTSheetType.ImportAttributes(Father: Feature]) : List
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
Father |
In |
Yes |
Feature |
|
Example
let DT(SheetType)
DT=CreateSheet("KnowledgeResources|AAA")
DT->ImportAttributes(PartBody)
DTSheetType.LocateInColumn()
Applies to a design table sheet. Returns the index of the first row
which contains a specified value. Returns zero if the value is not found or if the
method arguments are not properly specified.
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
columnIndex |
In |
Yes |
Integer |
Number or index of the table column. Integer
from 1 to n. |
value |
In |
Yes |
Literal |
Value searched for. Can be a string or a
Boolean. |
Example
Line=Relations\DesignTable1\sheet_name->LocateInColumn(4,11mm)
if (Line == 0)
{
Message("No value found !!!")
}
DTSheetType.LocateInRow()
Applies to a design table sheet. Returns the index of the first row
which contains a specified value. Returns zero if the value is not found or if the
method arguments are not properly specified.
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
rowIndex |
In |
Yes |
Integer |
Number or index of the table row. Integer from
1 to n. |
value |
In |
Yes |
Literal |
Value searched for. Can be a string or a
Boolean. |
DTSheetType.MaxInColumn()
Applies to a design table sheet. Returns the greatest of a column
values. Returns 0 if the column does not contain numerical values or if the method
arguments are not properly specified.
Signature
DTSheetType.MaxInColumn(columnIndex: Integer) : Real
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
columnIndex |
In |
Yes |
Integer |
|
Example
MaximumValue=Relations\DesignTable1\sheet_name->MaxInColumn(1)
Message(Maximum value is # (0.150 is expected), MaximumValue)
DTSheetType.MinInColumn()
Applies to a design table sheet. Returns the smallest of a column
values. Returns 0 if the column specified is out of range.
Signature
DTSheetType.MinInColumn(columnIndex: Integer) : Real
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
columnIndex |
In |
Yes |
Integer |
|
Example
MinimumValue=sheet->MinInColumn(3)
Message(Minimum value is # (0 is expected), MinimumValue)
/* you can use also */
Message(Minimum value is # (0 is expected), MinInColumn(3))
DTSheetType.SetCell()
Enables you to fill in a cell at a given position in an Excel file or a
tab file.
Note:
Remember that:
- This method is not available in the
Formula, in the Rule and the Check editors.
- The index must start at 1 for the
(1,1) cell to be located at the left top corner.
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
indexRow |
In |
Yes |
Integer |
|
indexColumn |
In |
Yes |
Integer |
|
cellValue |
In |
Yes |
Literal |
|
DTSheetType.ReadCells()
This method forces the area of cells that is known by the sheet (by
default, the number of columns depends on the first empty column header and reading
cells stops when an empty row is found). With this method, you can control the
number of rows and columns that are actually read. It returns an error if the sheet
is a design table sheet. The sheetindex is not taken into account for text
files.
Signature
DTSheetType.ReadCells(indexRow : Integer, indexColumn : Integer, sheetIndex (for xls) : Integer)
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
indexRow |
In |
Yes |
Integer |
|
indexColumn |
In |
Yes |
Integer |
|
sheetIndex (for xls) |
In |
Yes |
Integer |
|
DesignTableType.AddRowWithParmValues()
Enables you to add a row to a design table.
-
Signature
DesignTableType.AddRowWithParmValues()
Example
let dt (designtabletype)
dt = Relations\mydt
dt->AddRowWithParmValues()
ProductTableType.ApplyProductTableConfigWithDeleteMode()
The ApplyProductTableConfigWithDeleteMode method lets
you apply a product table
configuration.
If
a product table is present in a product that is the result of an engineering
template instantiation and not saved after instantiation, the configuration row is
applied in Delete Product instances mode. Otherwise, it is
launched in Associative mode, which deactivates
instances. At the end of the application of configuration rows, you can delete
the product table. This is only applicable when the apply row
happens in Delete Product instance mode.
Signature
ProductTableType.ApplyProductTableConfigWithDeleteMode(iConfigRow : Integer, iDeleteProductTable : Boolean]) : Void
Arguments
| Name |
Input/Output |
|
Type |
Comment |
iConfigRow |
In |
|
Integer |
Product
table Configuration row to apply. |
iDeleteProductTable |
In |
|
Boolean |
Option to tell whether to delete a product table after
apply row.
TRUE: Delete Product Table.
FALSE: Keep Product Table. Deleted product instances' columns
become neutral.
Default value is TRUE.
|
Example
//Get Editor roots
let roots(List)
let rootOfEditor(VPMReference)
roots = GetEditorRoots("VPMReference")
if roots->Size() == 1
{
rootOfEditor = roots[1]
}
//Search product table in current product.
let myPT(ProductTableType)
myPT = rootOfEditor->Find("ProductTableType","",TRUE)
if myPT<>NULL
{
//Applies the second row of product table with Delete product instances Delete Product Table option
myPT.ApplyProductTableConfigWithDeleteMode(2,TRUE)
//After this line, myPT will be NULL as product table is deleted by above method
//Applies the second row of product table with Delete product instances with keep product Table option
myPT.ApplyProductTableConfigWithDeleteMode(2,FALSE)
}
VBScript.Run()
Enables you to run a macro with arguments. It is up to you to check
that the macro which is run is not going to cause an infinite loop or result in a
system crash.
Signature
VBScript.Run([valueOrFeature: ObjectType, ..])
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
valueOrFeature |
In |
No |
ObjectType |
Corresponds to the macro argument. Macros have
arguments that have a particular order. Values assigned to
arguments have to be passed in the same order. |
Example
You must have created the VB Script.1 macro before creating the rule below:
if PartBody\Pad.1.HasAttribute(String.1) == true
`VB Scripts.1` .Run(PartBody\Pad.1 .GetAttributeString(String.1),PartBody\Pad.1.Name() )
GetRepresentationDataSize
The GetRepresentationDataSize method provides you the
disk size of data representations in EKL.
Signature
GetRepresentationDataSize([iListRepresentationIDs]: List), Storage capacity
Arguments
| Name |
Input / Output |
Required? |
Type |
Comment |
iListRepresentationIDs |
In |
Yes |
List |
List of PLMEntityID of
VPMReference only representations are
supported. |
Note:
The input list is inavalid if:
- The list is empty.
- At least one item in the list is not a representation.
Example 1
let iPLMIdentificator(PLMEntityID)
let representationIDs(List)
let size_representations(STORAGE_CAPACITY)
//if user has a physical ID. User can create PLMEntityID with physical ID of VPMRepReference.
set iPLMIdentificator = new("PLMEntityID","MyPLMID", NULL, "9FF2FF11000023C4638EE1C900014ECE")
representationIDs.Append(iPLMIdentificator)
size_representations = GetRepresentationDataSize(representationIDs)
Example 2
let size_representations(STORAGE_CAPACITY)
let repQuery(PLMQuery)
let repQueryResults(List)
repQuery = CreatePLMQuery("VPMRepReference")
//User Searches a VPMRepReference with V_Name starting with Toto
repQuery.AddCriterion("V_Name", "Toto*")
repQueryResults = repQuery->RunQuery()
//if PLMQueryResult is a PLMEntityID. User donot need to load it.
if repQueryResults.Size() > 0
{
size_representations = GetRepresentationDataSize(repQueryResults)
}
Example 3
let iPLMIdentificator(String)
let representationIDs(List)
let size_representations(STORAGE_CAPACITY)
//if user has a physical ID. User can directly append it to the input list.
iPLMIdentificator = "9FF2FF11000023C4638EE1C900014ECE"
representationIDs.Append(iPLMIdentificator)
size_representations = GetRepresentationDataSize(representationIDs)
|