Design Table Functions

This package describes the functions you can use when working with design tables.

This page discusses:

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 you use it. The reading of sheet stops as soon as it finds an empty row. Fill in the first line of the table with column names (standard table format) or force the reading of the cells content using the ReadCells function.



In the opposite example, the third line starting with the empty cell is read because the format of the table is indicated by the first row.


In the opposite example, the reading stops at the first line because the first cell is empty.

  • 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.

Signature

CreateSheet(xlsOrTxtTable: String [, PRMCriterion: String, ..]) : DTSheetType

Arguments

NameInput / OutputRequired?TypeComment
xlsOrTxtTableInYesStringName of the .xls or .txt file.
PRMCriterionInNoString

ReturnType

DTSheetType

Example

In the example below, you are going to drive the Pad first length parameter using the CreateSheet keyword.

  1. Create an Excel file identical to the one below:
    ABC
    15mm5mm
    210mm20mm
    330mm40mm
  2. From the Compass, click Social and Collaborative Apps , and select Data Setup.
  3. Right-click the Knowledge Resources category in the Setup Data Tables tab, and select Create a new Resource table.
  4. In the KnowledgeResourcesxxx table, click Add a new resource item. A new resource is added to the table.
  5. Double-click the Logical Name cell and enter the resource name, Resource1 in our example.
  6. Double-click the Resource Type cell and select Sheet in the scrolling list.
  7. 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.
  8. Assign Knowledge Resources to the current project.
  9. Create a 3D Representation containing a Pad.
  10. 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
    }
    
  11. Right-click the action in the tree and select Action.1 object > Run.
  12. 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.

Signature

DTSheetType.CellAsBoolean(rowIndex: Integer, columnIndex: Integer) : Boolean

Arguments

NameInput / OutputRequired?TypeComment
rowIndexInYesIntegerConfiguration number. Integer from 1 to n.
columnIndexInYesIntegerIndex of the table column. Integer from 1 to n.

ReturnType

Boolean

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.

Signature

DTSheetType.CellAsReal(rowIndex: Integer, columnIndex: Integer) : Real

Arguments

NameInput / OutputRequired?TypeComment
rowIndexInYesIntegerConfiguration number (integer from 1 to n)
columnIndexInYesIntegerColumn number

ReturnType

Real

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.

Signature

DTSheetType.CellAsString(rowIndex: Integer, columnIndex: Integer) : String

Arguments

NameInput / OutputRequired?TypeComment
rowIndexInYesIntegerConfiguration number
columnIndexInYesIntegerColumn number

ReturnType

String

Example

CString=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).

Signature

DTSheetType.CloserConfig(columnName: String, sortType: String [, minValue: Literal, ..]) : Integer

Arguments

NameInput / OutputRequired?TypeComment
columnNameInYesStringColumns names in the design table source file.
sortTypeInYesStringStrings that can only take the following values : "<", "<=", ">", ">=", "==", "!="
minValueInNoLiteral

ReturnType

Integer

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 that:
  • 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.

Signature

DTSheetType.CloserInfConfig(columnName: String [, maxValue: Literal, ..]) : Integer

Arguments

NameInput / OutputRequired?TypeComment
columnNameInYesStringMust be put in quotes. It must correspond to a name of a column of the table.
maxValueInNoLiteralUnits must be specified.
Note: You can use this method with one couple (column name / value) or several couples.

ReturnType

Integer

Example

Given the design table below:

SketchRadius(mm)PadLim1(mm)PadLim2(mm)
11206010
21305030
31206020
41405040

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. Returns the configuration which contains the largest values greater than 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.

Signature

DTSheetType.CloserSupConfig(columnName: String [, minValue: Literal, ..]) : Integer

Arguments

NameInput / OutputRequired?TypeComment
columnNameInYesStringIndex of the table column. Integer from 1 to n.
minValueInNoLiteralValue searched for. Must be a real.

ReturnType

Integer

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

NameInput / OutputRequired?TypeComment
columnIndexInYesIntegerNumber or index of the table column. Integer from 1 to n.
valueInYesRealValue searched for. Must be a real.

ReturnType

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

NameInput / OutputRequired?TypeComment
columnIndexInYesIntegerIndex of the table column. Integer from 1 to n.
valueInYesRealValue searched for. Must be a real.

ReturnType

Real

Example

ValueSup=Relations\DesignTable1\sheet_name->CloserValueSupInColumn(1, 80mm)
Message(Closest sup value is # (0.08 is expected), ValueSup)

DTSheetType.ImportAttributes()

Imports attributes. This method is the equivalent of the Import button in the Formula editor.

Signature

DTSheetType.ImportAttributes(Father: Feature]) : List

Arguments

NameInput / OutputRequired?TypeComment
FatherInYesFeature

ReturnType

List

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.

Signature

DTSheetType.LocateInColumn(columnIndex: Integer, value: Literal) : Integer

Arguments

NameInput / OutputRequired?TypeComment
columnIndexInYesIntegerNumber or index of the table column. Integer from 1 to n.
valueInYesLiteralValue searched for. Can be a string or a Boolean.

ReturnType

Integer

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.

Signature

DTSheetType.LocateInRow(rowIndex: Integer, value: Literal) : Integer

Arguments

NameInput / OutputRequired?TypeComment
rowIndexInYesIntegerNumber or index of the table row. Integer from 1 to n.
valueInYesLiteralValue searched for. Can be a string or a Boolean.

ReturnType

Integer

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

NameInput / OutputRequired?TypeComment
columnIndexInYesInteger

ReturnType

Real

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

NameInput / OutputRequired?TypeComment
columnIndexInYesInteger

ReturnType

Real

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. This method is not available in the Formula, in the Rule and the Check editors.

Note: The index must start at 1 for the (1,1) cell to be located at the left top corner.

Signature

DTSheetType.SetCell(indexRow: Integer, indexColumn: Integer, cellValue: Literal)

Arguments

NameInput / OutputRequired?TypeComment
indexRowInYesInteger
indexColumnInYesInteger
cellValueInYesLiteral

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

NameInput / OutputRequired?TypeComment
valueOrFeatureInNoObjectTypeCorresponds 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() )