CreateSheet
Creates a volatile sheet that can be used
in EKL to manipulate a sheet document stored in the database.
The document is retrieved using an identifier that is the row
identifier in the Knowledge Resources Table in Data Setup.
The function can return a NULL value, you must therefore test it before using it.
- The first line of sheets handled in EKL is supposed to contain the column names and cannot be accessed through the cell access functions
- The expected name is the internal one.
- Install Excel if you want to use this function with an .xls file.
SignatureCreateSheet(xlsOrTxtTable: String [, PRMCriterion: String, ..]) : DTSheetType
Arguments
Name | Input / Output | Required? | Type | Comment |
xlsOrTxtTable | In | Yes | String | Name of the .xls or .txt file. |
PRMCriterion | In | No | String | |
ExampleIn the example below, you are going to drive the Pad first length
parameter using the CreateSheet keyword.
- Create an Excel file identical to the one below:
- From the Compass, click Social and Collaborative
Apps
, and select Data Setup.
- Right-click the Knowledge Resources category in the
Setup Data
Tables tab, and select Create a new Resource table.
- In the KnowledgeResourcesxxx table, click
Add a new resource item. A
new resource is added to the table.
- Double-click the Logical Name cell and enter the resource name, Resource1 in our example.
- Double-click the Resource Type cell and select
Sheet in the
scrolling list.
- Click the From file tab, double-click the Resource cell and click Import in the Select a
Sheet for item Resource1 dialog box. Click OK twice.
- Assign Knowledge Resources to the current project.
- Create a 3D Representation containing a Pad.
- Enter the Engineering Rules Capture app and create an Action. Enter the following arguments into the editor
and click OK when done.
let s(DTSheetType)
s = CreateSheet("KnowledgeResources|resource1")
if (s <> NULL)
{
P.FirstLength = s.CellAsReal(Row, Column) * 1mm
}
- Right-click the action in the tree and select Action.1 object > Run.
- Make the appropriate selection in the 3D area and in the tree.
The Pad First length is driven by the parameters entered in the Excel
file.
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. |
ExampleBoolean2=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 |
ExampleCString=Relations\DesignTable1\sheet_name->CellAsString(1,5) if (CString == )
{
Message("No value read !!!")
}
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 | |
ExampleSheet->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.
Notes:
- 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.
ExampleGiven 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. |
ExampleValueSup=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.
SignatureDTSheetType.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. |
ExampleMessage(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.
SignatureDTSheetType.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. |
ExampleValueSup=Relations\DesignTable1\sheet_name->CloserValueSupInColumn(1, 80mm)
Message(Closest sup value is # (0.08 is expected), ValueSup)
DTSheetType.CommitChanges()
Enables you to flush and save the data in the sheet, which is present
in the cache after a modification.
Signature
Sheet.CommitChanges()VoidType
Example
let doc (PLMDMTDocument)
let query (PLMQuery)
let results (List)
let result (PLMQueryResult)
query = CreatePLMQuery("PLMDMTDocument")
query>AddCriterion("PLM_ExternalID","vdoc00000001_7ED40E13-0001-164C-6114CE1F00048DED")
results = query->RunQuery()
if (results.Size() == 1)
{
set result = results[1]
let path (String)
set doc = result->LoadResult()
path = doc->CheckOut()
Message(path)
let sh (DTSheetType)
sh = CreateSheet(path, "")
sh->SetCell(1, 1, "My val without read cell")
sh->CommitChanges()
doc->CheckIn(path)
}
else
Message("result not found")
DTSheetType.ImportAttributes()
Imports attributes. This method is
the equivalent of the Import button in the Formula editor.
SignatureDTSheetType.ImportAttributes(Father: Feature]) : List
Arguments
Name | Input / Output | Required? | Type | Comment |
Father | In | Yes | Feature | |
Examplelet 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. |
ExampleLine=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.
SignatureDTSheetType.MaxInColumn(columnIndex: Integer) : Real
Arguments
Name | Input / Output | Required? | Type | Comment |
columnIndex | In | Yes | Integer | |
ExampleMaximumValue=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.
SignatureDTSheetType.MinInColumn(columnIndex: Integer) : Real
Arguments
Name | Input / Output | Required? | Type | Comment |
columnIndex | In | Yes | Integer | |
ExampleMinimumValue=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:
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 | |
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.
SignatureVBScript.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. |
ExampleYou 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() )
|