|
Declaración
|
Parámetros
|
Descripción
|
||
|---|---|---|---|---|
|
get (idpath, propName, categoryName)
|
• {string|string[]} idpath: Ruta de ID como '/0/1', o matriz de rutas de ID ['/0/1', '/0/2'].
• {string|string[]} propName: (Opcional) Por ejemplo, 'Display Name' o ['Display Name', 'Part ID Path'].
• {string|string[]} categoryName: (Opcional) Por ejemplo, 'PROE Parameters'.
|
Obtiene un objeto de metadatos que representa la ruta de ID o los valores de propiedad de idpath y propName dados.
Esta función devuelve el objeto de metadatos que representa la idpath dada. Si se da propName, devuelve el valor de la propiedad del componente.
Ejemplo:
PTC.Metadata.fromId('model-1').then( (metadata) => {
|
||
|
getProp (propName, categoryName)
|
• {string|string[]} propName: (Opcional) Por ejemplo, 'Display Name' o ['Display Name', 'Part ID Path'].
• {string|string[]} categoryName: (Opcional) Por ejemplo, 'PROE Parameters'.
|
Esta función devuelve todos los valores de las propiedades string de un solo componente, o bien sin definir si no hay datos o componentes disponibles. Si el valor de propName dado era una matriz, devuelve string[] de valores.
Ejemplo:
PTC.Metadata.fromId('model-1').then( (metadata) => {
|
||
|
getCategory (categoryName)
|
• {string} categoryName
|
Esta función devuelve el objeto con todos los nombres de propiedades y valores de la categoría dada.
Ejemplo:
PTC.Metadata.fromId('model-1').then( (metadata) => {
|
||
|
getSelected (selectFunc)
|
• {function} selectFunc: (Opcional) Función que controla los valores indicados en la matriz que se devuelve. Se da idpath a la función y un argumento y metadatos actuales como:
`this` function(idpath) {
|
Esta función devuelve una matriz del resultado devuelto por el valor de selectFunc dado. Si selectFunc está sin definir, devuelve string[] de rutas de ID.
Ejemplo:
PTC.Metadata.fromId('model-1').then( (metadata) => {
|
||
|
find (propName, category)
|
• {string} propName (obligatorio)
• {string} category (opcional)
|
Busca componentes basados en valores de propiedades. Consulte también findCustom a continuación.
Devuelve un buscador de componentes según la categoría y el valor dado de propName.
Ejemplo:
La comparación puede ser como la que se indica a continuación:
- startsWith,like,sameAs,unlike : string comparison |
||
|
findCustom (whereFunc, selectFunc)
|
• {function} whereFunc (obligatorio)
• {function} selectFunc (opcional)
|
Consulte también find arriba.
Esta función devuelve un buscador de componentes según el valor personalizado de whereFunc. El ejemplo siguiente busca todos los componentes con depth<2 o con un nombre similar a 'ASM'.
Ejemplo:
|
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", …}
|
Método
|
Descripción
|
|---|---|
|
Al pulsar o al modificar
|
Active la extracción de metadatos desde botones, entradas de texto o elementos de selección mediante una expresión de evento.
1. Escriba getMetadata() en el cuadro JS para el evento Pulsar
.
2. A continuación, utilice el siguiente fragmento:
$scope.getMetadata = function(args) {
|
|
Al cargar la vista
|
Para extraer metadatos una vez que la vista se haya cargado por completo, utilice el evento $ionicView.afterEnter:
$scope.$on("$ionicView.afterEnter", (args) => {
|