public void PortNet(iFeature oifeature) { AttributeSets atr = oifeature.AttributeSets; AttributeSet abs = atr["MyAttribSet"]; Inventor.Attribute att = abs["InternalName"]; Inventor.Attribute footprint = abs["Footprint"]; string footprintCheck = footprint.Value; Inventor.Attribute indexAttribute = abs["IndexName"]; string indexName = indexAttribute.Value; Inventor.Attribute codeNameAttribute = abs["CodeName"]; string codeName = codeNameAttribute.Value; Inventor.Attribute codeNumberAttribute = abs["CodeNumber"]; string codeNumber = codeNumberAttribute.Value; m_connectToaccess = new ConnectToAccess(deFaultpath, "CavityLibrary", codeName, indexName, codeNumber); string sql = @"select * from ComponentsDb where ComponentsDb.IndexName='" + indexName + "'"; string CavityType = m_connectToaccess.GetSingleInformation(sql, "CavityType"); if (footprintCheck == "No") { AttributeSet myPorts = atr["MyPorts"]; Inventor.Attribute AttPortNumber = myPorts["MyPortsNumber"]; int PortNumber = AttPortNumber.Value; int i = 0; string num; while (i < PortNumber) { num = (++i).ToString(); Inventor.Attribute Port = myPorts["Port" + num]; string PortNet = Port.Value; i = m_editNetForm.dataportNET.Rows.Add(); m_editNetForm.dataportNET.Rows[i].Cells[1].Value = PortNet; m_editNetForm.dataportNET.Rows[i].Cells[0].Value = ++i; } } else if (footprintCheck == "Yes" && CavityType == "二通插装孔") { AttributeSet myPorts = atr["MyPorts"]; Inventor.Attribute AttPortNumber = myPorts["MyPortsNumber"]; int PortNumber = AttPortNumber.Value; int i = 0; string num; while (i < PortNumber) { num = (++i).ToString(); Inventor.Attribute Port = myPorts["Port" + num]; string PortNet = Port.Value; i = m_editNetForm.dataportNET.Rows.Add(); m_editNetForm.dataportNET.Rows[i].Cells[1].Value = PortNet; m_editNetForm.dataportNET.Rows[i].Cells[0].Value = ++i; } Inventor.Attribute portCountAttribute = myPorts["PortsCount"]; int portCount = portCountAttribute.Value; int j = 1; while (j <= portCount) { i = m_editNetForm.dataportNET.Rows.Add(); string portName = m_connectToaccess.SelectConnectToAccess("PortName" + j.ToString()); Inventor.Attribute PortsOther = myPorts[portName]; string NetName = PortsOther.Value; m_editNetForm.dataportNET.Rows[i].Cells[1].Value = NetName; m_editNetForm.dataportNET.Rows[i].Cells[0].Value = portName; j++; } } else { AttributeSet myPorts = atr["MyPorts"]; Inventor.Attribute portCountAttribute = myPorts["PortsCount"]; int portCount = portCountAttribute.Value; int j = 1; int i = 0; while (j <= portCount) { i = m_editNetForm.dataportNET.Rows.Add(); string portName = m_connectToaccess.SelectConnectToAccess("PortName" + j.ToString()); Inventor.Attribute PortsOther = myPorts[portName]; string NetName = PortsOther.Value; m_editNetForm.dataportNET.Rows[i].Cells[1].Value = NetName; m_editNetForm.dataportNET.Rows[i].Cells[0].Value = portName; j++; } } }
private void insertCavFeature(Face selectFace, string indexnumber)//用于插入单一孔特征元件 { string oInputName; PartDocument oPartDocument; oPartDocument = (PartDocument)m_inventorApplication.ActiveDocument; PartComponentDefinition oPartCompDef; oPartCompDef = oPartDocument.ComponentDefinition; Face oSelectFace; oSelectFace = selectFace; PartFeatures oFeatures; oFeatures = oPartCompDef.Features; iFeatureDefinition oiFeatureDef; oiFeatureDef = oFeatures.iFeatures.CreateiFeatureDefinition(filepath + "\\" + indexnumber + "Cavity.ide"); int i = JudgeFaceUcs(oSelectFace); foreach (iFeatureInput oInput in oiFeatureDef.iFeatureInputs) { if (oInput.Name == "放置平面" || oInput.Name == "x轴" || oInput.Name == "y轴" || oInput.Name == "y" || oInput.Name == "x") { switch (oInput.Name) { case "放置平面": iFeatureSketchPlaneInput oPlaneInput; oPlaneInput = (iFeatureSketchPlaneInput)oInput; oPlaneInput.PlaneInput = oSelectFace; break; case "x轴": iFeatureEntityInput oInputXAxis; oInputXAxis = (iFeatureEntityInput)oInput; oInputXAxis.Entity = oPartCompDef.UserCoordinateSystems[i].XAxis; break; case "y轴": iFeatureEntityInput oInputYAxis; oInputYAxis = (iFeatureEntityInput)oInput; oInputYAxis.Entity = oPartCompDef.UserCoordinateSystems[i].YAxis; break; case "y": iFeatureParameterInput oInputx; oInputx = (iFeatureParameterInput)oInput; oInputx.Value = Yposition; break; case "x": iFeatureParameterInput oInputy; oInputy = (iFeatureParameterInput)oInput; oInputy.Value = Xposition; break; } } else { oInputName = oInput.Name; iFeatureParameterInput oParameXInput; oParameXInput = (iFeatureParameterInput)oInput; oParameXInput.Expression = m_connectToaccess.SelectConnectToAccess(oInputName); } } iFeature oiFeature; oiFeature = oFeatures.iFeatures.Add(oiFeatureDef); //------------------------------------------------------------------------------编写保存iFeature名称的属性集 WriteAttribute(oiFeature, m_Point, "No", rotateAngle); oiFeature.Name = m_iFeatureName; //------------------------------------------------------------------------------用于网络区别的绘制 ColorAllCavPort(oiFeature, oSelectFace); ShowPortColor(); oPartDocument.Update2(); }
public override void OnExecute(Document document, NameValueMap context, bool succeeded) { PartDocument oPartDoc; oPartDoc = (PartDocument)document; PartComponentDefinition oPartCompDef; oPartCompDef = oPartDoc.ComponentDefinition; int i = 0; while (i < 20) { if (m_deleteName[i] != null) { m_selectiFeature = oPartCompDef.Features.iFeatures[m_deleteName[i]]; AttributeSets atr = m_selectiFeature.AttributeSets; AttributeSet abs = atr["MyAttribSet"]; Inventor.Attribute att = abs["InternalName"]; Inventor.Attribute footprint = abs["Footprint"]; string footprintCheck = footprint.Value; Inventor.Attribute indexAttribute = abs["IndexName"]; string indexName = indexAttribute.Value; Inventor.Attribute codeNameAttribute = abs["CodeName"]; string codeName = codeNameAttribute.Value; Inventor.Attribute codeNumberAttribute = abs["CodeNumber"]; string codeNumber = codeNumberAttribute.Value; m_connectToaccess = new ConnectToAccess(deFaultpath + "\\CavityLibrary", "CavityLibrary", codeName, indexName, codeNumber); string sql = @"select * from ComponentsDb where ComponentsDb.IndexName='" + indexName + "'"; CavityType = m_connectToaccess.GetSingleInformation(sql, "CavityType"); string num; if (footprintCheck == "Yes" && CavityType == "板式阀通油孔") { PlanarSketch oSketchFootprint = oPartCompDef.Sketches["Footprint" + m_selectiFeature.Name]; oSketchFootprint.Delete(); AttributeSet port = atr["MyPorts"]; Inventor.Attribute portNumber = port["PortsCount"]; int portcount = portNumber.Value; int j = 1; while (j <= portcount) { string portName = m_connectToaccess.SelectConnectToAccess("PortName" + j.ToString()); oPartCompDef.Features.ExtrudeFeatures[m_selectiFeature.Name + "-" + portName].Delete(); j++; } } else if (footprintCheck == "Yes" && CavityType == "二通插装孔") { AttributeSet port = atr["MyPorts"]; Inventor.Attribute portNumber = port["MyPortsNumber"]; int portnum = portNumber.Value; int j = 1; while (j <= portnum) { num = (j).ToString(); oPartCompDef.Features.ExtrudeFeatures[m_selectiFeature.Name + "-" + num].Delete(); j++; } PlanarSketch oSketchFootprint = oPartCompDef.Sketches["Footprint" + m_selectiFeature.Name]; oSketchFootprint.Delete(); Inventor.Attribute portCountAttribute = port["PortsCount"]; int portCount = portCountAttribute.Value; j = 1; while (j <= portCount) { string portName = m_connectToaccess.SelectConnectToAccess("PortName" + j.ToString()); oPartCompDef.Features.ExtrudeFeatures[m_selectiFeature.Name + "-" + portName].Delete(); j++; } } else if ((footprintCheck == "No" && CavityType == "螺纹孔") || (footprintCheck == "No" && CavityType == "工艺油孔")) { oPartCompDef.Features.ExtrudeFeatures[m_selectiFeature.Name + "-1"].Delete(); } else { AttributeSet port = atr["MyPorts"]; Inventor.Attribute portNumber = port["MyPortsNumber"]; int portnum = portNumber.Value; int j = 1; while (j <= portnum) { num = (j).ToString(); oPartCompDef.Features.ExtrudeFeatures[m_selectiFeature.Name + "-" + num].Delete(); j++; } } m_selectiFeature.Delete(); if (m_outlineDelete) { PlanarSketch oSketchOutline = oPartCompDef.Sketches["Footprint" + m_selectiFeature.Name]; oSketchOutline.Delete(); } } i++; } MessageBox.Show("元件删除成功"); }
//--------------------------------------------------------------------------- //用于从元件库直接插入元件 private void btninsert_Click(object sender, EventArgs e) { tbID.Clear(); tbID.Focus(); if (lv2.SelectedItems.Count != 0) { indexnameref = null; checkfootref = null;//用于返回该元件的Footprint的特征 cavityTyperef = null; insertname = lv1.SelectedItems[0].SubItems[1].Text; codingname = lv2.SelectedItems[0].SubItems[0].Text; codingindex = CheckIndexName(codingname, insertname, ref indexnameref, ref checkfootref, ref cavityTyperef); //获得选中元件的索引编号 indexname = indexnameref; //利用形参获得表格的名称 groupinformation.Text = "插入新元件请输入元件ID"; this.tabConCavity.SelectTab(1); dataportinformation.Rows.Clear(); if (cavityTyperef == "端油孔" || cavityTyperef == "工艺油孔") { int index = dataportinformation.Rows.Add(); dataportinformation.Rows[index].Cells[0].Value = "1"; dataportinformation.Rows[index].Cells[1].Value = "NULLNET"; } else if (cavityTyperef == "螺纹插装孔") { m_connectToaccess = new ConnectToAccess(filepath, filename, codingname, indexname, codingindex); int portnum = int.Parse(m_connectToaccess.SelectConnectToAccess("PortNumber")); int index = 0; while (index < portnum) { index = dataportinformation.Rows.Add(); dataportinformation.Rows[index].Cells[1].Value = "NULLNET"; dataportinformation.Rows[index].Cells[0].Value = ++index; } } else if (cavityTyperef == "板式阀通油孔") { int index; m_connectToaccess = new ConnectToAccess(filepath, filename, codingname, indexname, codingindex); int portcount = int.Parse(m_connectToaccess.SelectConnectToAccess("PortCount")); int portindex = 1; while (portindex <= portcount) { string portName = m_connectToaccess.SelectConnectToAccess("PortName" + portindex.ToString()); portindex++; index = dataportinformation.Rows.Add(); dataportinformation.Rows[index].Cells[0].Value = portName; dataportinformation.Rows[index].Cells[1].Value = "NULLNET"; } } else if (cavityTyperef == "二通插装孔") { m_connectToaccess = new ConnectToAccess(filepath, filename, codingname, indexname, codingindex); int portnum = int.Parse(m_connectToaccess.SelectConnectToAccess("PortNumber")); int index = 0; while (index < portnum) { index = dataportinformation.Rows.Add(); dataportinformation.Rows[index].Cells[1].Value = "NULLNET"; dataportinformation.Rows[index].Cells[0].Value = ++index; } int portcount = int.Parse(m_connectToaccess.SelectConnectToAccess("PortCount")); int portindex = 1; while (portindex <= portcount) { string portName = m_connectToaccess.SelectConnectToAccess("PortName" + portindex.ToString()); portindex++; index = dataportinformation.Rows.Add(); dataportinformation.Rows[index].Cells[0].Value = portName; dataportinformation.Rows[index].Cells[1].Value = "NULLNET"; } } else { //不包括油孔的单一孔特征 } taballinformation.SelectTab(0); } else { MessageBox.Show("请选择插入的元件"); } }
private void insertFootFeature(Face selectFace)//用于插入具有安装面的元件 { string oInputName; PartDocument oPartDocument; oPartDocument = (PartDocument)m_inventorApplication.ActiveDocument; PartComponentDefinition oPartCompDef; oPartCompDef = oPartDocument.ComponentDefinition; Face oSelectFace; oSelectFace = selectFace; PartFeatures oFeatures; oFeatures = oPartCompDef.Features; iFeatureDefinition oiFeatureDef; oiFeatureDef = oFeatures.iFeatures.CreateiFeatureDefinition(m_filepath + "\\" + m_codenumber + "Footprint.ide"); int ucsNumber = JudgeFaceUcs(oSelectFace); Inventor.Vector oVector = oPartCompDef.UserCoordinateSystems[ucsNumber].XAxis.Line.Direction.AsVector(); foreach (iFeatureInput oInput in oiFeatureDef.iFeatureInputs) { if (oInput.Name == "放置平面" || oInput.Name == "x轴" || oInput.Name == "y轴" || oInput.Name == "x" || oInput.Name == "y") { switch (oInput.Name) { case "放置平面": iFeatureSketchPlaneInput oPlaneInput; oPlaneInput = (iFeatureSketchPlaneInput)oInput; oPlaneInput.PlaneInput = oSelectFace; oPlaneInput.SetPosition(m_Point, oVector, m_InsertAngle); break; case "x轴": iFeatureEntityInput oInputXAxis; oInputXAxis = (iFeatureEntityInput)oInput; oInputXAxis.Entity = oPartCompDef.UserCoordinateSystems[ucsNumber].XAxis; break; case "y轴": iFeatureEntityInput oInputYAxis; oInputYAxis = (iFeatureEntityInput)oInput; oInputYAxis.Entity = oPartCompDef.UserCoordinateSystems[ucsNumber].YAxis; break; case "y": iFeatureParameterInput oInputx; oInputx = (iFeatureParameterInput)oInput; oInputx.Value = Yposition; break; case "x": iFeatureParameterInput oInputy; oInputy = (iFeatureParameterInput)oInput; oInputy.Value = Xposition; break; } } else { oInputName = oInput.Name; iFeatureParameterInput oParameXInput; oParameXInput = (iFeatureParameterInput)oInput; m_connectToaccess = new ConnectToAccess(m_filepath, m_filename, m_codename, m_indexname, m_codenumber); oParameXInput.Expression = m_connectToaccess.SelectConnectToAccess(oInputName); } } iFeature oiFeature; oiFeature = oFeatures.iFeatures.Add(oiFeatureDef); double disminX = GetValueFromExpression(m_connectToaccess.SelectConnectToAccess("LminX")) / 2 + Xposition; double disminY = GetValueFromExpression(m_connectToaccess.SelectConnectToAccess("LminY")) / 2 + Yposition; double dismaxX = GetValueFromExpression(m_connectToaccess.SelectConnectToAccess("LmaxX")) / 2 + Xposition; double dismaxY = GetValueFromExpression(m_connectToaccess.SelectConnectToAccess("LmaxY")) / 2 + Yposition; DrowSketch(selectFace, Yposition, Xposition, disminY, disminX, dismaxY, dismaxX, m_iFeatureName); RotateSketch(oPartCompDef, m_iFeatureName, Yposition, Xposition, m_InsertAngle); WriteAttribute(oiFeature, m_Point, "Yes", m_InsertAngle); //一定要在后面执行 oiFeature.Name = m_iFeatureName; }
private void insertCavFeature(Face selectFace, string indexnumber)//用于插入单一孔特征元件 { string oInputName; PartDocument oPartDocument; oPartDocument = (PartDocument)m_inventorApplication.ActiveDocument; PartComponentDefinition oPartCompDef; oPartCompDef = oPartDocument.ComponentDefinition; Face oSelectFace; oSelectFace = selectFace; PartFeatures oFeatures; oFeatures = oPartCompDef.Features; iFeatureDefinition oiFeatureDef; oiFeatureDef = oFeatures.iFeatures.CreateiFeatureDefinition("F:\\CavityLibrary\\" + indexnumber + "Cavity.ide"); int i = JudgeFaceUcs(oSelectFace); foreach (iFeatureInput oInput in oiFeatureDef.iFeatureInputs) { if (oInput.Name == "放置平面" || oInput.Name == "x轴" || oInput.Name == "y轴" || oInput.Name == "x" || oInput.Name == "y") { switch (oInput.Name) { case "放置平面": iFeatureSketchPlaneInput oPlaneInput; oPlaneInput = (iFeatureSketchPlaneInput)oInput; oPlaneInput.PlaneInput = oSelectFace; break; case "x轴": iFeatureEntityInput oInputXAxis; oInputXAxis = (iFeatureEntityInput)oInput; oInputXAxis.Entity = oPartCompDef.UserCoordinateSystems[i].XAxis; break; case "y轴": iFeatureEntityInput oInputYAxis; oInputYAxis = (iFeatureEntityInput)oInput; oInputYAxis.Entity = oPartCompDef.UserCoordinateSystems[i].YAxis; break; case "y": iFeatureParameterInput oInputx; oInputx = (iFeatureParameterInput)oInput; oInputx.Value = Yposition; break; case "x": iFeatureParameterInput oInputy; oInputy = (iFeatureParameterInput)oInput; oInputy.Value = Xposition; break; } } else { oInputName = oInput.Name; iFeatureParameterInput oParameXInput; oParameXInput = (iFeatureParameterInput)oInput; m_connectToaccess = new ConnectToAccess(m_filepath, m_filename, m_codename, m_indexname, m_codenumber); oParameXInput.Expression = m_connectToaccess.SelectConnectToAccess(oInputName); } } iFeature oiFeature; oiFeature = oFeatures.iFeatures.Add(oiFeatureDef); //------------------------------------------------------------------------------用于网络区别的绘制 //DrawAllPortColor(oiFeature, oSelectFace); //oPartDocument.Update2(); //------------------------------------------------------------------------------编写保存iFeature名称的属性集 AttributeSets oAttributeSets; oAttributeSets = oiFeature.AttributeSets; AttributeSet oAttributeSet; oAttributeSet = oAttributeSets.Add("MyAttribSet", false); Inventor.Attribute oPlaneAttrib; oPlaneAttrib = oAttributeSet.Add("InternalName", ValueTypeEnum.kStringType, oiFeature.Name); Inventor.Attribute oFootprintAttrib; oFootprintAttrib = oAttributeSet.Add("Footprint", ValueTypeEnum.kStringType, "No"); oiFeature.Name = m_iFeatureName; }
public void insertBoltHolesFour() { NameValueMap cont; cont = m_inventorApplication.TransientObjects.CreateNameValueMap(); string oInputName; PartDocument oPartDocument; oPartDocument = (PartDocument)m_inventorApplication.ActiveDocument; PartComponentDefinition oPartCompDef; oPartCompDef = oPartDocument.ComponentDefinition; Face oSelectFace; oSelectFace = m_selsectFace; PartFeatures oFeatures; oFeatures = oPartCompDef.Features; iFeatureDefinition oiFeatureDef; oiFeatureDef = oFeatures.iFeatures.CreateiFeatureDefinition(filepath + "\\1101Four.ide"); Edge edge4 = oSelectFace.Edges[4]; Edge edge2 = oSelectFace.Edges[2]; Edge edge1 = oSelectFace.Edges[1]; Edge edge3 = oSelectFace.Edges[3]; double disx = m_inventorApplication.MeasureTools.GetMinimumDistance(edge4, edge2, InferredTypeEnum.kNoInference, InferredTypeEnum.kNoInference, cont) - 2 * offset; double disy = m_inventorApplication.MeasureTools.GetMinimumDistance(edge1, edge3, InferredTypeEnum.kNoInference, InferredTypeEnum.kNoInference, cont) - 2 * offset; int i = JudgeFaceUcs(oSelectFace); foreach (iFeatureInput oInput in oiFeatureDef.iFeatureInputs) { if (oInput.Name == "放置平面" || oInput.Name == "dx1" || oInput.Name == "dy1" || oInput.Name == "dx2" || oInput.Name == "dy2" || oInput.Name == "x轴" || oInput.Name == "y轴") { switch (oInput.Name) { case "放置平面": iFeatureSketchPlaneInput oPlaneInput; oPlaneInput = (iFeatureSketchPlaneInput)oInput; oPlaneInput.PlaneInput = oSelectFace; break; case "x轴": iFeatureEntityInput oInputXAxis; oInputXAxis = (iFeatureEntityInput)oInput; oInputXAxis.Entity = oPartCompDef.UserCoordinateSystems[i].XAxis; if (i == 3 || i == 4) { oInputXAxis.Entity = oPartCompDef.UserCoordinateSystems[i].XAxis; } else if (i == 5) { oInputXAxis.Entity = oSelectFace.Edges[2]; } else { oInputXAxis.Entity = oSelectFace.Edges[1]; } break; case "y轴": iFeatureEntityInput oInputYAxis; oInputYAxis = (iFeatureEntityInput)oInput; oInputYAxis.Entity = oPartCompDef.UserCoordinateSystems[i].YAxis; if (i == 3 || i == 4) { oInputYAxis.Entity = oPartCompDef.UserCoordinateSystems[i].YAxis; } else if (i == 5) { oInputYAxis.Entity = oSelectFace.Edges[3]; } else { oInputYAxis.Entity = oSelectFace.Edges[2]; } break; case "dx1": iFeatureParameterInput oInputx; oInputx = (iFeatureParameterInput)oInput; oInputx.Value = offset; break; case "dy1": iFeatureParameterInput oInputy; oInputy = (iFeatureParameterInput)oInput; oInputy.Value = offset; break; case "dx2": iFeatureParameterInput oInputdisy; oInputdisy = (iFeatureParameterInput)oInput; if (i == 3 || i == 5) { oInputdisy.Value = disy; } else { oInputdisy.Value = disx; } break; case "dy2": iFeatureParameterInput oInputdisx; oInputdisx = (iFeatureParameterInput)oInput; if (i == 3 || i == 5) { oInputdisx.Value = disx; } else { oInputdisx.Value = disy; } break; } } else { oInputName = oInput.Name; iFeatureParameterInput oParameXInput; oParameXInput = (iFeatureParameterInput)oInput; m_connectToaccess = new ConnectToAccess(filepath, filename, codename, indexname, codenumber); oParameXInput.Expression = m_connectToaccess.SelectConnectToAccess(oInputName); } } iFeature oiFeature; oiFeature = oFeatures.iFeatures.Add(oiFeatureDef); WriteAttribute(oiFeature, "No"); oiFeature.Name = IDName; }
private void insertXport(PartDocument oPartDoc, PartComponentDefinition oPartCompDef) { string oInputName; PartFeatures oFeatures; oFeatures = oPartCompDef.Features; getInsertFace(oPartCompDef); iFeatureDefinition oiFeatureDef; oiFeatureDef = oFeatures.iFeatures.CreateiFeatureDefinition(filepath + "\\" + codenumber + "Cavity.ide"); foreach (iFeatureInput oInput in oiFeatureDef.iFeatureInputs) { if (oInput.Name == "放置平面" || oInput.Name == "x轴" || oInput.Name == "y轴" || oInput.Name == "y" || oInput.Name == "x") { switch (oInput.Name) { case "放置平面": iFeatureSketchPlaneInput oPlaneInput; oPlaneInput = (iFeatureSketchPlaneInput)oInput; oPlaneInput.PlaneInput = m_insertFace; break; case "x轴": iFeatureEntityInput oInputXAxis; oInputXAxis = (iFeatureEntityInput)oInput; oInputXAxis.Entity = oPartCompDef.UserCoordinateSystems[m_insertPlane].XAxis; break; case "y轴": iFeatureEntityInput oInputYAxis; oInputYAxis = (iFeatureEntityInput)oInput; oInputYAxis.Entity = oPartCompDef.UserCoordinateSystems[m_insertPlane].YAxis; break; case "y": iFeatureParameterInput oInputx; oInputx = (iFeatureParameterInput)oInput; oInputx.Value = xdistance; break; case "x": iFeatureParameterInput oInputy; oInputy = (iFeatureParameterInput)oInput; oInputy.Value = ydistance; break; } } else { oInputName = oInput.Name; iFeatureParameterInput oParameXInput; oParameXInput = (iFeatureParameterInput)oInput; m_connectToaccess = new ConnectToAccess(filepath, "CavityLibrary", codename, indexname, codenumber); oParameXInput.Expression = m_connectToaccess.SelectConnectToAccess(oInputName); } } iFeature oiFeature; oiFeature = oFeatures.iFeatures.Add(oiFeatureDef); AttributeSets oAttributeSets; oAttributeSets = oiFeature.AttributeSets; AttributeSet oAttributeSet; oAttributeSet = oAttributeSets.Add("MyAttribSet", false); Inventor.Attribute oPlaneAttrib; oPlaneAttrib = oAttributeSet.Add("InternalName", ValueTypeEnum.kStringType, oiFeature.Name); Inventor.Attribute oFootprintAttrib; oFootprintAttrib = oAttributeSet.Add("Footprint", ValueTypeEnum.kStringType, "No"); Inventor.Attribute IndexNameAttrib; IndexNameAttrib = oAttributeSet.Add("IndexName", ValueTypeEnum.kStringType, indexname); Inventor.Attribute CodeNameAttrib; CodeNameAttrib = oAttributeSet.Add("CodeName", ValueTypeEnum.kStringType, codename); Inventor.Attribute CodeNumberAttrib; CodeNumberAttrib = oAttributeSet.Add("CodeNumber", ValueTypeEnum.kStringType, codenumber); Double PortDepth1 = GetValueFromExpression(m_connectToaccess.SelectConnectToAccess("PortDepth1")); Double Depth0 = GetValueFromExpression(m_connectToaccess.SelectConnectToAccess("Depth0")); oAttributeSet.Add("MyPortsNumber", ValueTypeEnum.kIntegerType, 1); oAttributeSet.Add("Port1", ValueTypeEnum.kStringType, "NET1"); oiFeature.Name = XPortID; Drowport(oiFeature, m_insertFace, PortDepth1, Depth0, "NET1"); ShowPortColor(); }