美文网首页
004 - Inventor装配体材料表输出及自定义属性的更新

004 - Inventor装配体材料表输出及自定义属性的更新

作者: 怪怪001 | 来源:发表于2023-11-17 07:40 被阅读0次

    背景:创建一个iLogic规则从最大装配体中生成一个excel格式的材料表清单。

     BOM表输出

    'Get the Filename of the file without the extension

    FileName = ThisDoc.FileName(False) 'without extension

    'Sets the path and filename of where the Exported BOM should be saved

    BOMFile = "C:\BOMs\" & FileName & ".xls"

    'Exports the BOM to the desired location

    ThisBOM.Export("Structured", BOMFile, kMicrosoftExcelFormat)

    'kMicrosoftAccessFormat = Microsoft Access

    'kMicrosoftExcelFormat = Microsoft Excel

    'kdBASEIIIFormat = dBASE III

    'kdBASEIVFormat = dBASE IV

    'kTextFileTabDelimitedFormat = Text File Tab Delimited

    'kTextFileCommaDelimitedFormat = Text File Comma Delimited

    'kUnicodeTextFileTabDelimitedFormat = Unicode Text File Tab Delimited

    'kUnicodeTextFileCommaDelimitedFormat = Unicode Text File Comma Delimited

    读取装配图的材料表信息并更新自定义属性值

    'Gets name of reference assembly from iProperties and identifies the spreadsheet to be read

    BOMFile = "C:\BOMs\" & iProperties.Value("Custom", "Assembly Name") & ".xls"

    'Gets the name of the model represented in the oldest view on the drawing

    modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)

    modelName = Strings.Left(modelName, modelName.Length - 4)

    'Reads information from the specified spreadsheet and places values in properties

    i = GoExcel.FindRow(BOMFile, "Sheet1", "Part Number", "=", modelName)

    iProperties.Value("Custom", "Item") = GoExcel.CurrentRowValue("Item")

    iProperties.Value("Custom", "QTY") = GoExcel.CurrentRowValue("QTY")

    'Updates the view

    iLogicVb.UpdateWhenDone = True

    相关文章

      网友评论

          本文标题:004 - Inventor装配体材料表输出及自定义属性的更新

          本文链接:https://www.haomeiwen.com/subject/imvywdtx.html