모델 정보 조회
모델 정보 조회를 위한 Plugin API 예제입니다.
지정된 개체 정보 조회
지정된 인덱스의 개체 정보를 반환합니다.
GetObject
NodeVO item = Connector.GetObject(4);
NodeType nodeType = item.NodeType; // NODE(ASSEMBLY), PART
string nodeName = item.NodeName;
int nodeIndex = item.Index;
int nodeId = item.Id;
전체 개체 목록 조회 (List)
현재 조회 중인 모델의 전체 개체를 반환합니다.
GetAllObjects
List<NodeVO> items = Connector.GetAllObjects();
foreach (NodeVO item in items)
{
// 처리 로직
}
전체 개체 목록 조회 (Dictionary)
현재 조회 중인 모델의 전체 개체를 Dictionary 형식으로 반환합니다.
GetAllObjectsMap
Dictionary<int, NodeVO> nodeIndexMap;
Dictionary<int, NodeVO> nodeIdMap;
Dictionary<int, List<NodeVO>> childNodeMap;
Connector.GetAllObjectsMap(
out nodeIndexMap,
out nodeIdMap,
out childNodeMap
);
전체 PART 노드 목록 조회
전체 파트(PART) 형식의 노드 목록을 반환합니다.
GetAllParts
List<NodeVO> items = Connector.GetAllParts();
foreach (NodeVO item in items)
{
// 처리 로직
}
보이는 PART 목록 조회
현재 로딩된 모델 중 보이는 파트(PART) 목록을 반환합니다.
GetVisibleParts
List<NodeVO> items = Connector.GetVisibleParts();
foreach (NodeVO item in items)
{
// 처리 로직
}
보이는 개체 목록 조회
현재 로딩된 모델 중 보이는 개체 목록을 반환합니다.
GetVisibleObjects
List<NodeVO> items = Connector.GetVisibleObjects();
foreach (NodeVO item in items)
{
// 처리 로직
}
부모 노드가 보이는 상태인 경우
자식 노드는 포함하지 않고 반환됩니다.
선택된 개체 목록 조회
현재 모델에서 선택된 개체 목록을 반환합니다.
GetSelectedObjects
List<NodeVO> items = Connector.GetSelectedObjects(false);
foreach (NodeVO item in items)
{
// 처리 로직
}
true: 부모 노드 선택 시 자식 노드 포함false: 부모 노드 선택 시 자식 노드 미포함
선택된 PART 목록 조회
선택된 모델 중 파트(PART) 형식만 반환합니다.
GetSelectedParts
List<NodeVO> items = Connector.GetSelectedParts();
foreach (NodeVO item in items)
{
// 처리 로직
}
개체 구조(Hierarchy) 조회
지정된 개체의 모델 구조를 반환합니다.
GetObjectStructure
int index = Connector.GetSelectedParts()[0].Index;
List<NodeVO> items = Connector.GetObjectStructure(index);
// 정전개
for (int i = items.Count - 1; i >= 0; i--)
{
MessageBox.Show(items[i].NodeName);
}
// 역전개
foreach (NodeVO item in items)
{
MessageBox.Show(item.NodeName);
}
하위 노드 조회
지정된 개체의 하위 노드를 반환합니다.
GetChildObjects
List<NodeVO> selectedItems = Connector.GetSelectedObjects(false);
// 하위 노드만
List<NodeVO> children = Connector.GetChildObjects(
selectedItems[0].Index,
ChildrenTypes.Children
);
// 하위 전체 노드
List<NodeVO> allChildren = Connector.GetChildObjects(
selectedItems[0].Index,
ChildrenTypes.All_Children
);
영역 내 개체 조회
지정된 BoundBox 영역 내에 포함된 개체 목록을 반환합니다.
GetObjectsInArea
ObjectsPropertyVO prop = Connector.GetSelectedObjectsProperty();
float[] minmax =
{
(float)prop.MinPoint.X,
(float)prop.MinPoint.Y,
(float)prop.MinPoint.Z,
(float)prop.MaxPoint.X,
(float)prop.MaxPoint.Y,
(float)prop.MaxPoint.Z
};
// 영역에 완전히 포함된 경우
List<int> fullyContained = Connector.GetObjectsInArea(
minmax,
new int[] { },
CrossBoundBox.Fullycontained
);
// 일부라도 포함된 경우
List<int> partiallyContained = Connector.GetObjectsInArea(
minmax,
new int[] { },
CrossBoundBox.IncludingPart
);