/// <summary> /// Returns existing local placement of the object. It ignores grid placement if exists. /// </summary> /// <param name="Document">Document for Xbim object</param> /// <param name="ForObject">Xbim object for which the placement should be find</param> /// <returns>Xbim object for local placement</returns> public static XbimLocalPlacement GetExistingLocalPlacement(XbimDocument Document, IXbimRoot ForObject) { if (ForObject == null) throw new ArgumentNullException(); IfcProduct product = ForObject.AsRoot as IfcProduct; if (product == null) throw new Exception("This type of object can not contain placement"); IfcLocalPlacement placement = product.ObjectPlacement as IfcLocalPlacement; if (placement == null) return null; return new XbimLocalPlacement(Document, placement); }
internal XbimLocalPlacement(XbimDocument Document, IXbimRoot ForObject, double placementX, double placementY, double placementZ) { if (Document == null || ForObject == null) throw new ArgumentNullException(); _document = Document; if (!(ForObject.AsRoot is IfcProduct)) { throw new Exception("Object is not descendant of the Product object and can not have a placement."); } IfcProduct product = ForObject.AsRoot as IfcProduct; if (product.ObjectPlacement != null) { Debug.WriteLine("XbimLocalPlacement: Object already contains placement. It is going to be replaced with new placement."); } product.SetNewObjectLocalPlacement(placementX, placementY, placementZ); }
public void AddObjectToGroup(string groupName, IXbimRoot obj) { IfcGroup group = GetOrCreateGroup(groupName); IfcObjectDefinition definition = obj.AsRoot as IfcObjectDefinition; if (definition != null) { group.AddObjectToGroup(definition); } }