Python Forum
IFC entities extracted twice
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IFC entities extracted twice
#10
(Apr-11-2019, 09:42 AM)Larz60+ Wrote: As micseydel stated earlier:
Quote:You're far less likely to get a reply if people have to go off-site.
I apologise. I am explaining the new problem which I have faced.

I am working with IfcOpenShell and Python on the extraction of IFC entities. I have developed a Python code which I want to use to extract the structural model from the architectural model. But there is an issue which I am not able to understand and resolve because I am a beginner.
When I try to extract the entities which do not contain any entity written in bracket the code runs accurately.
for example:- #1=IFCPERSON($,$,'',$,$,$,$,$);
#2=IFCORGANIZATION($,'',$,$,$);

But the issue occurred when I want to extract the entities with previous entities written in Brackets
for example:- #3=IFCPERSONANDORGANIZATION(#1,#2,$);

The issue was that when I try to extract the entity for example "IFCPERSONANDORGANIZATION", the code will extract the "IFCPERSON" and "IFCORGANIZATION" twice if I have already extracted these two entities as done in the code given below.

import ifcopenshell
 
f = ifcopenshell.open("C:\Users\GURBHEJ SINGH\Desktop\IFC\ModelFull.ifc")
f2 = ifcopenshell.file()
 
persons = f.by_type("IFCPERSON")
for person in persons:
    f2.add(person)
 
organizations = f.by_type("IFCORGANIZATION")
for organization in organizations:
    f2.add(organization)
 
personorganizations = f.by_type("IFCPERSONANDORGANIZATION")
for personorganization in personorganizations:
    f2.add(personorganization)
 
f2.write("test222.ifc")
The output of the code was given below which is wrong:-
Output:
ISO-10303-21; HEADER; FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); FILE_NAME('','2019-04-11T13:41:16',(),(),'IfcOpenShell 0.5.0-dev','IfcOpenShell 0.5.0-dev',''); FILE_SCHEMA(('IFC2X3')); ENDSEC; DATA; #1=IFCPERSON($,$,'',$,$,$,$,$); #2=IFCORGANIZATION($,'',$,$,$); #3=IFCPERSON($,$,'',$,$,$,$,$); #4=IFCORGANIZATION($,'',$,$,$); #5=IFCPERSONANDORGANIZATION(#3,#4,$); ENDSEC; END-ISO-10303-21;
The output I want was that their should not be repetition of entities:-
Output:
ISO-10303-21; HEADER; FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1'); FILE_NAME('','2019-04-11T13:41:16',(),(),'IfcOpenShell 0.5.0-dev','IfcOpenShell 0.5.0-dev',''); FILE_SCHEMA(('IFC2X3')); ENDSEC; DATA; #1=IFCPERSON($,$,'',$,$,$,$,$); #2=IFCORGANIZATION($,'',$,$,$); #3=IFCPERSONANDORGANIZATION(#1,#2,$) ENDSEC; END-ISO-10303-21;
Please help me to resolve this issue.
Reply


Messages In This Thread
RE: Help with Python and ifcopenshell - by Larz60+ - Mar-17-2019, 07:17 AM
IFC entities extracted twice - by gurbhej_singh - Apr-11-2019, 09:25 AM
RE: IFC entities extracted twice - by Larz60+ - Apr-12-2019, 12:38 AM
RE: Help with Python and ifcopenshell - by Larz60+ - Apr-11-2019, 09:42 AM
RE: Help with Python and ifcopenshell - by gurbhej_singh - Apr-11-2019, 12:04 PM
RE: Help with Python and ifcopenshell - by Larz60+ - Apr-11-2019, 02:36 PM
RE: Help with Python and ifcopenshell - by Larz60+ - Apr-11-2019, 10:08 PM
RE: Help with Python and ifcopenshell - by Larz60+ - Apr-11-2019, 11:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  naming entities(city abbreviations) tirumalaramakrishna 1 1,278 May-06-2022, 11:22 AM
Last Post: jefsummers
  How to couunt extracted values ? Eidrizi 0 1,517 Sep-10-2020, 06:05 AM
Last Post: Eidrizi
  instaloaders problem: search certain hashtag - posts without hashtag extracted ledgreve 0 2,184 Nov-18-2019, 01:22 PM
Last Post: ledgreve
  Seperate entities in text file bigdazza 1 2,867 Jun-02-2018, 03:15 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020