private void btnAddNetInformation_Click(object sender, EventArgs e)//加载油路网络信息 { Document oDoc = default(Document); oDoc = m_inventorApplication.ActiveDocument; BrowserPanes oPanes = default(BrowserPanes); oPanes = oDoc.BrowserPanes; int delete = 17; ClientBrowserNodeDefinition deleteoDef = oPanes.GetClientBrowserNodeDefinition(m_ClientId, delete); while (deleteoDef != null) { deleteoDef.Delete(); delete++; deleteoDef = oPanes.GetClientBrowserNodeDefinition(m_ClientId, delete); } ClientNodeResources oRscs = oPanes.ClientNodeResources; ClientNodeResource oRsc = oRscs.ItemById(m_ClientId, 14); int number = 0; int maxId = 17; //加载油孔网络信息 while (number < 14) { int j = 0; number++; BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[number]; number--; while (j < trViewNet.Nodes[number].Nodes.Count) { BrowserNodeDefinition oDef = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(trViewNet.Nodes[number].Nodes[j].Text, maxId, oRsc); node.AddChild(oDef); maxId++; j++; } number++; } foreach (Inventor.BrowserNode node in oPanes["油路"].TopNode.BrowserNodes) { if (node.BrowserNodes.Count == 0) { node.Visible = false; } } oPanes["油路"].Update(); oPanes["油路"].Activate(); }
private void AddTreePortName(string NetName, int number, int NetNumber) { Document oDoc = default(Document); oDoc = m_inventorApplication.ActiveDocument; BrowserPanes oPanes = default(BrowserPanes); oPanes = oDoc.BrowserPanes; ClientNodeResources oRscs = oPanes.ClientNodeResources; //单一孔特征的图标显示 ClientNodeResource oRsc = oRscs.ItemById(m_ClientId, 14); BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(NetName, number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[NetNumber]; node.AddChild(oDef1); }
/// <summary> /// When [HierarchicalBrowser] button is clicked /// </summary> /// <param name="Context"></param> /// <remarks></remarks> private void m_TreeViewBrowser_OnExecute(Inventor.NameValueMap Context) { Document oDoc = default(Document); oDoc = m_inventorApplication.ActiveDocument; BrowserPanes oPanes = default(BrowserPanes); oPanes = oDoc.BrowserPanes; //Create a standard Microsoft Windows IPictureDisp referencing an icon (.bmp) bitmap file. //Change the file referenced here as appropriate - here the code references test.bmp. //This is the icon that will be displayed at this node. Add the IPictureDisp to the client node resource. ClientNodeResources oRscs = oPanes.ClientNodeResources; stdole.IPictureDisp clientNodeIcon = AxHostConverter.ImageToPictureDisp(new Bitmap(@"Resources\test.bmp")); ClientNodeResource oRsc = oRscs.Add(m_ClientId, 1, clientNodeIcon); BrowserNodeDefinition oDef = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("Top Node", 3, oRsc); //adding a new pane tab to the panes collection, define the top node the pane will contain. Inventor.BrowserPane oPane = oPanes.AddTreeBrowserPane("My Pane", m_ClientId, oDef); //Add two child nodes to the tree, labeled Node 2 and Node 3. BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("Node2", 5, oRsc); BrowserNode oNode1 = oPane.TopNode.AddChild(oDef1); BrowserNodeDefinition oDef2 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("Node3", 6, oRsc); BrowserNode oNode2 = oPane.TopNode.AddChild(oDef2); //Add the native node (from root) of "Model" pane to the tree BrowserNode oNativeRootNode = default(BrowserNode); oNativeRootNode = oDoc.BrowserPanes["Model"].TopNode; oPane.TopNode.AddChild(oNativeRootNode.BrowserNodeDefinition); }
//----------------------------------------------------------------------------------- //从项目数据库加载油路信息 private void AddNetInformationFrommdb() { Document oDoc = default(Document); oDoc = m_inventorApplication.ActiveDocument; BrowserPanes oPanes = default(BrowserPanes); oPanes = oDoc.BrowserPanes; int delete = 15; ClientBrowserNodeDefinition deleteoDef = oPanes.GetClientBrowserNodeDefinition(m_ClientId, delete); while (deleteoDef != null) { deleteoDef.Delete(); delete++; deleteoDef = oPanes.GetClientBrowserNodeDefinition(m_ClientId, delete); } ClientNodeResources oRscs = oPanes.ClientNodeResources; ClientNodeResource oRsc = oRscs.ItemById(m_ClientId, 14); string[] getresult = new string[25]; m_connectToaccess = new ConnectToAccess(deFaultpath + "\\CavityLibrary", "项目数据库"); string sql = @"select * from NETList"; int number = 15; #region m_connectToaccess.GetInformation(sql, "NET1", out getresult); int i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[1]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET2", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[2]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET3", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[3]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET4", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[4]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET5", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[5]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET6", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[6]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET7", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[7]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET8", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[8]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET9", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[9]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET10", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[10]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET11", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[11]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NET12", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[12]; node.AddChild(oDef1); number++; } i++; } m_connectToaccess.GetInformation(sql, "NULLNET", out getresult); i = 0; while (getresult[i] != null) { if (getresult[i].ToString().Length > 0) { BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(getresult[i], number, oRsc); Inventor.BrowserNode node = oPanes["油路"].TopNode.BrowserNodes[13]; node.AddChild(oDef1); number++; } i++; } #endregion//加载油孔网络信息 foreach (Inventor.BrowserNode node in oPanes["油路"].TopNode.BrowserNodes) { if (node.BrowserNodes.Count == 0) { node.Visible = false; } } oPanes["油路"].Update(); oPanes["油路"].Activate(); }
private void AddTreeBrowerNode(ClientNodeResources oRscs, string NetName, int number) { ClientNodeResource oRsc; switch (NetName) { case "NET1": oRsc = oRscs.ItemById(m_ClientId, 2); break; case "NET2": oRsc = oRscs.ItemById(m_ClientId, 3); break; case "NET3": oRsc = oRscs.ItemById(m_ClientId, 4); break; case "NET4": oRsc = oRscs.ItemById(m_ClientId, 5); break; case "NET5": oRsc = oRscs.ItemById(m_ClientId, 6); break; case "NET6": oRsc = oRscs.ItemById(m_ClientId, 7); break; case "NET7": oRsc = oRscs.ItemById(m_ClientId, 8); break; case "NET8": oRsc = oRscs.ItemById(m_ClientId, 9); break; case "NET9": oRsc = oRscs.ItemById(m_ClientId, 10); break; case "NET10": oRsc = oRscs.ItemById(m_ClientId, 11); break; case "NET11": oRsc = oRscs.ItemById(m_ClientId, 12); break; case "NET12": oRsc = oRscs.ItemById(m_ClientId, 13); break; default: oRsc = oRscs.ItemById(m_ClientId, 3); break; } Document oDoc = default(Document); oDoc = m_inventorApplication.ActiveDocument; BrowserPanes oPanes = default(BrowserPanes); oPanes = oDoc.BrowserPanes; BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition(NetName, number, oRsc); Inventor.BrowserNode topNode = oPanes["油路"].TopNode; topNode.AddChild(oDef1); }
public override void OnExecute(Document document, NameValueMap context, bool succeeded) { PartDocument oPartDoc; oPartDoc = (PartDocument)m_inventorApplication.ActiveEditObject; PartComponentDefinition oPartCompDef; oPartCompDef = oPartDoc.ComponentDefinition; bool asset = true; foreach (Asset asset1 in oPartDoc.Assets) { if (asset1.DisplayName == "NET1" || asset1.DisplayName == "NET2" || asset1.DisplayName == "NET3") { asset = false; } } if (asset == true) { Addassets(); } //改变当前文件的ActiveAppearance Asset localAsset; bool flag = false; int t; int index = 0; for (t = 1; t <= oPartDoc.Assets.Count; t++) { if (oPartDoc.Assets[t].Name == "Generic-027") { flag = true; index = t; } } try { if (flag) { localAsset = oPartDoc.Assets[index]; } else { AssetLibraries assetLibs = m_inventorApplication.AssetLibraries; Asset libAsset = assetLibs["AFEFC330-5E61-4E24-814F-AE810148B79D"].AppearanceAssets["Generic-027"]; localAsset = libAsset.CopyTo(oPartDoc); } oPartDoc.ActiveAppearance = localAsset; } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } //添加新的草图 PlanarSketch oSketch; oSketch = oPartDoc.ComponentDefinition.Sketches.Add(oPartDoc.ComponentDefinition.WorkPlanes[3], false); //创建临时几何图形对象,以便后续程序进行引用 TransientGeometry oTransGeo; oTransGeo = m_inventorApplication.TransientGeometry; //画一个矩形 oSketch.SketchLines.AddAsTwoPointRectangle(oTransGeo.CreatePoint2d(0, 0), oTransGeo.CreatePoint2d(m_length, m_width)); //创建轮廓 Profile oProfile; oProfile = oSketch.Profiles.AddForSolid(true, null, null); System.Array Line = System.Array.CreateInstance(typeof(SketchLine), 6); SketchLine[] line = Line as SketchLine[]; //创建拉伸特征 ExtrudeFeature oFirstExtrude; oFirstExtrude = oPartDoc.ComponentDefinition.Features.ExtrudeFeatures.AddByDistanceExtent(oProfile, m_height, PartFeatureExtentDirectionEnum.kPositiveExtentDirection, PartFeatureOperationEnum.kJoinOperation, null); //Create FaceCollection Object FaceCollection oFaceCollection; oFaceCollection = m_inventorApplication.TransientObjects.CreateFaceCollection(); //Put faces into FaceCollection Faces oStartFaces; oStartFaces = oFirstExtrude.StartFaces; int oStFNomb = oStartFaces.Count; for (int i = 1; i <= oStFNomb; i++) { oFaceCollection.Add(oStartFaces[i]); } Faces oSideFaces; oSideFaces = oFirstExtrude.SideFaces; int oSiFNomb = oSideFaces.Count; for (int j = 1; j <= oSiFNomb; j++) { oFaceCollection.Add(oSideFaces[j]); } Faces oEndFaces; oEndFaces = oFirstExtrude.EndFaces; int oEdFNomb = oEndFaces.Count; for (int k = 1; k <= oEdFNomb; k++) { oFaceCollection.Add(oEndFaces[k]); } UserCoordinateSystems m_UCSs; m_UCSs = oPartCompDef.UserCoordinateSystems; foreach (UserCoordinateSystem ucs in m_UCSs) { ucs.Delete(); } CreateUCS(oFaceCollection[6].Edges[3], oFaceCollection[6].Edges[4]); CreateUCS(oFaceCollection[5].Edges[3], oFaceCollection[5].Edges[4]); CreateUCS(oFaceCollection[4].Edges[4], oFaceCollection[4].Edges[1]); CreateUCS(oFaceCollection[3].Edges[3], oFaceCollection[3].Edges[4]); CreateUCS(oFaceCollection[2].Edges[3], oFaceCollection[2].Edges[4]); CreateUCS(oFaceCollection[1].Edges[3], oFaceCollection[1].Edges[4]); Document oDoc = default(Document); oDoc = m_inventorApplication.ActiveDocument; BrowserPanes oPanes = default(BrowserPanes); oPanes = oDoc.BrowserPanes; ClientNodeResources oRscs = oPanes.ClientNodeResources; if (oRscs.Count == 0) { AddTreeBrowersPane(); } }
private void AddTreeBrowersPane() { IconPictureInitial(); Document oDoc = default(Document); oDoc = m_inventorApplication.ActiveDocument; BrowserPanes oPanes = default(BrowserPanes); oPanes = oDoc.BrowserPanes; System.IO.Stream oStream_Block = assembly.GetManifestResourceStream("ValveBlockDesign.resources.BlockStandard.ico"); System.Drawing.Icon oIcon_Block = new System.Drawing.Icon(oStream_Block); System.IO.Stream oStream_NET1 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET1.ico"); System.Drawing.Icon oIcon_NET1 = new System.Drawing.Icon(oStream_NET1); System.IO.Stream oStream_NET2 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET2.ico"); System.Drawing.Icon oIcon_NET2 = new System.Drawing.Icon(oStream_NET2); System.IO.Stream oStream_NET3 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET3.ico"); System.Drawing.Icon oIcon_NET3 = new System.Drawing.Icon(oStream_NET3); System.IO.Stream oStream_NET4 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET4.ico"); System.Drawing.Icon oIcon_NET4 = new System.Drawing.Icon(oStream_NET4); System.IO.Stream oStream_NET5 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET5.ico"); System.Drawing.Icon oIcon_NET5 = new System.Drawing.Icon(oStream_NET5); System.IO.Stream oStream_NET6 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET6.ico"); System.Drawing.Icon oIcon_NET6 = new System.Drawing.Icon(oStream_NET6); System.IO.Stream oStream_NET7 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET7.ico"); System.Drawing.Icon oIcon_NET7 = new System.Drawing.Icon(oStream_NET7); System.IO.Stream oStream_NET8 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET8.ico"); System.Drawing.Icon oIcon_NET8 = new System.Drawing.Icon(oStream_NET8); System.IO.Stream oStream_NET9 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET9.ico"); System.Drawing.Icon oIcon_NET9 = new System.Drawing.Icon(oStream_NET9); System.IO.Stream oStream_NET10 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET10.ico"); System.Drawing.Icon oIcon_NET10 = new System.Drawing.Icon(oStream_NET10); System.IO.Stream oStream_NET11 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET11.ico"); System.Drawing.Icon oIcon_NET11 = new System.Drawing.Icon(oStream_NET11); System.IO.Stream oStream_NET12 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET12.ico"); System.Drawing.Icon oIcon_NET12 = new System.Drawing.Icon(oStream_NET12); System.IO.Stream oStream_NET13 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET13.ico"); System.Drawing.Icon oIcon_NET13 = new System.Drawing.Icon(oStream_NET13); System.IO.Stream oStream_NET14 = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NET14.ico"); System.Drawing.Icon oIcon_NET14 = new System.Drawing.Icon(oStream_NET14); System.IO.Stream oStream_NULL = assembly.GetManifestResourceStream("ValveBlockDesign.resources.NULL.ico"); System.Drawing.Icon oIcon_NULL = new System.Drawing.Icon(oStream_NULL); System.IO.Stream oStream_Cavity = assembly.GetManifestResourceStream("ValveBlockDesign.resources.Cavity.ico"); System.Drawing.Icon oIcon_Cavity = new System.Drawing.Icon(oStream_Cavity); System.IO.Stream oStream_Footprint = assembly.GetManifestResourceStream("ValveBlockDesign.resources.Footprint.ico"); System.Drawing.Icon oIcon_Footprint = new System.Drawing.Icon(oStream_Footprint); //This is the icon that will be displayed at this node. Add the IPictureDisp to the client node resource. ClientNodeResources oRscs = oPanes.ClientNodeResources; stdole.IPictureDisp clientNodeIcon = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_Block.ToBitmap()); ClientNodeResource oRsc = oRscs.Add(m_ClientId, 1, clientNodeIcon); stdole.IPictureDisp clientNodeIcon1 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET1.ToBitmap()); ClientNodeResource oRsc1 = oRscs.Add(m_ClientId, 2, clientNodeIcon1); stdole.IPictureDisp clientNodeIcon2 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET2.ToBitmap()); ClientNodeResource oRsc2 = oRscs.Add(m_ClientId, 3, clientNodeIcon2); stdole.IPictureDisp clientNodeIcon3 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET3.ToBitmap()); ClientNodeResource oRsc3 = oRscs.Add(m_ClientId, 4, clientNodeIcon3); stdole.IPictureDisp clientNodeIcon4 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET4.ToBitmap()); ClientNodeResource oRsc4 = oRscs.Add(m_ClientId, 5, clientNodeIcon4); stdole.IPictureDisp clientNodeIcon5 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET5.ToBitmap()); ClientNodeResource oRsc5 = oRscs.Add(m_ClientId, 6, clientNodeIcon5); stdole.IPictureDisp clientNodeIcon6 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET6.ToBitmap()); ClientNodeResource oRsc6 = oRscs.Add(m_ClientId, 7, clientNodeIcon6); stdole.IPictureDisp clientNodeIcon7 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET7.ToBitmap()); ClientNodeResource oRsc7 = oRscs.Add(m_ClientId, 8, clientNodeIcon7); stdole.IPictureDisp clientNodeIcon8 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET8.ToBitmap()); ClientNodeResource oRsc8 = oRscs.Add(m_ClientId, 9, clientNodeIcon8); stdole.IPictureDisp clientNodeIcon9 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET9.ToBitmap()); ClientNodeResource oRsc9 = oRscs.Add(m_ClientId, 10, clientNodeIcon9); stdole.IPictureDisp clientNodeIcon10 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET10.ToBitmap()); ClientNodeResource oRsc10 = oRscs.Add(m_ClientId, 11, clientNodeIcon10); stdole.IPictureDisp clientNodeIcon11 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET11.ToBitmap()); ClientNodeResource oRsc11 = oRscs.Add(m_ClientId, 12, clientNodeIcon11); stdole.IPictureDisp clientNodeIcon12 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET12.ToBitmap()); ClientNodeResource oRsc12 = oRscs.Add(m_ClientId, 13, clientNodeIcon12); stdole.IPictureDisp clientNodeIcon13 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_Cavity.ToBitmap()); ClientNodeResource oRsc13 = oRscs.Add(m_ClientId, 14, clientNodeIcon13); stdole.IPictureDisp clientNodeIcon14 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_Footprint.ToBitmap()); ClientNodeResource oRsc14 = oRscs.Add(m_ClientId, 15, clientNodeIcon14); stdole.IPictureDisp clientNodeIcon15 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NULL.ToBitmap()); ClientNodeResource oRsc15 = oRscs.Add(m_ClientId, 16, clientNodeIcon15); stdole.IPictureDisp clientNodeIcon16 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET13.ToBitmap()); ClientNodeResource oRsc16 = oRscs.Add(m_ClientId, 17, clientNodeIcon16); stdole.IPictureDisp clientNodeIcon17 = ValveBlockDesign.StandardAddInServer.AxHostConverter.ImageToPictureDisp(oIcon_NET14.ToBitmap()); ClientNodeResource oRsc17 = oRscs.Add(m_ClientId, 18, clientNodeIcon17); BrowserNodeDefinition oDef = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("网络清单", 1, oRsc); Inventor.BrowserPane oPane = oPanes.AddTreeBrowserPane("油路", m_ClientId, oDef); Inventor.BrowserNode topNode = oPanes["油路"].TopNode; BrowserNodeDefinition oDef1 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET1", 2, oRsc1); topNode.AddChild(oDef1); BrowserNodeDefinition oDef2 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET2", 3, oRsc2); topNode.AddChild(oDef2); BrowserNodeDefinition oDef3 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET3", 4, oRsc3); topNode.AddChild(oDef3); BrowserNodeDefinition oDef4 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET4", 5, oRsc4); topNode.AddChild(oDef4); BrowserNodeDefinition oDef5 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET5", 6, oRsc5); topNode.AddChild(oDef5); BrowserNodeDefinition oDef6 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET6", 7, oRsc6); topNode.AddChild(oDef6); BrowserNodeDefinition oDef7 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET7", 8, oRsc7); topNode.AddChild(oDef7); BrowserNodeDefinition oDef8 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET8", 9, oRsc8); topNode.AddChild(oDef8); BrowserNodeDefinition oDef9 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET9", 10, oRsc9); topNode.AddChild(oDef9); BrowserNodeDefinition oDef10 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET10", 11, oRsc10); topNode.AddChild(oDef10); BrowserNodeDefinition oDef11 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET11", 12, oRsc11); topNode.AddChild(oDef11); BrowserNodeDefinition oDef12 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET12", 13, oRsc12); topNode.AddChild(oDef12); BrowserNodeDefinition oDef13 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET13", 14, oRsc16); topNode.AddChild(oDef13); BrowserNodeDefinition oDef14 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NET14", 15, oRsc17); topNode.AddChild(oDef14); BrowserNodeDefinition oDef15 = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("NULLNET", 16, oRsc15); topNode.AddChild(oDef15); oPanes["油路"].Update(); oPanes["模型"].Activate(); }//创建浏览器节点