|
|
이 API를 사용하려면 모델을 가져올 때 경험이 CAD 메타데이터에 액세스할 수 있도록 허용합니다 확인란을 선택해야 합니다.
|
PTC.Structure.fromId(‘model-1’).then( (structure) => {
// Do something with ‘structure’
});
|
선언
|
매개 변수
|
설명
|
|---|---|---|
|
getBounds(idpath)
|
• {string|string[]} idpath - '/0/1'과 같은 id 경로, 또는 id 경로의 배열 ['/0/1', '/0/2'].
• {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) => {
|
|
getLocation(idpath)
|
• {string|string[]} propName - (선택 사항) 예: 'Display Name' 또는 ['Display Name', 'Part ID Path']
• {string|string[]} categoryName - (선택 사항) 예: 'PROE Parameters'
|
이 함수는 단일 컴포넌트의 모든 문자열 속성 값을 반환하거나, 사용 가능한 데이터/컴포넌트가 없는 경우 정의되지 않습니다. 지정된 propName이 배열일 경우 값의 string[]을 반환합니다.
예:
PTC.Metadata.fromId('model-1').then( (metadata) => {
|
|
속성
|
설명
|
|---|---|
|
min
|
경계 상자의 최소 범위로, x, y 및 z 속성을 가진 객체와 이 세 가지 값을 배열로 반환하는 asArray 메서드로 표현됩니다.
예:
PTC.Structure.fromId(‘model-1’).then( (structure) => {
|
|
max
|
경계 상자의 최대 범위로, x, y 및 z 속성을 가진 객체와 이 세 가지 값을 배열로 반환하는 asArray 메서드로 표현됩니다.
예:
PTC.Structure.fromId(‘model-1’).then( (structure) => {
|
|
center
|
경계 상자의 중심점으로, x, y 및 z 속성을 가진 객체와 이 세 가지 값을 배열로 반환하는 asArray 메서드로 표현됩니다.
예:
PTC.Structure.fromId(‘model-1’).then( (structure) => {
|
|
corners
|
경계 상자의 8개 꼭짓점의 배열로, 각각 x, y 및 z 속성을 가진 객체와 이 세 가지 값을 배열로 반환하는 asArray 메서드로 표현됩니다.
예:
PTC.Structure.fromId(‘model-1’).then( (structure) => {
|
|
선언
|
매개 변수
|
설명
|
|---|---|---|
|
transform(위치, 회전, 배율)
|
• {number[]|string[]|string} position - 필수 변환의 위치 컴포넌트로 세 개의 숫자 배열([0,0,5]), 숫자를 나타내는 문자열 배열([‘0’,’0’,’5’]) 또는 쉼표로 구분된 세 개의 숫자로 이루어진 단일 문자열(‘0,0,5’)로 제공됩니다.
• {number[]|string[]|string} rotation - 필수 변환의 회전 컴포넌트로 세 개의 숫자 배열([0,0,5]), 숫자를 나타내는 문자열 배열([‘0’,’0’,’5’]) 또는 쉼표로 구분된 세 개의 숫자로 이루어진 단일 문자열(‘0,0,5’)로 제공됩니다.. 생략할 경우 회전 변환이 적용되지 않습니다.
• {number[]|string[]|string|number} scale - 필수 변환의 배율 컴포넌트로 세 개의 숫자 배열([0,0,5]), 숫자를 나타내는 문자열 배열([‘0’,’0’,’5’]), 쉼표로 구분된 세 개의 숫자로 이루어진 단일 문자열(‘0,0,5’) 또는 균일한 배율 계수를 제공하는 단일 숫자로 제공됩니다.. 생략할 경우 배율 계수 1이 사용됩니다.
|
지정된 위치, 회전 및 배율 변환을 거친 후 원래 경계 상자를 둘러싸는 축 정렬 경계 상자를 나타내는 새 bounds 객체를 반환합니다.
원래 bounds 객체는 이 작업에 의해 변경되지 않은 상태로 유지됩니다.
예:
PTC.Structure.fromId(‘model-1’).then( (structure) => {
|
|
속성
|
설명
|
|---|---|
|
matrix
|
위치를 나타내는 4x4 변환 행렬로 열 우선 배열로 표현됩니다.
|
|
position
|
위치의 위치 컴포넌트로, x, y 및 z 속성을 가진 객체와 이 세 가지 값을 배열로 반환하는 'asArray' 메서드로 표현됩니다.
예:
PTC.Structure.fromId(‘model-1’).then( (structure) => {
|
|
rotation
|
위치의 회전 컴포넌트로 회전 객체로 표현됩니다.
예:
PTC.Structure.fromId(‘model-1’).then( (structure) => {
|
|
선언
|
매개 변수
|
설명
|
|---|---|---|
|
transform(위치, 회전, 배율)
|
• {number[]|string[]|string} position - 필수 변환의 위치 컴포넌트로 세 개의 숫자 배열([0,0,5]), 숫자를 나타내는 문자열 배열([‘0’,’0’,’5’]) 또는 쉼표로 구분된 세 개의 숫자로 이루어진 단일 문자열(‘0,0,5’)로 제공됩니다.
• {number[]|string[]|string} rotation - 필수 변환의 회전 컴포넌트로 세 개의 숫자 배열([0,0,5]), 숫자를 나타내는 문자열 배열([‘0’,’0’,’5’]) 또는 쉼표로 구분된 세 개의 숫자로 이루어진 단일 문자열(‘0,0,5’)로 제공됩니다.. 생략할 경우 회전 변환이 적용되지 않습니다.
• {number[]|string[]|string|number} scale - 필수 변환의 배율 컴포넌트로 세 개의 숫자 배열([0,0,5]), 숫자를 나타내는 문자열 배열([‘0’,’0’,’5’]), 쉼표로 구분된 세 개의 숫자로 이루어진 단일 문자열(‘0,0,5’) 또는 균일한 배율 계수를 제공하는 단일 숫자로 제공됩니다.. 생략할 경우 배율 계수 1이 사용됩니다.
|
지정된 위치, 회전 및 배율 변환을 거친 후 원래 위치를 나타내는 새 위치 객체를 반환합니다.
원래 location 객체는 이 작업에 의해 변경되지 않은 상태로 유지됩니다.
예:
PTC.Structure.fromId(‘model-1’).then( (structure) => {
|
|
속성
|
설명
|
|---|---|
|
matrix
|
회전을 나타내는 3x3 회전 행렬로 열 우선 배열로 표현됩니다.
|
|
선언
|
매개 변수
|
설명
|
|---|---|---|
|
asEuler ()
|
회전의 오일러 표현을 가져옵니다. x, y 및 z 속성을 가진 객체와 이 세 가지 값을 배열로 반환하는 asArray 메서드로 표현됩니다. 값은 도 단위입니다.
예:
PTC.Structure.fromId(‘model-1’).then( (structure) => {
|
// Get the Structure information for model-1
PTC.Structure.fromId('model-1').then ( (structure) => {
// Get the properties of the 'model-1' widget
var widgetProps = $scope.view.wdg['model-1'];
// Get the bounding box information for part '/0/6'
var bbox = structure.getBounds('/0/6');
// Transform the bounding box to account for the 'model-1' widget's location
var xform_bbox = bbox.transform(
[widgetProps.x, widgetProps.y, widgetProps.z],
[widgetProps.rx, widgetProps.ry, widgetProps.rz],
widgetProps.scale);
// Move '3DImage-1' to the center of the bounding box
$scope.view.wdg['3DImage-1'].x = xform_bbox.center.x;
$scope.view.wdg['3DImage-1'].y = xform_bbox.center.y;
$scope.view.wdg['3DImage-1'].z = xform_bbox.center.z;
// Get the location information for part '/0/2/8'
var loc = structure.getLocation('/0/2/8');
// Transform the location to account for the 'model-1' widget's location
var xform_loc = loc.transform(
[widgetProps.x, widgetProps.y, widgetProps.z],
[widgetProps.rx, widgetProps.ry, widgetProps.rz],
widgetProps.scale);
// Get the rotational component as euler angles
var rot = xform_loc.rotation.asEuler();
// Rotate '3DImage-2' to match the rotation
$scope.view.wdg['3DImage-2'].rx = rot.x;
$scope.view.wdg['3DImage-2'].ry = rot.y;
$scope.view.wdg['3DImage-2'].rz = rot.z;
});