BD.ItemTypeLibrary CreateItemTypeLibrary() { BD.ItemTypeLibrary library = BD.ItemTypeLibrary.FindByName("PDIWT_ZJCZL", Program.GetActiveDgnFile()); if (library == null) { library = BD.ItemTypeLibrary.Create("PDIWT_ZJCZL", Program.GetActiveDgnFile()); BD.ItemType pile = library.AddItemType("PileProperty"); BD.CustomProperty pileProperty = pile.AddProperty("PileType"); pileProperty.Type = BD.CustomProperty.TypeKind.String; pileProperty.DefaultValue = "实心桩或桩端封闭"; var pileCrossSection = pile.AddProperty("PileCrossSectionType"); pileCrossSection.Type = BD.CustomProperty.TypeKind.String; pileCrossSection.DefaultValue = "方形截面"; var pileCode = pile.AddProperty("PileAxisNet(H-V)"); pileCode.Type = BD.CustomProperty.TypeKind.String; var pileSideLength = pile.AddProperty("PileSideLength(m)"); pileSideLength.Type = BD.CustomProperty.TypeKind.Double; pileSideLength.DefaultValue = 1; var pileInnerSideLength = pile.AddProperty("PileInnerSideLength(m)"); pileInnerSideLength.Type = BD.CustomProperty.TypeKind.Double; pileInnerSideLength.DefaultValue = 1; var pileWeigth = pile.AddProperty("PileWeigth(kN/m)"); pileWeigth.Type = BD.CustomProperty.TypeKind.Double; pileWeigth.DefaultValue = 25; var pileUnderWaterWeight = pile.AddProperty("PileUnderWaterWeigth(kN/m)"); pileUnderWaterWeight.Type = BD.CustomProperty.TypeKind.Double; pileUnderWaterWeight.DefaultValue = 15; library.Write(); } return(library); }
private BD.StatusInt SetLineElementProp(PileAxisInfo pileAxisInfo, BDE.LineElement lineElement, BD.ItemTypeLibrary library) { BD.ItemType pileItemType = library.GetItemTypeByName("PileProperty"); if (pileItemType == null) { return(BD.StatusInt.Error); } BD.CustomItemHost pileAxisHost = new BD.CustomItemHost(lineElement, true); var pileAxisPropInstance = pileAxisHost.ApplyCustomItem(pileItemType); if (pileAxisPropInstance == null) { return(BD.StatusInt.Error); } pileAxisPropInstance.SetString(propertStrings[0], piletypeStringDictionary[pileAxisInfo.Type]); pileAxisPropInstance.SetString(propertStrings[1], pileCrossSectionDictionary[pileAxisInfo.CrossSectionType]); pileAxisPropInstance.SetString(propertStrings[2], pileAxisInfo.PileCode); pileAxisPropInstance.SetDouble(propertStrings[3], pileAxisInfo.SideLength); pileAxisPropInstance.SetDouble(propertStrings[4], pileAxisInfo.InnerSideLength); pileAxisPropInstance.SetDouble(propertStrings[5], pileAxisInfo.Weight); pileAxisPropInstance.SetDouble(propertStrings[6], pileAxisInfo.UnderWaterWeight); return(pileAxisPropInstance.ScheduleChanges(lineElement)); }