Solidworks学习笔记-链接Solidworks

Name Description 备注
Configuration Gets or sets the name of configuration for this BOM table.   获取或设置此 BOM 表的配置名称。
DetailedCutList Gets or sets whether to show the detailed cut list in this BOM table.   获取或设置是否在此 BOM 表中显示详细的切割清单。
DisplayAsOneItem Gets or sets whether all of the configurations appear with the same item number if the BOM table contains components that have multiple configurations.   获取或设置如果 BOM 表包含具有多个配置的组件,是否所有配置都显示为相同的项目编号。
FollowAssemblyOrder2 Gets or sets whether the order of the item numbers in the BOM follows the order in which the assembly appears in the FeatureManager design tree.   获取或设置 BOM 中项目编号的顺序是否遵循装配体在 FeatureManager 设计树中出现的顺序。
KeepCurrentItemNumbers Gets or sets whether item numbers are kept with their components when reordering rows of a BOM table.   获取或设置在对 BOM 表的行重新排序时是否将项目编号与其组件一起保留。
KeepMissingItems Gets and sets the Keep Missing Items option for this BOM feature.   获取和设置此 BOM 功能的保留缺失项选项。
KeepReplacedCompOption Gets or sets how to replace components when keeping missing items.   获取或设置在保留缺失项时如何替换组件。
Name Gets the name of this BOM table feature.   获取此 BOM 表特征的名称。
NumberingTypeOnIndentedBOM Gets and sets the type of numbering for this indented BOM table.   获取和设置此缩进 BOM 表的编号类型。
PartConfigurationGrouping Gets and sets the part configuration grouping for this BOM table.   获取和设置此 BOM 表的零件配置分组。
RoutingComponentGrouping Gets or sets the routing component grouping options for this BOM table in a drawing of an assembly containing routing components.   获取或设置包含步路零部件的装配体工程图中此 BOM 表的步路零部件分组选项。
SequenceStartNumber Gets or sets the number with which to start the numbering for this BOM table.   获取或设置用于开始此 BOM 表编号的编号。
StrikeoutMissingItems Inserts a horizontal line through missing items in this BOM table (also called strike outs).   在此 BOM 表中的缺失项目(也称为删除线)之间插入一条水平线。
TableType Gets and sets the type of table for the Bill of Materials.   获取和设置材料明细表的表格类型。
ZeroQuantityDisplay Gets or sets the character or value to display when a value is 0 in this BOM table.   获取或设置当此 BOM 表中的值为 0 时要显示的字符或值。
This example shows how to export a BOM's second column to a BOM Table Area of a SOLIDWORKS MBD 3D PDF.//----------------------------------------------------------------------------
// Preconditions:
// 1. Verify that:
//    * specified assembly,
//    * specified SOLIDWORKS MBD 3D PDF theme, and
//    * c:\temp exist.
// 2. Open an Immediate window.
//
// Postconditions:
// 1. Inserts an indented BOM table in the assembly.
// 2. Gets the title of the second column in the BOM table
//    to export that column to the SOLIDWORKS MBD 3D PDF.
// 3. Gets the name of the BOM to map to the SOLIDWORKS
//    MBD 3D PDF.
// 4. Gets the SOLIDWORKS MBD 3D PDF data object.
//    a. Sets to display the SOLIDWORKS MBD 3D PDF after
//       publishing it.
//    b. Sets the path for the SOLIDWORKS MBD 3D PDF.
//    c. Sets the SOLIDWORKS MBD 3D PDF theme.
//    d. Sets the standard views for the SOLIDWORKS MBD 3D PDF.
//    e. Maps the BOM and exports its second column to a BOM
//       Table Area in the SOLIDWORKS MBD 3D PDF.
//    f. Publishes and displays the SOLIDWORKS MBD 3D PDF.
// 5. Examine c:\temp\MBDAssembly1.PDF and the Immediate window.
//
// NOTE: Because the assembly is used elsewhere, do not save changes.
//---------------------------------------------------------------------------
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System.Runtime.InteropServices;
using System;
using System.Diagnostics;namespace Macro1CSharp.csproj
{public partial class SolidWorksMacro{ public void Main(){ModelDoc2 swModel = default(ModelDoc2);ModelDocExtension swModelDocExt = default(ModelDocExtension);BomTableAnnotation swBOMAnnotation = default(BomTableAnnotation);TableAnnotation swTableAnnotation = default(TableAnnotation);BomFeature swBOMFeature = default(BomFeature);MBD3DPdfData swMBDPdfData = default(MBD3DPdfData);string fileName = null;int errors = 0;int warnings = 0;int bomType = 0;string tableTemplate = null;string[] columnNames = new string[1];object columns = null;string BOMTableName = null;object standardViews = null;int[] viewIDs = new int[3];int nbrBOMTableAreas = 0;fileName = "C:\\Users\\Public\\Documents\\SOLIDWORKS\\SOLIDWORKS 2018\\samples\\tutorial\\advdrawings\\bladed shaft.sldasm";swModel = (ModelDoc2)swApp.OpenDoc6(fileName, (int)swDocumentTypes_e.swDocASSEMBLY, (int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", ref errors, ref warnings);swModelDocExt = (ModelDocExtension)swModel.Extension;// Insert indented BOM table in assemblybomType = (int)swBomType_e.swBomType_Indented;tableTemplate = "C:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS\\lang\\english\\bom-standard.sldbomtbt";swBOMAnnotation = (BomTableAnnotation)swModelDocExt.InsertBomTable3(tableTemplate, 0, 1, bomType, "Default", false, (int)swNumberingType_e.swNumberingType_Detailed, true);// Get title of second column in BOM table to export to SOLIDWORKS MBD 3D PDFswTableAnnotation = (TableAnnotation)swBOMAnnotation;columnNames[0] = swTableAnnotation.GetColumnTitle(1);Debug.Print("Title of second column to export to SOLIDWORKS MBD 3D PDF: " + columnNames[0]);columns = (object)columnNames;// Get name of BOM to map to SOLIDWORKS MBD 3D PDFswBOMFeature = (BomFeature)swBOMAnnotation.BomFeature;BOMTableName = swBOMFeature.Name;Debug.Print("Name of BOM to map to SOLIDWORKS MBD 3D PDF: " + BOMTableName);// Get MBD3PdfData objectswMBDPdfData = (MBD3DPdfData)swModelDocExt.GetMBD3DPdfData();// Set to display SOLIDWORKS MBD 3D PDF swMBDPdfData.ViewPdfAfterSaving = true;// Set path for SOLIDWORKS MBD 3D PDFswMBDPdfData.FilePath = "c:\\temp\\MBDAssembly1.PDF";// Set SOLIDWORKS MBD 3D PDF themeswMBDPdfData.ThemeName = "c:\\program files\\solidworks corp\\solidworks\\data\\themes\\simple assembly (a4, landscape)\\theme.xml";// Set standard views for SOLIDWORKS MBD 3D PDFviewIDs[0] = (int)swStandardViews_e.swFrontView;viewIDs[1] = (int)swStandardViews_e.swTopView;viewIDs[2] = (int)swStandardViews_e.swDimetricView;standardViews = (object)viewIDs;swMBDPdfData.SetStandardViews(standardViews);// Map BOM and export its second column to BOM Table Area nbrBOMTableAreas = swMBDPdfData.GetBomAreaCount();if (nbrBOMTableAreas > 0){swMBDPdfData.SetBomTable(0, BOMTableName, columns);}// Publish SOLIDWORKS MBD 3D PDFswModelDocExt.PublishTo3DPDF(swMBDPdfData);}/// <summary>///  The SldWorks swApp variable is pre-assigned for you./// </summary>public SldWorks swApp;}
}
This example shows how to get and set the routing component grouping options for this BOM table in a drawing of an assembly containing routing components.//----------------------------------------------------------------------------------
// Preconditions:
// 1. Open public_documents\samples\tutorial\api\AutoRouteThroughSketchEntities.sldddrw.
// 2. Open the Immediate window.
//
// Postconditions:
// 1. Selects the Bill of Materials1 feature.
// 2. Examine the Immediate window.
//
// NOTE: Because the drawing is used elsewhere, do not save changes.
//---------------------------------------------------------------------------------using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System.Runtime.InteropServices;
using System;
using System.Diagnostics;namespace Macro1CSharp.csproj
{public partial class SolidWorksMacro{public void Main(){ModelDoc2 swModel = default(ModelDoc2);ModelDocExtension swModelDocExt = default(ModelDocExtension);SelectionMgr swSelMgr = default(SelectionMgr);BomFeature swBomFeature = default(BomFeature);bool status = false;int options = 0;swModel = (ModelDoc2)swApp.ActiveDoc;swModelDocExt = (ModelDocExtension)swModel.Extension;status = swModelDocExt.SelectByID2("Bill of Materials1", "BOMFEATURE", 0, 0, 0, false, 0, null, 0);swSelMgr = (SelectionMgr)swModel.SelectionManager;swBomFeature = (BomFeature)swSelMgr.GetSelectedObject6(1, -1);Debug.Print("Name of configuration used for BOM table: " + swBomFeature.Configuration);//Get current routing component grouping optionsDebug.Print("Current routing component grouping options: " + swBomFeature.RoutingComponentGrouping);//Set new routing component grouping optionsoptions = (int)swRoutingComponentGroupingOption_e.swShowOnlyRoutingComponentsInBOM + (int)swRoutingComponentGroupingOption_e.swDisplayUnitsInBOM;swBomFeature.RoutingComponentGrouping = options;Debug.Print("Modified routing component grouping options: " + swBomFeature.RoutingComponentGrouping);}/// <summary>///  The SldWorks swApp variable is pre-assigned for you./// </summary>public SldWorks swApp;}
}
Name Description 备注
GetConfigurationCount Gets the number of configurations available to this BOM table or used in this BOM table.   获取可用于此 BOM 表或在此 BOM 表中使用的配置数。
GetConfigurations Gets the configurations available to this BOM table or used in this BOM table.   获取可用于此 BOM 表或在此 BOM 表中使用的配置。
GetFeature Gets the BOM table feature.   获取 BOM 表功能。
GetReferencedModelName Gets the name of the model referenced by this BOM feature.   获取此 BOM 特征引用的模型的名称。
GetTableAnnotationCount Gets the number of BOM table annotations for this BOM table feature.   获取此 BOM 表功能的 BOM 表注释数量。
GetTableAnnotations Gets the BOM table annotations for this BOM table feature.   获取此 BOM 表特征的 BOM 表注释。
IGetConfigurations Gets the configurations available to this BOM table or used in this BOM table.   获取可用于此 BOM 表或在此 BOM 表中使用的配置。
IGetTableAnnotations Gets the BOM table annotations for this BOM table feature.   获取此 BOM 表特征的 BOM 表注释。
ISetConfigurations Sets the configurations used in this BOM table.   设置此 BOM 表中使用的配置。
SetConfigurations Sets the configurations used in this BOM table.   设置此 BOM 表中使用的配置。
SOLIDWORKS manages Bills of Materials (BOM) and controls the information within them. You can extract this information for use in downstream systems such as ERP or other business systems.In SOLIDWORKS 2004 and later, BOMs are now features and appear during a traversal of the FeatureManager design tree. This example shows how to get to each BOM in a drawing document and save the BOM information to an XML file. You can transform this XML file using XSL or transfer the file to other systems.//----------------------------------------------------------------------
// Preconditions:
// 1. Open a drawing document with at least on BOM.
// 2. Add a reference to Microsoft Scripting Runtime (right-click
//    the name of the project in the Project Explorer and click Add Reference >
//    the Browse tab > C:\windows\system32\scrrun.dll > OK.
//
// Postconditions:
// 1. Saves an XML file to the folder where the drawing document resides,
//    overwriting any existing file of the same name.
// 2. Examine the folder where the drawing document resides.
//
// NOTES:
// * XML tags are based on BOM column headings.
// * Invalid characters must be removed from the
//   column headings.
//  * XML schema is:
//            <BOMS>
//                <SHEET>
//                    <NAME>Sheet1</NAME>
//                    <BOM>
//                        <NAME>Bill Of Materials1</NAME>
//                        <TABLE>
//                            <ROW>
//                                <ITEM_NO>1</ITEM_NO>
//                                <PART_NUMBER>2004_Part</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>2</QTY>
//                            </ROW>
//                            <ROW>
//                                <ITEM_NO>2</ITEM_NO>
//                                <PART_NUMBER>2004_Part</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                            <ROW>
//                                <ITEM_NO>3</ITEM_NO>
//                                <PART_NUMBER>2004_Part</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                            <ROW>
//                                <ITEM_NO>4</ITEM_NO>
//                                <PART_NUMBER>bead7</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                        </TABLE>
//                    </BOM>
//                </SHEET>
//                <SHEET>
//                    <NAME>Sheet2</NAME>
//                    <BOM>
//                        <NAME>Bill Of Materials2</NAME>
//                        <TABLE>
//                            <ROW>
//                                <ITEM_NO>1</ITEM_NO>
//                                <PART_NUMBER>Assem3</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                            <ROW>
//                                <ITEM_NO></ITEM_NO>
//                                <PART_NUMBER>  cylinder</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                            <ROW>
//                                <ITEM_NO></ITEM_NO>
//                                <PART_NUMBER>  cylinder</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                            <ROW>
//                                <ITEM_NO></ITEM_NO>
//                                <PART_NUMBER>  SimpleCube_A</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                            <ROW>
//                                <ITEM_NO></ITEM_NO>
//                                <PART_NUMBER>  JoinedCyl</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                        </TABLE>
//                    </BOM>
//                    <BOM>
//                        <NAME>Bill Of Materials3</NAME>
//                        <TABLE>
//                            <ROW>
//                                <ITEM_NO>8</ITEM_NO>
//                                <PART_NUMBER>2004_Part</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>2</QTY>
//                            </ROW>
//                        </TABLE>
//                        <TABLE>
//                            <ROW>
//                                <ITEM_NO>9</ITEM_NO>
//                                <PART_NUMBER>2004_Part</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                            <ROW>
//                                <ITEM_NO>10</ITEM_NO>
//                                <PART_NUMBER>2004_Part</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                        </TABLE>
//                        <TABLE>
//                            <ROW>
//                                <ITEM_NO>11</ITEM_NO>
//                                <PART_NUMBER>bead7</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                        </TABLE>
//                    </BOM>
//                    <BOM>
//                        <NAME>Bill Of Materials4</NAME>
//                        <TABLE>
//                            <TITLE>BOM Table 2</TITLE>
//                            <ROW>
//                                <ITEM_NO>1</ITEM_NO>
//                                <PART_NUMBER>cylinder</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                            <ROW>
//                                <ITEM_NO>2</ITEM_NO>
//                                <PART_NUMBER>cylinder</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                        </TABLE>
//                        <TABLE>
//                            <TITLE>BOM Table 2</TITLE>
//                            <ROW>
//                                <ITEM_NO>3</ITEM_NO>
//                                <PART_NUMBER>SimpleCube_A</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                            <ROW>
//                                <ITEM_NO>4</ITEM_NO>
//                                <PART_NUMBER>JoinedCyl</PART_NUMBER>
//                                <DESCRIPTION></DESCRIPTION>
//                                <QTY>1</QTY>
//                            </ROW>
//                        </TABLE>
//                    </BOM>
//                </SHEET>
//            </BOMS>
//----------------------------------------------------------------------using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System.Runtime.InteropServices;
using System;
using Scripting;
using System.Diagnostics;namespace XMLCsharp.csproj
{public partial class SolidWorksMacro{public void Main(){ModelDoc2 swModel = default(ModelDoc2);DrawingDoc swDraw = default(DrawingDoc);Feature swFeat = default(Feature);BomFeature swBomFeat = default(BomFeature);string sPathName = null;bool bIsFirstSheet = false;Scripting.FileSystemObject fso = default(Scripting.FileSystemObject);Scripting.TextStream XMLfile = default(Scripting.TextStream);swModel = (ModelDoc2)swApp.ActiveDoc;swDraw = (DrawingDoc)swModel;bIsFirstSheet = true;// Strip off SOLIDWORKS file extension (slddrw)// and add XML extension (xml)sPathName = swModel.GetPathName();//sPathName = Strings.Left(sPathName, Strings.Len(sPathName) - 6);sPathName = sPathName.Substring(0, sPathName.Length - 6);sPathName = sPathName + "xml";//fso = Interaction.CreateObject("Scripting.FileSystemObject");fso = new Scripting.FileSystemObject();XMLfile = fso.CreateTextFile(sPathName, true, true);XMLfile.WriteLine("<BOMS>");swFeat = (Feature)swModel.FirstFeature();while ((swFeat != null)){if ("DrSheet" == swFeat.GetTypeName()){XMLfile.WriteLine("    <SHEET>");XMLfile.WriteLine("        <NAME>" + swFeat.Name + "</NAME>");bIsFirstSheet = false;}if ("BomFeat" == swFeat.GetTypeName()){swBomFeat = (BomFeature)swFeat.GetSpecificFeature2();ProcessBomFeature(swApp, swModel, swBomFeat, XMLfile);}swFeat = (Feature)swFeat.GetNextFeature();if ((swFeat != null)){if ("DrSheet" == swFeat.GetTypeName() & !bIsFirstSheet){XMLfile.WriteLine("    </SHEET>");}}}XMLfile.WriteLine("    </SHEET>");XMLfile.WriteLine("</BOMS>");XMLfile.Close();}public void ProcessTableAnn(SldWorks swApp, ModelDoc2 swModel, TableAnnotation swTableAnn, Scripting.TextStream XMLfile){int nNumRow = 0;int nNumCol = 0;int nNumHeader = 0;string[] sHeaderText = null;int j = 0;int k = 0;int nIndex = 0;int nCount = 0;int nStart = 0;int nEnd = 0;int nSplitDir = 0;nNumHeader = swTableAnn.GetHeaderCount();Debug.Assert(nNumHeader >= 1);nSplitDir = swTableAnn.GetSplitInformation(ref nIndex, ref nCount, ref nStart, ref nEnd);if ((int)swTableSplitDirection_e.swTableSplit_None == nSplitDir){Debug.Assert(0 == nIndex);Debug.Assert(0 == nCount);Debug.Assert(0 == nStart);Debug.Assert(0 == nEnd);nNumRow = swTableAnn.RowCount;nNumCol = swTableAnn.ColumnCount;nStart = nNumHeader;nEnd = nNumRow - 1;}else{Debug.Assert((int)swTableSplitDirection_e.swTableSplit_Horizontal == nSplitDir);Debug.Assert(nIndex >= 0);Debug.Assert(nCount >= 0);Debug.Assert(nStart >= 0);Debug.Assert(nEnd >= nStart);nNumCol = swTableAnn.ColumnCount;if (1 == nIndex){// Add header offset for first portion of tablenStart = nStart + nNumHeader;}}XMLfile.WriteLine("            <TABLE>");if (swTableAnn.TitleVisible){XMLfile.WriteLine("                <TITLE>" + swTableAnn.Title + "</TITLE>");}sHeaderText = new string[nNumCol];for (j = 0; j <= nNumCol - 1; j++){sHeaderText[j] = (string)swTableAnn.GetColumnTitle2(j, true);// Replace invalid characters for XML tagssHeaderText[j] = sHeaderText[j].Replace(".", "");sHeaderText[j] = sHeaderText[j].Replace(" ", "_");}for (j = nStart; j <= nEnd; j++){XMLfile.WriteLine("                <ROW>");for (k = 0; k <= nNumCol - 1; k++){XMLfile.WriteLine("                    " + "<" + sHeaderText[k] + ">" + swTableAnn.get_Text2(j, k, true) + "</" + sHeaderText[k] + ">");}XMLfile.WriteLine("                </ROW>");}XMLfile.WriteLine("            </TABLE>");}public void ProcessBomFeature(SldWorks swApp, ModelDoc2 swModel, BomFeature swBomFeat, Scripting.TextStream XMLfile){Feature swFeat = default(Feature);object[] vTableArr = null;object vTable = null;TableAnnotation swTable = default(TableAnnotation);swFeat = (Feature)swBomFeat.GetFeature();XMLfile.WriteLine("        <BOM>");XMLfile.WriteLine("            <NAME>" + swFeat.Name + "</NAME>");vTableArr = (object[])swBomFeat.GetTableAnnotations();foreach (object vTable_loopVariable in vTableArr){vTable = vTable_loopVariable;swTable = (TableAnnotation)vTable;ProcessTableAnn(swApp, swModel, swTable, XMLfile);}XMLfile.WriteLine("        </BOM>");}/// <summary>///  The SldWorks swApp variable is pre-assigned for you./// </summary>public SldWorks swApp;}
}
This example shows how to get the components in each row of a BOM table annotation.//-----------------------------------------------------------------------------
// Preconditions:
// 1. Open public_documents\samples\tutorial\assemblyvisualize\food_processor.sldasm.
// 2. Make a drawing from the assembly.
// 3. Click Insert > Tables > Bill of Materials.
// 4. Ensure that Parts only in Bom Type is selected.
// 5. Ensure that Display configurations of the same part separate items
//    in Part Configuration Grouping is selected.
// 6. Click OK.
// 7. Click anywhere in the drawing to insert the BOM table.
//
// Postconditions:
// 1. Gets the Bill of Materials1 feature.
// 2. Gets the Default configuration.
// 3. Processes the BOM table for the Default configuration.
// 4. Examine the Immediate window.
//
// NOTE: Because the assembly is used elsewhere, do not save changes.
//-----------------------------------------------------------------------------
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
namespace Macro1CSharp.csproj
{partial class SolidWorksMacro{ public void ProcessTableAnn(SldWorks swApp, ModelDoc2 swModel, TableAnnotation swTableAnn, string ConfigName){int nNumRow = 0;int J = 0;int I = 0;string ItemNumber = null;string PartNumber = null;bool RowLocked;double RowHeight;Debug.Print("   Table Title: " + swTableAnn.Title);nNumRow = swTableAnn.RowCount;BomTableAnnotation swBOMTableAnn = default(BomTableAnnotation);swBOMTableAnn = (BomTableAnnotation)swTableAnn;for (J = 0; J <= nNumRow - 1; J++){RowLocked = swTableAnn.GetLockRowHeight(J);RowHeight = swTableAnn.GetRowHeight(J);Debug.Print("   Row Number " + J + " (height = " + RowHeight + "; height locked = " + RowLocked + ")");Debug.Print("     Component Count: " + swBOMTableAnn.GetComponentsCount2(J, ConfigName, out ItemNumber, out PartNumber));Debug.Print("       Item Number: " + ItemNumber);Debug.Print("       Part Number: " + PartNumber);object[] vPtArr = null;Component2 swComp = null;object pt = null;vPtArr = (object[])swBOMTableAnn.GetComponents2(J, ConfigName);if (((vPtArr != null))){for (I = 0; I <= vPtArr.GetUpperBound(0); I++){pt = vPtArr[I];swComp = (Component2)pt;if ((swComp != null)){Debug.Print("           Component Name: " + swComp.Name2);Debug.Print("           Configuration Name: " + swComp.ReferencedConfiguration);Debug.Print("           Component Path: " + swComp.GetPathName());}else{Debug.Print("  Could not get component.");}}}}}public void ProcessBomFeature(SldWorks swApp, ModelDoc2 swModel, BomFeature swBomFeat){Feature swFeat = default(Feature);object[] vTableArr = null;object vTable = null;string[] vConfigArray = null;object vConfig = null;string ConfigName = null;TableAnnotation swTable = default(TableAnnotation);object visibility = null;swFeat = swBomFeat.GetFeature();vTableArr = (object[])swBomFeat.GetTableAnnotations();foreach (TableAnnotation vTable_loopVariable in vTableArr){vTable = vTable_loopVariable;swTable = (TableAnnotation)vTable;vConfigArray = (string[])swBomFeat.GetConfigurations(true, ref visibility);foreach (object vConfig_loopVariable in vConfigArray){vConfig = vConfig_loopVariable;ConfigName = (string)vConfig;Debug.Print(" Component for Configuration: " + ConfigName);ProcessTableAnn(swApp, swModel, swTable, ConfigName);}}}public void Main(){ModelDoc2 swModel = default(ModelDoc2);DrawingDoc swDraw = default(DrawingDoc);Feature swFeat = default(Feature);BomFeature swBomFeat = default(BomFeature);swModel = (ModelDoc2)swApp.ActiveDoc;swDraw = (DrawingDoc)swModel;swFeat = (Feature)swModel.FirstFeature();while ((swFeat != null)){if ("BomFeat" == swFeat.GetTypeName()){Debug.Print("Feature Name: " + swFeat.Name);swBomFeat = (BomFeature)swFeat.GetSpecificFeature2();ProcessBomFeature(swApp, swModel, swBomFeat);}swFeat = (Feature)swFeat.GetNextFeature();}}public SldWorks swApp;}
}

IBomFeature Interface相关推荐

  1. Go 学习笔记(71)— Go 接口 interface (接口定义、接口实现、接口调用、值接收者、指针接收者)

    1. 接口的定义 接口是和调用方的一种约定,它是一个高度抽象的类型,不用和具体的实现细节绑定在一起.接口要做的是定义好约定,告诉调用方自己可以做什么,但不用知道它的内部实现,这和我们见到的具体的类型如 ...

  2. Static interface methods are only supported starting with Android N (--min-api 24): void okhttp3.log

    错误内容如下 Error: Static interface methods are only supported starting with Android N (--min-api 24): vo ...

  3. Go 学习笔记(35)— Go 接口 interface (接口声明、接口初始化、接口方法调用、接口运算、类型断言、类型查询、空接口)

    1. 接口概念 接口是双方约定的一种合作协议.接口实现者不需要关心接口会被怎样使用,调用者也不需要关心接口的实现细节.接口是一种类型,也是一种抽象结构,不会暴露所含数据的格式.类型及结构. 接口内部存 ...

  4. Go 学习笔记(4)— Go 标识符、数据类型之间转换、布尔型、整型、浮点型、interface 类型

    1. 标识符整体分类 Go 标识符整体分类如下图所示: 2. 数据类型分类 Go 语言按类别有以下几种数据类型: 类型 描述 布尔型 布尔型的值只可以是常量 true 或者 false 数字类型 整型 ...

  5. php 类 接口的区别吗,PHP的接口类(interface)和抽象类(abstract)的区别

    /** * 接口类:interface * 其实他们的作用很简单,当有很多人一起开发一个项目时,可能都会去调用别人写的一些类, * 那你就会问,我怎么知道他的某个功能的实现方法是怎么命名的呢,这个时候 ...

  6. java interface list_你了解注解内的@interface List么

    Annotation, Multi-valued annotation, nested annotation, 多值注解, 嵌套注解 今天在研究Spring MVC的Validation机制时(这里 ...

  7. TypeScript学习笔记之 接口(Interface)

    在java中,接口是用来定义一些规范,使用这些接口,就必须实现接口中的方法,而且接口中的属性必须是常量. javascript中是没有接口的概念的.所以TypeScript在编译成 JavaScrip ...

  8. 演示:思科IPS在线模式下Inline Interface Mode的响应行为(区别各个防御行为)

    演示:思科IPS在线模式下Inline Interface Mode的响应行为 演示目标:科IPS在线模式下InlineInterface Mode的响应行为. 演示环境:仍然使用图5.16所示的网络 ...

  9. php中的抽象类(abstract class)和接口(interface)

    一. 抽象类abstract class 1 .抽象类是指在 class 前加了 abstract 关键字且存在抽象方法(在类方法 function 关键字前加了 abstract 关键字)的类. 2 ...

最新文章

  1. 你现在还在使用刷脸支付吗?不,刷手支付已来!!!不侵犯隐私、秒速支付...
  2. 织梦dedecms移动版设置二级域名的方法 织梦如何设置m.开头的域名
  3. proxychains 使用指北
  4. windows下vagrant的安装使用
  5. Iterator迭代器接口讲解
  6. 1052. 爱生气的书店老板
  7. profiling定位nodejs程序消耗情况
  8. 面向对象设计原则之5-接口隔离原则
  9. element ui 分页增删改查_【新插件发布】AzureAD运维Excel版插件,增删改查快10倍c以上!...
  10. 自学python需要安装什么-Python学习需要安装的工具
  11. java.util.timer 定时任务_java.util系列源码解读之Timer定时器
  12. 软件工程(五)软件分析和软件设计
  13. PPT 无法播放媒体/视频媒体不可用怎么解决
  14. Java实现经纬度格式转化
  15. Pdf+Word+Visio+MATLAB输出的3维图像不清晰
  16. 通过数据分析改进并达成SEO优化目标
  17. Markdown 教程: 1 数学公式和特殊符号
  18. Android横竖屏屏幕方向设置
  19. 灰色马尔科夫预测 matlab代码(数据量太少,有局限性)
  20. rust 局域网联机_Steam上有哪些值得推荐的可以多人局域网联机的游戏?

热门文章

  1. vue 路由进度条 nprogress
  2. java萤石云,Android-再次解读萤石云视频
  3. HDU1243 反恐训练营(LCS权值)
  4. 修改chrome浏览器背景颜色为保护颜色
  5. 基于anaconda安装tensorflow
  6. 超低价纯流量卡不限速?三招教你拆穿商家套路
  7. 五月花计算机cD专业,五月花计算机专修学院录取分数线
  8. javaGUI 禁用输入法
  9. 【动态ppt制作软件】Focusky教程 | 如何使用变体特效?
  10. spark的kafka的低阶API createDirectStream的一些总结。