How to create ifc-file from points and triangles.

This forum section is only for IFC-related issues
Post Reply
alex896079
Posts: 4
Joined: Fri Sep 25, 2020 4:48 pm

How to create ifc-file from points and triangles.

Post by alex896079 »

Please tell me how you can resolve the issue. In a python program, I have a description of a 3D figure. It is presented in the form of coordinates of points, which are combined into triangles. In fact, these are rectangular objects (walls).
For example:
Points:(1.,1.,1.),(1.,1.,-1.),(1.,-1.,1.),(1.,-1.,-1.)
Triangles: (1,2,3),(4,2,1)


how can i achieve automatic 3D shape formation in IFC format with use ifcopenshell? I understand that I need to add coordinates and triangles.
It seems clear with coordinates:
file.createIfcCartesianPoint (Coordinates = (1.0,1.5,2.0))
And the triangles? I can roughly imagine that as a result it will probably look like this:
# 17 = IfcIndexedPolygonalFace ((1,0,2,3))

But what command should I use for getting that result? Thanks.
Last edited by alex896079 on Sun Sep 27, 2020 9:11 am, edited 1 time in total.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: How to create ifc-file from points and triangles.

Post by bernd »

Corrected a spelling from ICF to IFC and moved to ifc
alex896079
Posts: 4
Joined: Fri Sep 25, 2020 4:48 pm

Re: How to create ifc-file from points and triangles.

Post by alex896079 »

I have convert vertice and triangles of simple cube.. but its some strange here - all coordinates are wrong.
points:
[[array([0., 0., 0.]),
array([1., 0., 0.]),
array([0., 0., 1.]),
array([1., 0., 1.]),
array([0., 1., 0.]),
array([1., 1., 0.]),
array([0., 1., 1.]),
array([1., 1., 1.])],
triangles:
[(4, 7, 5),
(4, 6, 7),
(0, 2, 4),
(2, 6, 4),
(0, 1, 2),
(1, 3, 2),
(1, 5, 7),
(1, 7, 3),
(2, 3, 7),
(2, 7, 6),
(0, 4, 1),
(1, 4, 5)]]
Attachments
2020-09-29 12_00_40-BIM Vision.png
2020-09-29 12_00_40-BIM Vision.png (68.85 KiB) Viewed 2028 times
alex896079
Posts: 4
Joined: Fri Sep 25, 2020 4:48 pm

Re: How to create ifc-file from points and triangles.

Post by alex896079 »

that is IFC file. I think, I was wrong with something parameters, which use to interpretating coordinates. But wich parameters..
Attachments
result.ifc
(7.12 KiB) Downloaded 104 times
alex896079
Posts: 4
Joined: Fri Sep 25, 2020 4:48 pm

Re: How to create ifc-file from points and triangles.

Post by alex896079 »

I have fund answer. Points indices are 1-indexed. So need increment all indices with one.
More detailed here: https://github.com/IfcOpenShell/IfcOpenShell/issues/955
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: How to create ifc-file from points and triangles.

Post by bernd »

great!

how about posting the correct ifc?
Post Reply