Python Forum
IFC entities extracted twice
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IFC entities extracted twice
#7
Greetings for the day,
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:- #20=IFCPROJECT('f2535189_f2f3_445f_963',#5,'Unnamed',$,$,$,$,(#11),#19);

The issue was that when I try to extract the entity for example "IFCPROJECT", 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 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,274 May-06-2022, 11:22 AM
Last Post: jefsummers
  How to couunt extracted values ? Eidrizi 0 1,512 Sep-10-2020, 06:05 AM
Last Post: Eidrizi
  instaloaders problem: search certain hashtag - posts without hashtag extracted ledgreve 0 2,181 Nov-18-2019, 01:22 PM
Last Post: ledgreve
  Seperate entities in text file bigdazza 1 2,859 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