IFC entities extracted twice - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: IFC entities extracted twice (/thread-17448.html) Pages:
1
2
|
Help with Python and ifcopenshell - gurbhej_singh - Mar-17-2019 Greetings for the day, I am new with the coding world. I am using Python and IfcOpenShell to work on IFC files. I want to use a command ifc.open but it is not working. I am using Python 2.7. Please help me with this issue. Thank you. RE: Help with Python and ifcopenshell - Larz60+ - Mar-17-2019 Quote:fc.open but it is not workingHow so? Please post code, and error messages (complete, unmodified) Use BBCode tags RE: Help with Python and ifcopenshell - gurbhej_singh - Mar-18-2019 (Mar-17-2019, 07:17 AM)Larz60+ Wrote:Thank you for your reply. Below given are the links to code and error:-Quote:fc.open but it is not workingHow so? Code:- CODE Error:- ERROR RE: Help with Python and ifcopenshell - micseydel - Mar-19-2019 As Larz said, you should be posting in code tags. You're far less likely to get a reply if people have to go off-site. Also, I haven't looked at the links but the shorter the code the better - if you can reproduce your problem in 5-10 runnable lines of code rather than hundreds, you'll be substantially more likely to get a reply (and faster at that). RE: Help with Python and ifcopenshell - gurbhej_singh - Mar-19-2019 (Mar-19-2019, 02:26 AM)micseydel Wrote: As Larz said, you should be posting in code tags. You're far less likely to get a reply if people have to go off-site. Also, I haven't looked at the links but the shorter the code the better - if you can reproduce your problem in 5-10 runnable lines of code rather than hundreds, you'll be substantially more likely to get a reply (and faster at that). Thank you for your reply. I will definitely use BBCodes while posting any question. from __future__ import print_function f = ifc.open("C:\Users\GURBHEJ SINGH\Desktop\Beam_Material.ifc") f2 = ifc.open("test22.ifc") directions = f.by_type("ifcdirection") for direction in directions: f2.add(direction) beams = f.by_type("IFCBEAM") for beam in beams: f2.add(beam) f2.write("test22.ifc") Please help me to solve the issue.Thank you. RE: Help with Python and ifcopenshell - micseydel - Mar-20-2019 You're trying to use a name which you haven't defined. The error seems relatively straightforward. That said, I don't have an easy solution for you. I'm not familiar with ifc. I Googled very briefly and the Python examples I saw didn't try to use ifc the way you do. Are you following a tutorial? What inspired you to write this code? IFC entities extracted twice - gurbhej_singh - Apr-11-2019 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:- The output I want was that their should not be repetition of entities:- Please help me to resolve this issue.
RE: Help with Python and ifcopenshell - gurbhej_singh - Apr-11-2019 Greetings for the day, I have done some changes in the code and make it run. But I have faced another problem which I have explained in other thread. The link to the thread:- https://python-forum.io/Thread-IFC-entities-extracted-twice Thank you. RE: Help with Python and ifcopenshell - Larz60+ - Apr-11-2019 As micseydel stated earlier: Quote:You're far less likely to get a reply if people have to go off-site. RE: Help with Python and ifcopenshell - gurbhej_singh - Apr-11-2019 (Apr-11-2019, 09:42 AM)Larz60+ Wrote: As micseydel stated earlier: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:- The output I want was that their should not be repetition of entities:- Please help me to resolve this issue.
|