3DE 知识工程 - 使用 EKL 创建产品节点树
立即下载
资源介绍:
源代码及参考文件
iRoot : VPMReference
--------------------------
let i(Integer)
let nodeLevel(String)
let nodeName(String)
let nodeType(String)
let rowData(List)
let currentLevel1(VPMReference)
let currentLevel2(VPMReference)
let currentLevel3(VPMReference)
let nodeInstance(VPMInstance)
let dataSheet(DTSheetType)
dataSheet = CreateSheet("D:\XX产品节点树.csv")
let dataList(List)
for i = 1 while i <=999
{
nodeLevel = dataSheet->CellAsString(i, 1)
if nodeLevel == "" break
nodeName = dataSheet->CellAsString(i, 2)
nodeType = dataSheet->CellAsString(i, 3)
dataList.Append(List(nodeLevel, nodeName, nodeType))
}
for i = 1 while i <= dataList->Size()
{
set rowData = dataList->GetItem(i)
set nodeLevel = rowData->GetItem(1)
set nodeName = rowData->GetItem(2)
set nodeType = rowData->GetItem(3)
if nodeLevel == "1"
{
if nodeType == "产品"
{
set nodeInstance = new("VPMReference", nodeName, iRoot)
set currentLevel1 = nodeInstance.Reference
}
else if nodeType == "零件"
{
new("3DPart", nodeName, iRoot)
}
}
else if nodeLevel == "2"
{
if nodeType == "产品"
{
set nodeInstance = new("VPMReference", nodeName, currentLevel1)
set currentLevel2 = nodeInstance.Reference
}
else if nodeType == "零件"
{
new("3DPart", nodeName, currentLevel1)
}
}
else if nodeLevel == "3"
{
if nodeType == "产品"
{
set nodeInstance = new("VPMReference", nodeName, currentLevel2)
set currentLevel3 = nodeInstance.Reference
}
else if nodeType == "零件"
{
new("3DPart", nodeName, currentLevel2)
}
}
}