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

Geometry placement offset #503

Open
arturred opened this issue Nov 6, 2024 · 5 comments
Open

Geometry placement offset #503

arturred opened this issue Nov 6, 2024 · 5 comments

Comments

@arturred
Copy link

arturred commented Nov 6, 2024

Hi

I'm opening many ifc files together; most are placed correctly. But some models are shifted. Here is an example file:
08.zip
The problem seems to be #48 IFCAXIS2PLACEMENT3D that should apply #49 transformation but after calling context.CreateContext() all geometry is relative to 0, 0 instead of 2685184.535, 1244523.524.

#47=IFCSITE('0BK7BBWMb2sAxXZbdKGz1E',#5,'Zollikon, Dufourstrasse',$,$,#50,$,$,.ELEMENT.,(48,8,10,319824),(11,41,19,319000),$,$,$);
#48=IFCAXIS2PLACEMENT3D(#49,$,$);
#49=IFCCARTESIANPOINT((2685184.535,1244523.524,0.));
#50=IFCLOCALPLACEMENT($,#48);

How can I extract this transformation vector or apply it automatically during CreateContext() before saving the geometry as WexBim?
I attached more files that should be located at 2685184.535, 1244523.524 matching together within the building
ifcoffset.zip
Other files except 00, 01 and 08 are matching together around (2685778.70763503,1244512.08346319,415.95).

I'm using the latest versions of nugets and the code from https://github.com/xBimTeam/XbimEssentials?tab=readme-ov-file#3-generating-geometry. I need to calculate a modelTranslation vector to use it for save :

model.SaveAsWexBim(wexBimBinaryWriter, nil, modelTranslation) ;

Artur

@andyward
Copy link
Member

andyward commented Nov 6, 2024

How are you calling Xbim3DModelContext.CreateContext() - especially the adjustWcs parameter?

@arturred
Copy link
Author

arturred commented Nov 6, 2024

Exactly like the referenced code example does. No parameters, only default values that are nil and true, I think.

@arturred
Copy link
Author

arturred commented Nov 7, 2024

How the adjustWcs parameter affects creating a context and result geometry? I made tests and set adjustWcs to false. All test files were exported correctly, matching each other and centered at (2685184.535, 1244523.524).
Is it safe to set this parameter always to false? I need absolute coordinates of the geometry to avoid the offset problems described above. Then I can extract the model's bounding box and use the centroid in SaveAsWexBim as a model translation to resolve the large coordinates issue.

@andyward
Copy link
Member

@Ibrahim5aad can you advise?

@Ibrahim5aad
Copy link
Member

Hi @arturred,

The adjustWcs parameter will only make offset to your geometries if the model placements tree has a single root placement (of an IfcSite for example).

And this is what happened in your case, all these placements have one parent root, setting adjustWcs to true will offset these placements to origin (0, 0, 0) and remove the parent root effect from the placement tree.

And yes in practical cases, it is safe to set this parameter always to false.

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

No branches or pull requests

3 participants