예제 #1
0
        private void RetrieveObjects(int ifcModel, string objectDisplayName)
        {
            int ifcObjectInstances  = IfcEngine.x86.sdaiGetEntityExtentBN(ifcModel, objectDisplayName),
                noIfcObjectIntances = IfcEngine.x86.sdaiGetMemberCount(ifcObjectInstances);

            if (noIfcObjectIntances != 0)
            {
                IFCItem NewItem = null;
                if (_rootIfcItem == null)
                {
                    _rootIfcItem = new IFCItem();
                    _rootIfcItem.CreateItem(null, 0, "", objectDisplayName, "", "");

                    NewItem = _rootIfcItem;
                }
                else
                {
                    IFCItem LastItem = _rootIfcItem;
                    while (LastItem != null)
                    {
                        if (LastItem.next == null)
                        {
                            LastItem.next = new IFCItem();
                            LastItem.next.CreateItem(null, 0, "", objectDisplayName, "", "");

                            NewItem = LastItem.next;

                            break;
                        }
                        else
                        {
                            LastItem = LastItem.next;
                        }
                    }
                    ;
                }


                for (int i = 0; i < noIfcObjectIntances; ++i)
                {
                    NormalEntityProcessing(objectDisplayName, ifcObjectInstances, i, NewItem);
                }
            }
        }
예제 #2
0
        private static void NormalEntityProcessing(string objectDisplayName, int ifcObjectInstances, int i,
                                                   IFCItem NewItem)
        {
            int ifcObjectIns = 0;

            IfcEngine.x86.engiGetAggrElement(ifcObjectInstances, i, IfcEngine.x86.sdaiINSTANCE, out ifcObjectIns);

            IntPtr value = IntPtr.Zero;

            IfcEngine.x86.sdaiGetAttrBN(ifcObjectIns, "GlobalId", IfcEngine.x86.sdaiSTRING, out value);

            string globalID = Marshal.PtrToStringAnsi((IntPtr)value);

            if (string.CompareOrdinal(objectDisplayName, "IfcSIUnit") == 0)
            {
                value = IntPtr.Zero;
                IfcEngine.x86.sdaiGetAttrBN(ifcObjectIns, "Prefix", IfcEngine.x86.sdaiSTRING, out value);
                string milInicator = Marshal.PtrToStringAnsi((IntPtr)value);

                if (string.CompareOrdinal(milInicator, ".MILLI.") == 0)
                {
                    modelInMilimeters = true;
                }

                return;
            }

            value = IntPtr.Zero;
            IfcEngine.x86.sdaiGetAttrBN(ifcObjectIns, "Name", IfcEngine.x86.sdaiSTRING, out value);

            string name = Marshal.PtrToStringAnsi((IntPtr)value);

            value = IntPtr.Zero;
            IfcEngine.x86.sdaiGetAttrBN(ifcObjectIns, "Description", IfcEngine.x86.sdaiSTRING, out value);

            string description = Marshal.PtrToStringAnsi((IntPtr)value);

            IFCItem subItem = new IFCItem();

            subItem.CreateItem(NewItem, ifcObjectIns, objectDisplayName, globalID, name, description);
        }