A floor has a shape! Bug or Feature?

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

A floor has a shape! Bug or Feature?

Post by bernd »

Just realized a floor is a building part object and a building part object has a shape? Thus the floor has a shape of all its children. There is for sure a reason for a shape attribute on a floor object ... Are there some informations around on the forum?

I have some smalls tools around for calculating mass on imported ifc. Inside of this tools I check if a document object has a shape, if yes I use it for mass calculations if not it is some building structure group object. But with this new floor object everything is calculated twice.

Is it possible to deactivate this behavior, or to get the old floor object without a shape back somehow? Or may be there is some other possibility to distinguish?

cheers bernd
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: bug or feature? a floor has a shape?

Post by bernd »

simple_floor.fcstd
(8.43 KiB) Downloaded 24 times

Code: Select all

App.ActiveDocument.getObjectsByLabel('Floor')[0].Shape.Volume

Code: Select all

>>> App.ActiveDocument.getObjectsByLabel('Floor')[0].Shape.Volume
1523.5987755982987
A floor has a volume !
cadgiru
Posts: 91
Joined: Thu Oct 27, 2016 9:53 am
Location: Norway
Contact:

Re: A floor has a shape! Bug or Feature?

Post by cadgiru »

bernd wrote: Sun Aug 26, 2018 1:29 pm Just realized a floor is a building part object and a building part object has a shape? Thus the floor has a shape of all its children. There is for sure a reason for a shape attribute on a floor object ... Are there some informations around on the forum?

I have some smalls tools around for calculating mass on imported ifc. Inside of this tools I check if a document object has a shape, if yes I use it for mass calculations if not it is some building structure group object. But with this new floor object everything is calculated twice.

Is it possible to deactivate this behavior, or to get the old floor object without a shape back somehow? Or may be there is some other possibility to distinguish?

cheers bernd
Think there is a need to separate the Building storey and floor objects. http://www.buildingsmart-tech.org/ifc/I ... fcslab.htm
Maybe I am wrong, but in my experience with IFC, a Floor or Building Storey is an administrative, logistic, or if You like a spatial object. Walls, windows doors and any other objects can belong to a Building Storey. Believe it is mainly a way to separate objects belonging to one Floor of a building from others.
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: A floor has a shape! Bug or Feature?

Post by yorik »

The BuildingPArt has a shape because it is a very "cheap" calculation (just a compound), that therefore gets stored as a brep inside the FreeCAD file. So this can be used later on to easily pull a whole floor out of another FreeCAD file without the need to open it.

I swear it will be REALLY useful very soon, you'll see :)

Can you alter your script to check if obj.isDerivedFrom("Part::Feature") instead of hasattr(obj,"Shape")? That should solve it I think. Plus, at some point you might have an object that has ap property named "Shape" which has nothing to do with Part shapes...

Otherwise if it's a problem we can actually also rename the "Shape" property of the BuildingPart to something else, like "ContentShape" or "StoreShape"... It is actually only used to store the brep.
cadgiru
Posts: 91
Joined: Thu Oct 27, 2016 9:53 am
Location: Norway
Contact:

Re: A floor has a shape! Bug or Feature?

Post by cadgiru »

yorik wrote: Thu Aug 30, 2018 12:58 am The BuildingPArt has a shape because it is a very "cheap" calculation (just a compound), that therefore gets stored as a brep inside the FreeCAD file. So this can be used later on to easily pull a whole floor out of another FreeCAD file without the need to open it.

I swear it will be REALLY useful very soon, you'll see :)

Can you alter your script to check if obj.isDerivedFrom("Part::Feature") instead of hasattr(obj,"Shape")? That should solve it I think. Plus, at some point you might have an object that has ap property named "Shape" which has nothing to do with Part shapes...

Otherwise if it's a problem we can actually also rename the "Shape" property of the BuildingPart to something else, like "ContentShape" or "StoreShape"... It is actually only used to store the brep.
Can't wait 8-)
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: A floor has a shape! Bug or Feature?

Post by bernd »

yorik wrote:
I swear it will be REALLY useful very soon, you'll see :)

Can you alter your script to check if obj.isDerivedFrom("Part::Feature") instead of hasattr(obj,"Shape")? That should solve it I think. Plus, at some point you might have an object that has ap property named "Shape" which has nothing to do with Part shapes...
good idea, I will go for it in my scripts.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: A floor has a shape! Bug or Feature?

Post by bernd »

if the shape property of building part is not a real Shape as the Part::Shape is we may rename the property as you proposed yorik.

bernd
Post Reply