public static BbWeld Create(BbElement mainElement, BbElement attchedElement) { var weld = new BbWeld(mainElement, attchedElement); BbInstanceDB.AddToExport(weld); return(weld); }
// public static IfcProductDefinitionShape Create(IfcRepresentationContext representationContext, // IfcProfileDef ifcProfileDef, // IfcAxis2Placement3D placement3D, // IfcDirection direction, // double depth) // { // var extruded = new IfcExtrudedAreaSolid // { // SweptArea = ifcProfileDef, // Position = placement3D, // ExtrudedDirection = direction , // Depth = depth, // }; // // var shaperep = new IfcShapeRepresentation // { // ContextOfItems = representationContext, // RepresentationIdentifier = "Body", // RepresentationType = "SweptSolid", // Items = new List<IfcRepresentationItem>(), // }; // shaperep.Items.Add(extruded); // // var ifcShape = new IfcProductDefinitionShape // { // // Name= // // Description = // Representations = new List<IfcRepresentation>(), // }; // ifcShape.Representations.Add(shaperep); // // return ifcShape; // } // // public static BbExtrudedGeometry RetrieveFromMainPiece(BbElement mainPiece) { var ret = new BbExtrudedGeometry(); var ipds = mainPiece.IfcObject as IfcElement; var iPDS = ipds.Representation as IfcProductDefinitionShape; var reps = iPDS.Representations; foreach (var rep in reps) { var iSR = rep as IfcShapeRepresentation; var repItems = rep.Items; foreach (var repItem in repItems) { var ExtGeo = repItem as IfcExtrudedAreaSolid; if (ExtGeo == null) { continue; } var semExGeo = new BbExtrudedGeometry { IfcGeometricRepresentationItem = ExtGeo, _ifcProductDefinitionShape = iPDS, _ifcShapeRepresentation = iSR }; BbInstanceDB.AddToExport(semExGeo); //var profile = BbProfile.Retrieve(semExGeo); //mainPiece.Profile = profile; ret = semExGeo; } } return(ret); }
// BLASTED, GALVANIZED, PAINTED, PRIMED and ETC //protected BbPaintFinishApplied(BbElement hostElement, BbPaintFinish paintFinish, BbSurfaceGeometry shape, BbPosition3D localPlacement3D) //{ // if (hostElement == null) { throw new ArgumentNullException(); } // if (hostElement.IfcObject == null) { throw new NullReferenceException(); } // _hostElements.Add(hostElement); // _paintFinishes.Add(paintFinish); // //var ploc = BbLocalPlacement3D.Create(TheElement.ObjectBbLocalPlacement, localPlacement3D); // //paintFinish.BbLocalPlacement3D = ploc; // var bElement = hostElement.IfcObject as IfcElement; // if (bElement == null){throw new InvalidCastException();} // var relCovers = new IfcRelCoversBldgElements // { // GlobalId = IfcGloballyUniqueId.NewGuid(), // OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, // RelatingBuildingElement = bElement, // RelatedCoverings = new List<IfcCovering>{paintFinish.IfcCovering}, // }; // IfcRelCoversBldgElementsList.Add(relCovers); //} ///// <summary> ///// ///// </summary> ///// <param name="type">one of SemSurfaceTreatmentProperties</param> //protected BbPaintFinish() // : this(@"FINISH", @"PAINTED") //{ // //IfcCovering = new IfcCovering // //{ // // GlobalId = IfcGloballyUniqueId.NewGuid(), // // OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, // // //Name = name, // // ObjectType = "FINISH", // // //Tag = id, // // PredefinedType = IfcCoveringTypeEnum.USERDEFINED, // // /// set propertySet value with type parameter value // //};n //} //protected BbPaintFinishApplied(IfcCovering paint, IfcRelCoversBldgElements agg) //{ // _ifcCoveringList.Add(paint); // _ifcRelCoversBldgElementsList.Add(agg); //} //public static BbPaintFinishApplied Create(BbElement hostElement, BbPaintFinish paintFinish, BbPosition3D localPlacement3D) //{ // var paintFinishes = new BbPaintFinishApplied(hostElement, paintFinish, localPlacement3D); // BbInstanceDB.AddToExport(paintFinishes); // return paintFinishes; //} //public static BbPaintFinish Create() //{ // var paintFinish = new BbPaintFinish(); // BbInstanceDB.AddToExport(paintFinish); // return paintFinish; //} public void AddToOtherElement(BbElement element) { if (element == null) { throw new ArgumentNullException(); } if (element.IfcObject == null) { throw new NullReferenceException(); } var bElement = element.IfcObject as IfcElement; if (bElement == null) { throw new InvalidCastException(); } var relCovers = new IfcRelCoversBldgElements { RelatingBuildingElement = bElement, }; IfcRelCoversBldgElementsList.Add(relCovers); //PaintFinishes.Add(paintFinish); }
public static ICollection<BbSlottedHole> Retrieve(BbElement element) { var ret = new List<BbSlottedHole>(); //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcRelVoidsElement")) return null; var collection = EarlyBindingInstanceModel.GetDataByType("IfcRelVoidsElement").Values; //if (collection.Count != 1) throw new NotImplementedException(); foreach (var item in collection) { var theItem = item as IfcRelVoidsElement; if (theItem == null) continue; if (theItem.RelatingBuildingElement.EIN == element.IfcObject.EIN) { var OpeningElement = theItem.RelatedOpeningElement as IfcOpeningElement; // need modification //if (theItem.Name == "Slot Hole") //{ // var semSlottedHole = new BbSlottedHole { ifcOpeningElement = OpeningElement, ifcRelVoidsElement = theItem }; // //BbInstanceDB.Add(semSlottedHole); // ret.Add(semSlottedHole); // // Retrieve localPlacement of BbSlottedHole // var placement = semSlottedHole.ifcOpeningElement.ObjectPlacement as IfcLocalPlacement; // var objectLocalPlacement = new BbLocalPlacement3D { IfcLocalPlacement = placement }; // semSlottedHole.ObjectBbLocalPlacement = objectLocalPlacement; // // Retrieve related Sems // var semPosition3D = BbFeature.RetrievePosition(semSlottedHole); // var semExtrudedGeometry = BbExtrudedGeometry.RetrieveFromFeature(semSlottedHole); // var semHoleProfile = BbSlottedHoleProfile.Retrieve(semExtrudedGeometry); //} } } return ret; }
//IfcElement _ifcElement; //[EarlyBindingInstance] //public override IfcElement IfcElement //{ // get { return _ifcElement; } // set { _ifcElement = value; } //} //private BbLocalPlacement3D _objectSemLocalPlacement; //public override BbLocalPlacement3D ObjectBbLocalPlacement //{ // get { return _objectSemLocalPlacement; } // set { _objectSemLocalPlacement = value; } //} protected BbClipAngle( string id, string name, BbProfile profile, double length, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbDirection3D extrudeDirection, BbElement container) : base(id, name, "Clip Angle", profile, length, position, zAxis, xAxis, extrudeDirection, container) { }
protected BbAccessory( string id, string name, string objectType, BbProfile profile, double length, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbDirection3D extrudeDirection, BbElement container) : base(id, name, objectType, profile, length, position, zAxis, xAxis, extrudeDirection, container, typeof(IfcDiscreteAccessory)) { }
public static BbSkewedEnd Create(BbElement hostElement, BbPosition3D position3D) { var cutSkewedEnd = new BbSkewedEnd(hostElement, position3D); BbInstanceDB.AddToExport(cutSkewedEnd); return(cutSkewedEnd); }
public BbCutCope( BbElement hostElement, BbProfile profile, double length, double[] zAxis, double[] xAxis, double[] extrudeDirection, double[] position) { //ObjectLocalPlacement = new LocalPlacement3D(hostElement.ObjectLocalPlacement, new Position3D(position)); /// from main piece BbPosition3D pos = BbPosition3D.Create( BbCoordinate3D.Create(position), BbDirection3D.Create(zAxis), BbDirection3D.Create(xAxis)); ObjectBbLocalPlacement = BbLocalPlacement3D.Create( hostElement.ObjectBbLocalPlacement, pos); BbDirection3D exDir; if (Math.Round(extrudeDirection[0], 8) == 0.0 && Math.Round(extrudeDirection[0], 8) == 0 && Math.Round(extrudeDirection[0], 8) == 1) { exDir = BbHeaderSetting.Setting3D.ZAxis; } else { exDir = BbDirection3D.Create(extrudeDirection); } BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create( profile, BbHeaderSetting.Setting3D.DefaultBbPosition3D, exDir, length); _ifcOpeningElement = new IfcOpeningElement { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = hostElement.IfcObject.OwnerHistory, // Name = // Description = ObjectType = "Opening", ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement, Representation = bbExtrudedGeometry.IfcProductDefinitionShape, }; _ifcRelVoidsElement = new IfcRelVoidsElement { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = hostElement.IfcObject.OwnerHistory, Name = "Cope", RelatingBuildingElement = hostElement.IfcObject as IfcElement, RelatedOpeningElement = _ifcOpeningElement, }; }
protected BbStiffener( string id, string name, double width, double height, double length, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbDirection3D extrudeDirection, BbElement container) : base(id, name, "Stiffener", BbNamedRectangleProfile.Create(width, height), length, position, zAxis, xAxis, extrudeDirection, container) { }
public static BbBoltAssembly Create( BbElement mainElement, BbElement attchedElement, BbCurveGeometry boltDirection, BbCoordinate3D position) { var bolt = new BbBoltAssembly(mainElement, attchedElement); bolt.AddBoltDirection(boltDirection, position); BbInstanceDB.AddToExport(bolt); return(bolt); }
protected BbDrillHoles( BbElement hostElement, BbCoordinate2D position, double radius, SemHoleLocation location, bool through ) : base(hostElement, position, BbBbNamedCircleProfile.Create(radius), location, through, "Drill Hole") { }
public static BbSkewedEnd Create(BbElement hostElement, BbPosition3D position3D, BbPropertySet bbPropertySet, double skewedAngleX, double skewedAngleY) { var cutSkewedEnd = new BbSkewedEnd(hostElement, position3D); cutSkewedEnd.AddSkewedEndProperty(bbPropertySet, skewedAngleX, skewedAngleY); BbInstanceDB.AddToExport(cutSkewedEnd); return(cutSkewedEnd); }
public static BbDrillHoles Create(BbElement hostElement, BbCoordinate2D position, double radius, SemHoleLocation location, bool through) { var hole = new BbDrillHoles(hostElement, position, radius, location, through); BbInstanceDB.AddToExport(hole); return hole; }
public static BbDrillHoles Create(BbElement hostElement, BbCoordinate2D position, double radius, SemHoleLocation location, bool through) { var hole = new BbDrillHoles(hostElement, position, radius, location, through); BbInstanceDB.AddToExport(hole); return(hole); }
public static BbCutCope Create(BbElement hostElement, double copeWidth, double copeDepth, double copeRadius, SemCopeLocation copeLocation) { var cutCope = new BbCutCope(hostElement, copeWidth, copeDepth, copeRadius, copeLocation); BbInstanceDB.AddToExport(cutCope); return(cutCope); }
public static BbRectangleOpening Create(BbElement hostElement, BbCoordinate2D position, double width, double height, SemHoleLocation location, bool through) { var hole = new BbRectangleOpening(hostElement, position, width, height, location, through); BbInstanceDB.AddToExport(hole); return hole; }
protected BbRectangleOpening( BbElement hostElement, BbCoordinate2D position, double width, double height, SemHoleLocation location, bool through ) : base(hostElement, position, BbNamedRectangleProfile.Create(width, height), location, through, "Rectangle Opening") { }
public static BbOpening Create(BbElement hostElement, BbCoordinate2D position, BbProfile profile, SemHoleLocation location, bool through, string type) { var hole = new BbOpening(hostElement, position, profile, location, through, type); BbInstanceDB.AddToExport(hole); return(hole); }
public static BbRectangleOpening Create(BbElement hostElement, BbCoordinate2D position, double width, double height, SemHoleLocation location, bool through) { var hole = new BbRectangleOpening(hostElement, position, width, height, location, through); BbInstanceDB.AddToExport(hole); return(hole); }
protected BbPiece( string id, string name, string objectType, BbProfile profile, double length, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbDirection3D extrudeDirection, BbElement hostElement, Type ifcEntityType) : this(name, objectType, profile, length, position, zAxis, xAxis, extrudeDirection, hostElement.ObjectBbLocalPlacement, ifcEntityType) { //AddToHostObject(hostElement); }
public static BbAccessory Create( string id, string pieceName, string objectType, BbProfile profile, double depth, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbElement container ) { var mainPart = new BbAccessory( id, pieceName, objectType, profile, depth, position, zAxis, xAxis, BbHeaderSetting.Setting3D.ZAxis, container); //container.AddElement(mainPart); BbInstanceDB.AddToExport(mainPart); return mainPart; }
protected BbSlottedHole( BbElement hostElement, BbCoordinate2D position, double centerToCenter, double radius, BbDirection2D refDirection, SemHoleLocation location, bool through ) : base(hostElement, position, BbSlottedHoleProfile.Create(centerToCenter, radius, refDirection), location, through, "Slot Hole") { }
public void AddGeometricRepresentation(BbElement hostElement, BbSurfaceGeometry surfaceGeometry, BbPosition3D position3D) { var ploc = BbLocalPlacement3D.Create( hostElement.ObjectBbLocalPlacement, BbPosition3D.Create( BbCoordinate3D.Create(0, 254, 100), BbHeaderSetting.Setting3D.YAxis, BbHeaderSetting.Setting3D.XAxisMinus) ); AddGeometricRepresentation(hostElement, surfaceGeometry, ploc); }
//private BbClipAngle() //{ //} public static BbClipAngle Create( string id, string pieceName, BbProfile profile, double depth, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbElement container ) { var clipAngle = new BbClipAngle( id, pieceName, profile, depth, position, zAxis, xAxis, BbHeaderSetting.Setting3D.ZAxis, container); clipAngle.AddToHostObject(container); BbInstanceDB.AddToExport(clipAngle); return(clipAngle); }
protected BbSlottedHole( BbElement hostElement, BbCoordinate2D position, double centerToCenter, double radius, BbDirection2D refDirection, SemHoleLocation location, bool through ) : base( hostElement, position, BbSlottedHoleProfile.Create(centerToCenter, radius, refDirection), location, through, "Slot Hole") { }
public static BbAccessory Create( string id, string pieceName, string objectType, BbProfile profile, double depth, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbElement container ) { var mainPart = new BbAccessory( id, pieceName, objectType, profile, depth, position, zAxis, xAxis, BbHeaderSetting.Setting3D.ZAxis, container); //container.AddElement(mainPart); BbInstanceDB.AddToExport(mainPart); return(mainPart); }
public static BbStiffener Create( string id, string pieceName, double width, double height, double depth, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbElement container ) { var stiffener = new BbStiffener( id, pieceName, width, height, depth, position, zAxis, xAxis, BbHeaderSetting.Setting3D.ZAxis, container); stiffener.AddToHostObject(container); BbInstanceDB.AddToExport(stiffener); return(stiffener); }
public static BbSlottedHole Create( BbElement hostElement, BbCoordinate2D position, double centerToCenter, double radius, BbDirection2D refDirection, SemHoleLocation location, bool through ) { var sl = new BbSlottedHole(hostElement, position, centerToCenter, radius, refDirection, location, through); BbInstanceDB.AddToExport(sl); return sl; }
public BbCutCope( BbElement hostElement, double copeWidth, double copeDepth, double copeRadius, double[] position) { BbCopeProfile profile = BbCopeProfile.Create(copeWidth, copeDepth, copeRadius); var mainPart = hostElement as BbPiece; if (mainPart == null) { return; } BbPosition3D pos = BbPosition3D.Create( BbCoordinate3D.Create(position), BbHeaderSetting.Setting3D.XAxisMinus, BbHeaderSetting.Setting3D.ZAxis); ObjectBbLocalPlacement = BbLocalPlacement3D.Create( hostElement.ObjectBbLocalPlacement, pos); BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create( profile, BbHeaderSetting.Setting3D.DefaultBbPosition3D, BbHeaderSetting.Setting3D.ZAxis, mainPart.Profile.Width); _ifcOpeningElement = new IfcOpeningElement { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = hostElement.IfcObject.OwnerHistory, // Name = // Description = ObjectType = "Opening", ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement, Representation = bbExtrudedGeometry.IfcProductDefinitionShape, }; _ifcRelVoidsElement = new IfcRelVoidsElement { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = hostElement.IfcObject.OwnerHistory, Name = "Cope", RelatingBuildingElement = hostElement.IfcObject as IfcElement, RelatedOpeningElement = _ifcOpeningElement, }; }
public static BbMaterial Retrieve(BbElement element) { var ret = new BbMaterial(); //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcRelAssociatesMaterial")) return null; var collection = EarlyBindingInstanceModel.GetDataByType("IfcRelAssociatesMaterial").Values; //if (collection.Count != 1) throw new NotImplementedException(); foreach (var item in collection) { var theItem = item as IfcRelAssociatesMaterial; if (theItem == null) { continue; } //if (theItem.RelatingMaterial.AIfcMaterial.EIN == element.IfcElement.EIN) foreach (var a in theItem.RelatedObjects) { if (a.EIN == element.IfcObject.EIN) { //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcMaterial")) return null; var collection2 = EarlyBindingInstanceModel.GetDataByType("IfcMaterial").Values; foreach (var item2 in collection2) { if (item2.EIN == theItem.RelatingMaterial.AIfcMaterial.EIN) { var material = item as IfcMaterial; if (material == null) { continue; } var pieceMaterial = new BbMaterial { IfcMaterial = material }; BbInstanceDB.AddToExport(pieceMaterial); ret = pieceMaterial; } } } else { ret = null; } } } return(ret); }
protected BbBoltAssembly(BbElement mainElement, BbElement attachedElement) : this() { MainElement = mainElement; AttachedElement = attachedElement; IfcRelConnectsElements = new IfcRelConnectsWithRealizingElements { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, RelatingElement = MainElement.IfcObject as IfcElement, RelatedElement = AttachedElement.IfcObject as IfcElement, RealizingElements = new List<IfcElement> { _ifcElement }, }; }
public static BbClipAngle Create( string id, string pieceName, BbProfile profile, double depth, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbElement container, string indicationMark, string pieceMark, string prelimMark, string barCode) { var clipAngle = new BbClipAngle( id, pieceName, profile, depth, position, zAxis, xAxis, BbHeaderSetting.Setting3D.ZAxis, container); //container.AddElement(mainPart); clipAngle.BbAccessoryIdentity = BbPieceIdentity.Create(indicationMark, pieceMark, prelimMark, barCode, false); clipAngle.AddToHostObject(container); BbInstanceDB.AddToExport(clipAngle); return(clipAngle); }
public static BbSlottedHole Create( BbElement hostElement, BbCoordinate2D position, double centerToCenter, double radius, BbDirection2D refDirection, SemHoleLocation location, bool through ) { var sl = new BbSlottedHole(hostElement, position, centerToCenter, radius, refDirection, location, through); BbInstanceDB.AddToExport(sl); return(sl); }
public static BbRectangleOpening Create(BbElement hostElement, BbCoordinate2D position, double width, double height, SemHoleLocation location, bool through, BbPropertySet bbPropertySet, string featureSubType, double rectangleOpeningRoundRadius) { var hole = new BbRectangleOpening(hostElement, position, width, height, location, through); hole.AddRectangleOpeningProperty(bbPropertySet, featureSubType, width, height, rectangleOpeningRoundRadius); BbInstanceDB.AddToExport(hole); return hole; }
public static ICollection <BbWeld> Retrieve(BbElement mainPiece) { var ret = new List <BbWeld>(); //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcRelConnectsWithRealizingElements")) return null; var collection = EarlyBindingInstanceModel.GetDataByType("IfcRelConnectsWithRealizingElements").Values; foreach (var theItem in collection) { var rel = theItem as IfcRelConnectsWithRealizingElements; if (rel == null) { continue; } if (rel.RelatingElement.EIN == mainPiece.IfcObject.EIN) { //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcFastener")) return null; var collection1 = EarlyBindingInstanceModel.GetDataByType("IfcFastener").Values; foreach (var item in collection1) { var relElements = rel.RealizingElements; foreach (var relElement in relElements) { if (relElement.EIN == item.EIN) { var fastener = item as IfcFastener; if (fastener == null) { continue; } var weld = new BbWeld { _ifcElement = fastener, IfcRelConnectsElements = rel }; //BbInstanceDB.Add(weld); ret.Add(weld); // Retrieve MainElement weld.MainElement = mainPiece; // Retrieve AttachedElement var relatedElement = weld.IfcRelConnectsElements.RelatedElement as IfcElement; // wrong implementation, need to revise, donghoon 20131205 //weld.AttachedElement = new BbElement { IfcElement = relatedElement }; } } } } } return(ret); }
public static BbRectangleOpening Create(BbElement hostElement, BbCoordinate2D position, double width, double height, SemHoleLocation location, bool through, BbPropertySet bbPropertySet, string featureSubType, double rectangleOpeningRoundRadius) { var hole = new BbRectangleOpening(hostElement, position, width, height, location, through); hole.AddRectangleOpeningProperty(bbPropertySet, featureSubType, width, height, rectangleOpeningRoundRadius); BbInstanceDB.AddToExport(hole); return(hole); }
public BbCutCope( BbElement hostElement, double copeWidth, double copeDepth, double copeRadius, double[] position) { BbCopeProfile profile = BbCopeProfile.Create(copeWidth, copeDepth, copeRadius); var mainPart = hostElement as BbPiece; if (mainPart == null) return; BbPosition3D pos = BbPosition3D.Create( BbCoordinate3D.Create(position), BbHeaderSetting.Setting3D.XAxisMinus, BbHeaderSetting.Setting3D.ZAxis); ObjectBbLocalPlacement = BbLocalPlacement3D.Create( hostElement.ObjectBbLocalPlacement, pos); BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create( profile, BbHeaderSetting.Setting3D.DefaultBbPosition3D, BbHeaderSetting.Setting3D.ZAxis, mainPart.Profile.Width); _ifcOpeningElement = new IfcOpeningElement { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = hostElement.IfcObject.OwnerHistory, // Name = // Description = ObjectType = "Opening", ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement, Representation = bbExtrudedGeometry.IfcProductDefinitionShape, }; _ifcRelVoidsElement = new IfcRelVoidsElement { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = hostElement.IfcObject.OwnerHistory, Name = "Cope", RelatingBuildingElement = hostElement.IfcObject as IfcElement, RelatedOpeningElement = _ifcOpeningElement, }; }
protected BbBoltAssembly(BbElement mainElement, BbElement attachedElement) : this() { MainElement = mainElement; AttachedElement = attachedElement; IfcRelConnectsElements = new IfcRelConnectsWithRealizingElements { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, RelatingElement = MainElement.IfcObject as IfcElement, RelatedElement = AttachedElement.IfcObject as IfcElement, RealizingElements = new List <IfcElement> { _ifcElement }, }; }
// ExtrudedElement( // string name, Profile profile, double length, // Coordinate3D position, Direction3D zAxis, Direction3D xAxis, Element container) // : this(name, profile, length, position, zAxis, xAxis, Direction3D.RefDirection, container) // { // } public static BbExtrudedElement Create( string name, BbProfile profile, double depth, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbElement container, Type ifcEntityType ) { var mainPart = new BbExtrudedElement( name, profile, depth, position, zAxis, xAxis, BbHeaderSetting.Setting3D.RefDirection, container.ObjectBbLocalPlacement, container.IfcObject.OwnerHistory, ifcEntityType); BbInstanceDB.AddToExport(mainPart); return(mainPart); }
public static BbSlottedHole Create( BbElement hostElement, BbCoordinate2D position, double centerToCenter, double radius, BbDirection2D refDirection, SemHoleLocation location, bool through, BbPropertySet bbPropertySet, string featureSubType ) { var sl = new BbSlottedHole(hostElement, position, centerToCenter, radius, refDirection, location, through); sl.AddSlottedHoleProperty(bbPropertySet, featureSubType, centerToCenter, centerToCenter + (radius * 2), radius); BbInstanceDB.AddToExport(sl); return sl; }
BbWeld(BbElement mainElement, BbElement attachedElement) { _ifcElement = new IfcFastener { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, ObjectType = "Weld", }; MainElement = mainElement; AttachedElement = attachedElement; IfcRelConnectsElements = new IfcRelConnectsWithRealizingElements { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, RelatingElement = MainElement.IfcObject as IfcElement, RelatedElement = AttachedElement.IfcObject as IfcElement, RealizingElements = new List<IfcElement> { _ifcElement }, }; }
public static ICollection<BbWeld> Retrieve(BbElement mainPiece) { var ret = new List<BbWeld>(); //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcRelConnectsWithRealizingElements")) return null; var collection = EarlyBindingInstanceModel.GetDataByType("IfcRelConnectsWithRealizingElements").Values; foreach (var theItem in collection) { var rel = theItem as IfcRelConnectsWithRealizingElements; if (rel == null) continue; if (rel.RelatingElement.EIN == mainPiece.IfcObject.EIN) { //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcFastener")) return null; var collection1 = EarlyBindingInstanceModel.GetDataByType("IfcFastener").Values; foreach (var item in collection1) { var relElements = rel.RealizingElements; foreach (var relElement in relElements) { if (relElement.EIN == item.EIN) { var fastener = item as IfcFastener; if (fastener == null) continue; var weld = new BbWeld { _ifcElement = fastener, IfcRelConnectsElements = rel }; //BbInstanceDB.Add(weld); ret.Add(weld); // Retrieve MainElement weld.MainElement = mainPiece; // Retrieve AttachedElement var relatedElement = weld.IfcRelConnectsElements.RelatedElement as IfcElement; // wrong implementation, need to revise, donghoon 20131205 //weld.AttachedElement = new BbElement { IfcElement = relatedElement }; } } } } } return ret; }
BbSkewedEnd( BbElement hostElement, BbPosition3D pos) { var mainPart = hostElement as BbPiece; if (mainPart == null) return; var width = mainPart.Length > mainPart.Profile.Width ? mainPart.Length : mainPart.Profile.Width; width = width * 100; var depth = mainPart.Length > mainPart.Profile.Depth ? mainPart.Length : mainPart.Profile.Depth; depth = depth* 100; var profile = BbNamedRectangleProfile.Create(width, depth); ObjectBbLocalPlacement = BbLocalPlacement3D.Create( hostElement.ObjectBbLocalPlacement, pos); //Direction3D exDir = Direction3D.Create(new[] {pos.Axis.X, pos.Axis.Y, pos.Axis.Z}); BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create( profile, BbHeaderSetting.Setting3D.DefaultBbPosition3D, BbHeaderSetting.Setting3D.ZAxis, mainPart.Length); //IfcHalfSpaceSolid ifcHalfSpaceSolid = new IfcHalfSpaceSolid // { // BaseSurface = new IfcPlane // { // Position = pos.IfcAxis2Placement3D, // }, // AgreementFlag = true, // }; //IfcShapeRepresentation ifcShapeRepresentation = new IfcShapeRepresentation //{ // ContextOfItems = HeaderSetting.Setting3D.GeometricRepresentationContext, // RepresentationIdentifier = "Body", // RepresentationType = "SweptSolid", // //RepresentationIdentifier = "Body", // //RepresentationType = "SolidModel", // Items = new List<IfcRepresentationItem>(), //}; //ifcShapeRepresentation.Items.Add(ifcHalfSpaceSolid); //IfcProductDefinitionShape ifcProductDefinitionShape = new IfcProductDefinitionShape //{ // // Name= // // Description = // Representations = new List<IfcRepresentation>(), //}; //ifcProductDefinitionShape.Representations.Add(ifcShapeRepresentation); _ifcOpeningElement = new IfcOpeningElement { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = hostElement.IfcObject.OwnerHistory, // Name = // Description = ObjectType = "Opening", ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement, Representation = bbExtrudedGeometry.IfcProductDefinitionShape, //Representation = ifcProductDefinitionShape, }; _ifcRelVoidsElement = new IfcRelVoidsElement { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = hostElement.IfcObject.OwnerHistory, Name = "Skewed End", RelatingBuildingElement = hostElement.IfcObject as IfcElement, RelatedOpeningElement = _ifcOpeningElement, }; }
public void AddGeometricRepresentation(BbElement hostElement, BbSurfaceGeometry surfaceGeometry, BbLocalPlacement3D localPlacement3D) { BbSurfaceGeometry = surfaceGeometry; BbLocalPlacement3D = localPlacement3D; }
public static BbWeld Create(BbElement mainElement, BbElement attchedElement) { var weld = new BbWeld(mainElement, attchedElement); BbInstanceDB.AddToExport(weld); return weld; }
// public static IfcProductDefinitionShape Create(IfcRepresentationContext representationContext, // IfcProfileDef ifcProfileDef, // IfcAxis2Placement3D placement3D, // IfcDirection direction, // double depth) // { // var extruded = new IfcExtrudedAreaSolid // { // SweptArea = ifcProfileDef, // Position = placement3D, // ExtrudedDirection = direction , // Depth = depth, // }; // // var shaperep = new IfcShapeRepresentation // { // ContextOfItems = representationContext, // RepresentationIdentifier = "Body", // RepresentationType = "SweptSolid", // Items = new List<IfcRepresentationItem>(), // }; // shaperep.Items.Add(extruded); // // var ifcShape = new IfcProductDefinitionShape // { // // Name= // // Description = // Representations = new List<IfcRepresentation>(), // }; // ifcShape.Representations.Add(shaperep); // // return ifcShape; // } // // public static BbExtrudedGeometry RetrieveFromMainPiece(BbElement mainPiece) { var ret = new BbExtrudedGeometry(); var ipds = mainPiece.IfcObject as IfcElement; var iPDS = ipds.Representation as IfcProductDefinitionShape; var reps = iPDS.Representations; foreach (var rep in reps) { var iSR = rep as IfcShapeRepresentation; var repItems = rep.Items; foreach (var repItem in repItems) { var ExtGeo = repItem as IfcExtrudedAreaSolid; if (ExtGeo == null) continue; var semExGeo = new BbExtrudedGeometry { IfcGeometricRepresentationItem = ExtGeo, _ifcProductDefinitionShape = iPDS, _ifcShapeRepresentation = iSR }; BbInstanceDB.AddToExport(semExGeo); //var profile = BbProfile.Retrieve(semExGeo); //mainPiece.Profile = profile; ret = semExGeo; } } return ret; }
// ExtrudedElement( // string name, Profile profile, double length, // Coordinate3D position, Direction3D zAxis, Direction3D xAxis, Element container) // : this(name, profile, length, position, zAxis, xAxis, Direction3D.RefDirection, container) // { // } public static BbExtrudedElement Create( string name, BbProfile profile, double depth, BbCoordinate3D position, BbDirection3D zAxis, BbDirection3D xAxis, BbElement container, Type ifcEntityType ) { var mainPart = new BbExtrudedElement( name, profile, depth, position, zAxis, xAxis, BbHeaderSetting.Setting3D.RefDirection, container.ObjectBbLocalPlacement, container.IfcObject.OwnerHistory, ifcEntityType); BbInstanceDB.AddToExport(mainPart); return mainPart; }
public void AssociateTo(BbElement element) { if (IfcRelAssociatesMaterial == null) { IfcRelAssociatesMaterial = new IfcRelAssociatesMaterial { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory, RelatingMaterial = new IfcMaterialSelect(), RelatedObjects = new List<IfcRoot>(), }; IfcRelAssociatesMaterial.RelatingMaterial.Value = IfcMaterial; } if (elements == null) { elements = new List<BbElement>(); } elements.Add(element); IfcRelAssociatesMaterial.RelatedObjects.Add(element.IfcObject); AssignTo(element); }
public static BbMaterial Retrieve(BbElement element) { var ret = new BbMaterial(); //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcRelAssociatesMaterial")) return null; var collection = EarlyBindingInstanceModel.GetDataByType("IfcRelAssociatesMaterial").Values; //if (collection.Count != 1) throw new NotImplementedException(); foreach (var item in collection) { var theItem = item as IfcRelAssociatesMaterial; if (theItem == null) continue; //if (theItem.RelatingMaterial.AIfcMaterial.EIN == element.IfcElement.EIN) foreach (var a in theItem.RelatedObjects) { if (a.EIN == element.IfcObject.EIN) { //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcMaterial")) return null; var collection2 = EarlyBindingInstanceModel.GetDataByType("IfcMaterial").Values; foreach (var item2 in collection2) { if (item2.EIN == theItem.RelatingMaterial.AIfcMaterial.EIN) { var material = item as IfcMaterial; if (material == null) continue; var pieceMaterial = new BbMaterial { IfcMaterial = material }; BbInstanceDB.AddToExport(pieceMaterial); ret = pieceMaterial; } } } else { ret = null; } } } return ret; }
public void Add(BbElement element) { Count++; CountedElement.Add(element); IfcRelDefinesByProperties.RelatedObjects.Add(element.IfcObject); }
public void AssignTo(BbElement element) { //element.IfcElement.Name = Name; BbPropertySet.AssignTo(element); }
public void AssignTo(BbElement element) { BbPropertySet.AssignTo(element); }
protected BbOpening( BbElement hostElement, BbCoordinate2D position, BbProfile profile, SemHoleLocation location, bool through, string type ) { var mainPart = hostElement as BbPiece; if (mainPart == null) return; double thickness; BbPosition3D pos; // x direction follows extrusion direction // extrude origin projected to bottom or left becomes the origin switch (location) { case SemHoleLocation.Left: pos = BbPosition3D.Create( BbCoordinate3D.Create( -(mainPart.Profile.Width / 2), position.Y, position.X), BbHeaderSetting.Setting3D.XAxis, BbHeaderSetting.Setting3D.ZAxis); if (through) thickness = mainPart.Profile.Width; else thickness = mainPart.Profile.Width / 2; break; case SemHoleLocation.Right: pos = BbPosition3D.Create( BbCoordinate3D.Create( (mainPart.Profile.Width / 2), position.Y, position.X), BbHeaderSetting.Setting3D.XAxisMinus, BbHeaderSetting.Setting3D.ZAxis); if (through) thickness = mainPart.Profile.Width; else thickness = mainPart.Profile.Width / 2; break; case SemHoleLocation.Web: if (through) { pos = BbPosition3D.Create( BbCoordinate3D.Create( (mainPart.Profile.Width / 2), position.Y, position.X ), BbHeaderSetting.Setting3D.XAxisMinus, BbHeaderSetting.Setting3D.ZAxis); thickness = mainPart.Profile.Width; } else { pos = BbPosition3D.Create( BbCoordinate3D.Create( (mainPart.Profile.Width / 4), position.Y, position.X ), BbHeaderSetting.Setting3D.XAxisMinus, BbHeaderSetting.Setting3D.ZAxis); thickness = mainPart.Profile.Width / 2; } break; case SemHoleLocation.Bottom: pos = BbPosition3D.Create( BbCoordinate3D.Create( position.Y, -(mainPart.Profile.Depth / 2), position.X ), BbHeaderSetting.Setting3D.YAxis, BbHeaderSetting.Setting3D.ZAxis); if (through) thickness = mainPart.Profile.Depth; else thickness = mainPart.Profile.Depth / 2; break; case SemHoleLocation.Top: default: pos = BbPosition3D.Create( BbCoordinate3D.Create( position.Y, (mainPart.Profile.Depth / 2), position.X ), BbHeaderSetting.Setting3D.YAxisMinus, BbHeaderSetting.Setting3D.ZAxis); if (through) thickness = mainPart.Profile.Depth; else thickness = mainPart.Profile.Depth / 2; break; } ObjectBbLocalPlacement = BbLocalPlacement3D.Create( hostElement.ObjectBbLocalPlacement, pos); BbExtrudedGeometry bbExtrudedGeometry = BbExtrudedGeometry.Create( profile, BbHeaderSetting.Setting3D.DefaultBbPosition3D, BbHeaderSetting.Setting3D.ZAxis, thickness); _ifcOpeningElement = new IfcOpeningElement { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = hostElement.IfcObject.OwnerHistory, // Name = // Description = ObjectType = "Opening", ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement, Representation = bbExtrudedGeometry.IfcProductDefinitionShape, }; _ifcRelVoidsElement = new IfcRelVoidsElement { GlobalId = IfcGloballyUniqueId.NewGuid(), OwnerHistory = hostElement.IfcObject.OwnerHistory, Name = type, RelatingBuildingElement = hostElement.IfcObject as IfcElement, RelatedOpeningElement = _ifcOpeningElement, }; }
public static BbOpening Create(BbElement hostElement, BbCoordinate2D position, BbProfile profile, SemHoleLocation location, bool through, string type) { var hole = new BbOpening(hostElement, position, profile, location, through, type); BbInstanceDB.AddToExport(hole); return hole; }