Ejemplo n.º 1
0
        public static SemAnnotation Create(string name, string type, SemElement element,
                                           SemCoordinate3D position, SemDirection3D zAxis, SemDirection3D xAxis)
        {
            var ann = new SemAnnotation(name, type, element,
                                        position, zAxis, xAxis);

            SemInstanceDB.AddToExport(ann);
            return(ann);
        }
Ejemplo n.º 2
0
        public static SemAnnotation Retrieve(SemMainPiece mainPiece)
        {
            var ret        = new SemAnnotation();
            var collection = EarlyBindingInstanceModel.GetDataByType("IfcRelAssignsToProduct").Values;

            //if (collection.Count != 1) throw new NotImplementedException();
            foreach (var item in collection)
            {
                var theItem = item as IfcRelAssignsToProduct;
                if (theItem == null)
                {
                    continue;
                }
                var relatedObjects = theItem.RelatedObjects;
                foreach (var relatedObject in relatedObjects)
                {
                    if (relatedObject.EIN == mainPiece.IfcObject.EIN)
                    {
                        //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcAnnotation")) return null;
                        var annCollection = EarlyBindingInstanceModel.GetDataByType("IfcAnnotation").Values;
                        foreach (var annItem in annCollection)
                        {
                            if (annItem.EIN == theItem.RelatingProduct.EIN)
                            {
                                var annotation = annItem as IfcAnnotation;
                                if (annotation == null)
                                {
                                    continue;
                                }
                                var semAnnotation = new SemAnnotation {
                                    IfcAnnotation = annotation, IfcRelAssignsToProduct = theItem
                                };
                                SemInstanceDB.AddToExport(semAnnotation);
                                ret = semAnnotation;
                                semAnnotation.Element = mainPiece;
                            }
                        }
                    }
                }
            }
            return(ret);
        }