Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to render 4.3_ADD_2 file with BBIM240419 with IfcOpenShell 0.8.0 #4565

Closed
piotr-smolira opened this issue Apr 19, 2024 · 21 comments
Closed

Comments

@piotr-smolira
Copy link

The same issue I have with 0.7.

I attach file.
Viadotto Acerno (3).zip

I haven't check all possible setting to load the file. However, default setting doesn't render a thing with an error
self.collections[parent.GlobalId].children.link(aggregate["collection"]) KeyError: '2cuGKPQpT2GQXEl_SVslgy'

image

Another settings I've tried:
image

@aothms has shown that it works with his add-on with 0.8.

@Moult
Copy link
Contributor

Moult commented Apr 19, 2024

I don't think you can just swap out 0.7 for 0.8 - there are probably some python binding changes that we need to address too. How did you test out 0.8?

@aothms
Copy link
Member

aothms commented Apr 19, 2024

@aothms has shown that it works with his add-on with 0.8.

Ah sorry for the confusion, but I just used IfcConvert to do an conversion to .dae and imported that into blender.

But very exciting that you're willing to take this for a test drive.

The 2nd error is related to linear placement which is not implemented here [0] (and would be difficult to implement standalone in python). What is the full stack trace there? Maybe we can work around in the import scenario. Otherwise I need to prioritize implementing this as a binding in C++.

[0] https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifcopenshell-python/ifcopenshell/util/placement.py#L64-L76

@Moult
Copy link
Contributor

Moult commented Apr 19, 2024

Any non geometric entities will use the python get_local_placement function, which could be a possible reason for the second error.

@Andrej730
Copy link
Contributor

Andrej730 commented Apr 19, 2024

I've opened the file with 0.7.0 and the only issue during the file load was missing IfcAxis2PlacementLinear implementation, added a warning for it, so it will be possible to load the model.

The same issue I have with 0.7.

@piotr-smolira can you please try to load it with the latest build from releases?

@piotr-smolira
Copy link
Author

I don't think you can just swap out 0.7 for 0.8 - there are probably some python binding changes that we need to address too. How did you test out 0.8?

Download bbim311 for windows -> unzip -> replace ifcopenshell -> zip -> install add-on in blender 🤓
It loaded all right. Although I didn't check on another file if it opens and renders okay - I might do it later. New options in add-on manager were visible.

I've opened the file with 0.7.0 and the only issue during the file load was missing IfcAxis2PlacementLinear implementation, added a warning for it, so it will be possible to load the model.

The same issue I have with 0.7.

@piotr-smolira can you please try to load it with the latest build from releases?

Sure @Andrej730 It opens. It looks like that:
image

It seems that all columns and foundations are placed in the position of the first one. BIMcollab Zoom gives the same result. Empty result in Acca Software. Only proper render I managed to get from IfcViewer from RDF. In the link here, authors managed to display whole file (whole thread).
image

Horizontal elements are represented like so:
image

whereas I expect something like:
image

I'm not sure if it something related to IfcRelPositions, IfcObjectPlacement, IfcAlignment or something that gives that error for putting all columns in the same spot.
And I completely have no idea what could be an issue with rendering only lines for other horizontal elements.

@aothms
Copy link
Member

aothms commented Apr 19, 2024

if it something related to IfcRelPositions, IfcObjectPlacement, IfcAlignment or something that gives that error for putting all columns in the same spot.

It's completely expected. 0.7 doesn't support anything related to alignments, so also not the linearly placed columns nor sweeps over alignment curves (I'm a bit puzzled why you get these lines in there, probably just polylines or sth).

Moving forward I committed some code in 0.8 to evaluate (any type of) placement. How shall we proceed connecting this to bbim/hl api? Should we add some forward compatibility to the 0.7 bbim code so that it can accept a 0.8 ifcopenshell? Or should we stay a bit more clean and keep things contained in the 0.8 branch?

I've started a new ifopsh build for 0.8. Fingers crossed.

Btw. I also already merged (or rather some very elaborate cherry picking) everything of v0.7 in to v0.8. So we're getting in relatively good shape to make the jump :)

>>> import ifcopenshell
>>> import ifcopenshell.geom
>>> import numpy as np
>>> f = ifcopenshell.open('Viadotto Acerno_ADD2.ifc')
>>> pl = f.by_type('IfcLinearPlacement')[0]
>>> s = ifcopenshell.geom.settings()
>>> a = ifcopenshell.geom.create_shape(s, pl)
>>> np.array(a.matrix).reshape((4,4))
array([[ 2.29375942e-01,  9.73251057e-01, -1.30021943e-02,
         0.00000000e+00],
       [-9.73333335e-01,  2.29395333e-01,  0.00000000e+00,
         0.00000000e+00],
       [ 2.98264268e-03,  1.26554691e-02,  9.99915468e-01,
         0.00000000e+00],
       [ 0.00000000e+00,  0.00000000e+00,  5.53272131e+01,
         1.00000000e+00]])
>>>

@aothms
Copy link
Member

aothms commented Apr 21, 2024

I've made some changes (to blenderbim src on the v0.8.0 branch) to get something to import for this particular model, but we're not there yet. There is some linear placements going on, but most of them appear to be incorrect probably because of some parenting issues or because of a mismatch between global/local transformations, don't know. Also quite a few objects come in as empties. I hope somebody who is a bit more familiar with the blenderbim import flow can have a look. Maybe it helps to compare with the .dae output of ifcconvert. You'll have to wait for the latest v0.8 bot build though.

afbeelding

afbeelding

@RickBrice
Copy link
Contributor

@aothms are there issues here, with the c++ geometry code that I need to be working on? I know the c++ coding isn't rock solid yet, especially for cant. There was a post on LinkedIn by @Moult about IfcSectionedSolidHorizontal support on the v0.8.0 branch, then all of a sudden a flurry of activity here. What do you need from me to make this successful?

@aothms
Copy link
Member

aothms commented Apr 21, 2024

I think in this case the C++ code is ok. I keep confusing people apparently, but the IfcConvert output is magnificent. So the issue is either in the python bindings or in the use of the python bindings. Would be great if @Moult or @Andrej730 could have a peek as they can better deconstruct the blenderbim import flow. For reference here [0] is the .DAE output of IfcConvert.

[0] Viadotto Acerno.zip

IfcConvert output

323739508-829f5512-adc2-4a1d-bd84-0475f33d0ee3

buildingSMART/IFC4.x-IF#148

BlenderBIM output

324244406-59d0afef-ad35-41a1-a3bc-b194ce1201a0

324244421-103f622e-8919-4ba0-ba91-a6219e3950e7

Andrej730 added a commit that referenced this issue Apr 22, 2024
As it will be more like to be available in the ifcopenshell package. Related to #4565
Andrej730 added a commit that referenced this issue Apr 22, 2024
As it will be more like to be available in the ifcopenshell package. Related to #4565
@Andrej730
Copy link
Contributor

I think in this case the C++ code is ok. I keep confusing people apparently, but the IfcConvert output is magnificent. So the issue is either in the python bindings or in the use of the python bindings. Would be great if Moult or Andrej730 could have a peek as they can better deconstruct the blenderbim import flow. For reference here [0] is the .DAE output of IfcConvert.

I've investigated some random wall that occurred at the origin and it seems reshaping it's shape.transformation.matrix fills translation into the 4th row instead of 4th column, so to resolve the issue I've used column-major .reshape.

mathutils.Matrix(np.array(shape.transformation.matrix).reshape((4,4)))
Matrix(((0.043205127120018005, 0.999001145362854, -0.011404966004192829, 0.0),
        (-0.9990661144256592, 0.043207939714193344, 0.0, 0.0),
        (0.0004927850677631795, 0.011394315399229527, 0.99993497133255, 0.0),
        (-20.775157928466797, 496.7640380859375, 39.92229461669922, 1.0)))

image

@aothms
Copy link
Member

aothms commented Apr 22, 2024

Amazing @Andrej730. Can confirm that fixes things. We might better do that transpose on the C++ side, but for now this will do.

The only thing missing now in BlenderBIM are the three line markings:

afbeelding

These are IfcSurfaceFeature that have an IfcRelAdheresToElement that links them into the tree. We probably should incorporate these relationships when we build the collections. The [IfcSurfaceFeature] <--- AdheresToElement --o [IfcRelAdheresToElement] o-- RelatingElement --> IfcElement relationship has [1:1] cardinality from IfcSurfaceFeature to IfcElement so I think it's safe to consider it more or less equivalent to e.g containment, but I don't think there is currently consensus on how to treat these.

@piotr-smolira
Copy link
Author

piotr-smolira commented Apr 24, 2024

For reference here [0] is the .DAE output of IfcConvert.

What version if IfcConvert did you use and what options? I'm getting the same results when converting to .DAE (piers in one location and all faulty result like above) as I have in blender (ver. IfcConvert-v0.7.0-f7c03db-win64). I would like to convert to GLTF, but maybe that's a subject for another thread...

If you used v.0.8 where can I see the built for that?

Amazing @Andrej730. Can confirm that fixes things. We might better do that transpose on the C++ side, but for now this will do.

Same question: can I test bbim built of v.0.8?

All in all, I would like to dive more into v.0.8. It looks like compiling from source is only option. And I've already failed on setting up all stuff with c++.

@Andrej730
Copy link
Contributor

Andrej730 commented Apr 24, 2024

Same question: can I test bbim built of v.0.8?

@piotr-smolira You can use v0.8.0 branch from this repository to test it with the latest changes for BBIM, ifcopenshell build for v0.8.0 is available from IfcOpenBot comments here - https://github.com/IfcOpenBot/IfcOpenShell/commits/v0.8.0/

@Andrej730
Copy link
Contributor

These are IfcSurfaceFeature that have an IfcRelAdheresToElement that links them into the tree. We probably should incorporate these relationships when we build the collections. The [IfcSurfaceFeature] <--- AdheresToElement --o [IfcRelAdheresToElement] o-- RelatingElement --> IfcElement relationship has [1:1] cardinality from IfcSurfaceFeature to IfcElement so I think it's safe to consider it more or less equivalent to e.g containment, but I don't think there is currently consensus on how to treat these.

Yeah, IfcSurfaceFeature seems kind of different from other IfcFeatureElements as it has it's own geometry (not just booled to/from the relating element), so it makes sense to just add them to the tree. Should be working now:

blender_9G7MILnhHz

@Andrej730
Copy link
Contributor

@piotr-smolira any other issues loading this model?

@piotr-smolira
Copy link
Author

@Andrej730 It seems that I'm still facing that problems... But it might be due to not correct bbim version.
I tried swapping ifcopenshell v0.8 into latest bbim release (1. unzip bbim release, 2. replace ifcopenshell, 3. zip bbim 4. install in blender). I bet it creates problem here.

So I went to try build my bbim built from this guideline blenderbim installation.

  1. Clone v0.8.0 branch.
  2. Get IfcOpenShell v.0.8.0 this version
  3. Replace IfcOpenShell in src/ifcopenshell-python
  4. Run make dist PLATFORM=win PYVERSION=py311
  5. It gives error 127 with command python3.10 not found.
    Also I don't think it the IfcOpenShell v0.8.0 from bot, but from https://github.com/IfcOpenShell/IfcOpenShell/archive/v0.7.0.zip

If you could assist me to get it right or send the package you're testing me, I would be delighted to test it.

@Andrej730
Copy link
Contributor

@piotr-smolira

The way it works for me - I've setup live dev environment that's connected to the repo directly and I've copied _ifcopenshell_wrapper.pyd and ifcopenshell_wrapper.py from bot v0.8.0 build.

You can do either that too or alternatively:

  1. install some bbim release from daily builds
  2. clone v0.8.0 branch
  3. copy and replace installed blenderbim files with files from v0.8.0 - https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.7.0/src/blenderbim/blenderbim
  4. download ifcopenshell v0.80 release from bot comments in
    https://github.com/IfcOpenBot/IfcOpenShell/commits/v0.8.0/ and replace installed ifcopenshell files (located in blenderbim\libs\site\packages\ifcopenshell)

@piotr-smolira
Copy link
Author

piotr-smolira commented Apr 30, 2024

@Andrej730
I managed to do it quick and dirty way (alternative way). I'll might try proper one with live dev another time.

On the first sight it looks superb! I will look through the model right now.

@piotr-smolira
Copy link
Author

There are 2 things:
1, I can't see Ifc class nor can I change it. It only shows PredefinedType:
image

  1. When I opened this file (try.ifc.txt) it shows all metadata.
    It raises an error while assigning Ifc class Error traceback.txt with Attribute error: 'Settings' object has no attribute 'STRICT_TOLERANCE'

  2. This file (LBD-ready-v.0.1.ifc.txt)closes Blender right away without any error displayed or say that Blender has crashed.

I also had some errors while opening some other ifc file but I think that is separate issue though. So I might open a new one.

So all in all, it displays great. But just Ifc class window is missing when opening some files.

Thanks Andrej, wonderful work!

@Andrej730
Copy link
Contributor

@piotr-smolira

1, I can't see Ifc class nor can I change it. It only shows PredefinedType:

Couldn't reproduce this neither in v0.7.0 or in v0.8.0. Can you please try again with the latest builds and check system console for errors?

image

Attribute error: 'Settings' object has no attribute 'STRICT_TOLERANCE'

@aothms it seems there is no STRICT_TOLERANCE in ifcopenshell.geom.settings() in v0.8.0, is there some other setting to replace it?

closes Blender right away without any error displayed or say that Blender has crashed.

Moved to a separate issue #4605

@aothms
Copy link
Member

aothms commented May 6, 2024

@aothms it seems there is no STRICT_TOLERANCE in ifcopenshell.geom.settings() in v0.8.0, is there some other setting to replace it?

Yes and no. There is now 'precision-factor', but the behaviour from STRICT_TOLERANCE=True in v0.7 is now default in v0.8. If you want to mimic the behaviour of STRICT_TOLERANCE=False you have to set settings.set('precision-factor', 10.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants