How to create ifc-file from points and triangles.

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

How to create ifc-file from points and triangles.

Postby alex896079 » Sat Sep 26, 2020 8:20 am

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
Posts: 11667
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

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

Postby bernd » Sat Sep 26, 2020 6:23 pm

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.

Postby alex896079 » Tue Sep 29, 2020 9:00 am

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 574 times
alex896079
Posts: 4
Joined: Fri Sep 25, 2020 4:48 pm

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

Postby alex896079 » Tue Sep 29, 2020 9:06 am

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 24 times
alex896079
Posts: 4
Joined: Fri Sep 25, 2020 4:48 pm

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

Postby alex896079 » Tue Sep 29, 2020 10:09 am

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
Posts: 11667
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

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

Postby bernd » Wed Sep 30, 2020 7:31 am

great!

how about posting the correct ifc?