|
宣言
|
パラメータ
|
説明
|
||
|---|---|---|---|---|
|
get (idpath、propName、categoryName)
|
• {string|string[]} idpath - '/0/1' などの ID パス、または ['/0/1', '/0/2'] などの ID パスの配列。
• {string|string[]} propName - (オプション) 例: 'Display Name' または ['Display Name', 'Part ID Path']
• {string|string[]} categoryName - (オプション) 例: 'PROE Parameters'
|
指定された idpath および propName の ID パスまたはプロパティ値を表すメタデータオブジェクトを取得します。
この関数は、指定された idpath を表すメタデータオブジェクトを返します。propName が指定されている場合は、コンポーネントのプロパティの値が返されます。
例:
PTC.Metadata.fromId('model-1').then( (metadata) => {
|
||
|
getProp (propName、categoryName)
|
• {string|string[]} propName - (オプション) 例: 'Display Name' または ['Display Name', 'Part ID Path']
• {string|string[]} categoryName - (オプション) 例: 'PROE Parameters'
|
この関数は、1 つのコンポーネントからのすべての文字列プロパティの値を返します。使用可能なデータ/コンポーネントがない場合は未定義になります。指定した propName が配列の場合、値の string[] を返します。
例:
PTC.Metadata.fromId('model-1').then( (metadata) => {
|
||
|
getCategory (categoryName)
|
• {string} categoryName
|
この関数は、指定されたカテゴリからのすべてのプロパティ名と値を持つオブジェクトを返します。
例:
PTC.Metadata.fromId('model-1').then( (metadata) => {
|
||
|
getSelected (selectFunc)
|
• {function} selectFunc - (オプション) 関数は、返された配列に格納される値を制御します。関数には、idpath および引数と現在のメタデータが次のように指定されます:
`this` function(idpath) {
|
この関数は、指定された selectFunc によって返されるアイテムの配列が返されます。selectFunc が未定義の場合は、ID パスの string[] を返します。
例:
PTC.Metadata.fromId('model-1').then( (metadata) => {
|
||
|
find (propName、category)
|
• {string} propName - (必須)
• {string} category - (オプション)
|
プロパティ値に基づいてコンポーネントを検索します。以下の findCustom も参照してください。
指定された propName および category に基づいてコンポーネントのファインダーを返します。
例:
次のような比較が考えられます:
- startsWith,like,sameAs,unlike : string comparison |
||
|
findCustom (whereFunc、selectFunc)
|
• {function} whereFunc - (必須)
• {function} selectFunc - (オプション)
|
上記の find も参照してください。
この関数は、カスタム whereFunc に基づくコンポーネントのファインダーを返します。次の例では、depth<2 を持つすべてのコンポーネント、または 'ASM' のような名前を持つすべてのコンポーネントが検索されます。
例:
|
PTC.Metadata.fromId('model-1').then (metadata) => {
metadata.get('/0/6', 'Display Name')
=> "BLOWER.ASM"
metadata.get('/0/6'). getCategory ('__PV_SystemProperties')
=> {Component Name: "BLOWER.ASM", Display Name: "BLOWER.ASM", OL File Name: "", Part Depth: "3", Part ID: "6", …}
metadata.find('Display Name').like('PRT')
=> {id: "model-1", _friendlyName: "Display Name like PRT", _selectedPaths: Array(26)}
metadata.find('Display Name').like('PRT').find('Part Depth').in(0,3)
=> {id: "model-1", _friendlyName: "Display Name like PRT AND Part Depth in 0-3", _selectedPaths: Array(10)}
var meta = metadata.find('Part Depth').greaterThan(4);
meta.getSelected();
=>["/0", "/0/1", "/0/1/2", "/0/6"]
var selectFunc = function(idpath) {
return metadata.get(idpath, 'Display Name');
}
meta.getSelected(selectFunc);
=> ["PISTON.PRT", "PISTON_PIN.PRT", "CONNECTING_ROD.PRT"]
metadata.find('Part Depth').greaterThan(4).getSelected(selectFunc)
=> ["PISTON.PRT", "PISTON_PIN.PRT", "CONNECTING_ROD.PRT"]
var selectFunc = function(idpath) {
return metadata.get(idpath, 'Display Name');
}
metadata.find('Part Depth').greaterThan(4, selectFunc)
=> ["PISTON.PRT", "PISTON_PIN.PRT", "CONNECTING_ROD.PRT"]
var selectFunc = function(idpath) {return metadata.get(idpath, 'Display Name');}
metadata.find('Part Depth').greaterThan(4, selectFunc)
=> ["PISTON.PRT", "PISTON_PIN.PRT", "CONNECTING_ROD.PRT"]
var selectFunc = function(idpath) {return metadata.get(idpath, 'Display Name');}
metadata.find('Display Name').like('PISTON', selectFunc)
=> ["PISTON.ASM", "PISTON.PRT", "PISTON_PIN.PRT"]
var whereFunc = function(idpath) {
const depth = metadata.get(idpath, 'Part Depth')
const name = metadata.get(idpath, 'Display Name')
return parseFloat(depth) > 4 || (name && name.search('PISTON') >= 0)
}
var selectFunc = function(idpath) {return metadata.get(idpath, 'Display Name');}
metadata.findCustom(whereFunc,selectFunc)
=>["PISTON.ASM", "PISTON.PRT", "PISTON_PIN.PRT", "CONNECTING_ROD.PRT"]
var selectFunc = function(idpath) {
return metadata.get(idpath).getCategory('__PV_SystemProperties');
}
metadata.find('Part Depth').greaterThan(4, selectFunc)
=> (3) [{…}, {…}, {…}]
0: {Component Name: "PISTON.PRT", Display Name: "PISTON.PRT", OL File Name: "l-Creo 3D_0_ac-40_asm_5.ol" …}
1: {Component Name: "PISTON_PIN.PRT", Display Name: "PISTON_PIN.PRT", OL File Name: "l-Creo 3D_0_ac-40_asm_6.ol",…}
2: {Component Name: "CONNECTING_ROD.PRT", Display Name: "CONNECTING_ROD.PRT", OL File Name: "l-Creo 3D_0_ac-40_asm_7.ol", …}
|
アプローチ
|
説明
|
|---|---|
|
クリックイベントまたは変更イベント
|
イベント定義式を使用して、ボタン、入力、または選択の要素からメタデータのフェッチを呼び出します。
1. 「クリック」イベントの「JS」ボックスに「getMetadata()」と入力します
.
2. その後、次のスニペットを使用します
$scope.getMetadata = function(args) {
|
|
ビューのロード
|
ビューが完全にロードされた後でメタデータをフェッチするには、$ionicView.afterEnter イベントを使用します
$scope.$on("$ionicView.afterEnter", (args) => {
|