Hi,
First, I don't know if here is the right place to post for help but I didn't found any SCL help forum elsewhere.
Developing an IFC Viewer/Editor, I'd like to use SCL (which permits easy editing and writing) but I have some problem with inverse relationship.
For example, I try to get the PropertySet of my SdaiIfcwindow. With this set, I will know Thermal properties, Fire rating, ...
I want so to get the IFCRELDEFINESBYPROPERTIES from my IFC file.
I tried to use the isdefinedby_() method but if I use the EntityAggregate returned (for example calling EntityAggregate::EntryCount()) , I get a segfault (apparently because of EntityAggregate::ShallowCopy()).
What am I doing wrong ?
Thank you for your help :)
ERROR: ENTITY #124 Ifcwindow
ownerhistory : Reference to non-existent ENTITY #2.
objectplacement : Reference to non-existent ENTITY #125.
representation : Reference to non-existent ENTITY #130.
ERROR in EXCHANGE FILE: incomplete instance #124.
ERROR: ENTITY #131 Ifcrelfillselement
ownerhistory : Reference to non-existent ENTITY #2.
relatingopeningelement : Reference to non-existent ENTITY #97.
ERROR in EXCHANGE FILE: incomplete instance #131.
ERROR: ENTITY #132 Ifcpropertyset
ownerhistory : Reference to non-existent ENTITY #2.
ERROR in EXCHANGE FILE: incomplete instance #132.
ERROR: ENTITY #145 Ifcreldefinesbyproperties
ownerhistory : Reference to non-existent ENTITY #2.
ERROR in EXCHANGE FILE: incomplete instance #145.
ERROR: ENTITY #146 Ifcelementquantity
ownerhistory : Reference to non-existent ENTITY #2.
ERROR in EXCHANGE FILE: incomplete instance #146.
ERROR: ENTITY #149 Ifcreldefinesbyproperties
ownerhistory : Reference to non-existent ENTITY #2.
ERROR in EXCHANGE FILE: incomplete instance #149.
Hi,
I'm on a Linux xubuntu 3.2.0-25-generic, using Qt 4.8.1.
My problem has changed a little. There is no more segfault but I still can't get relations where they should be.
Here is a small example concerning a window.
The interesting part in my IFC file :
#124 = IFCWINDOW('0LV8Pid0X3IA3jJLVDPidY', #2, 'Window xyz', 'Description of Window', $, #125, #130, $, 1.400, 7.500E-1);
#131 = IFCRELFILLSELEMENT('1CDlLMVMv1qw1giUXpQgxI', #2, $, $, #97, #124);
#132 = IFCPROPERTYSET('0fhz_bHU54xB$tXHjHPUZl', #2, 'Pset_WindowCommon', $, (#133, #134, #135, #136, #137, #138, #139, #140, #141, #142, #143, #144));
#133 = IFCPROPERTYSINGLEVALUE('Reference', 'Reference', IFCTEXT(''), $);
#134 = IFCPROPERTYSINGLEVALUE('FireRating', 'FireRating', IFCTEXT(''), $);
#135 = IFCPROPERTYSINGLEVALUE('AcousticRating', 'AcousticRating', IFCTEXT(''), $);
#136 = IFCPROPERTYSINGLEVALUE('SecurityRating', 'SecurityRating', IFCTEXT(''), $);
#137 = IFCPROPERTYSINGLEVALUE('IsExternal', 'IsExternal', IFCBOOLEAN(.T.), $);
#138 = IFCPROPERTYSINGLEVALUE('Infiltration', 'Infiltration', IFCBOOLEAN(.F.), $);
#139 = IFCPROPERTYSINGLEVALUE('ThermalTransmittance', 'ThermalTransmittance', IFCREAL(2.400E-1), $);
#140 = IFCPROPERTYSINGLEVALUE('GlazingAresFraction', 'GlazingAresFraction', IFCREAL(7.000E-1), $);
#141 = IFCPROPERTYSINGLEVALUE('HandicapAccessible', 'HandicapAccessible', IFCBOOLEAN(.F.), $);
#142 = IFCPROPERTYSINGLEVALUE('FireExit', 'FireExit', IFCBOOLEAN(.F.), $);
#143 = IFCPROPERTYSINGLEVALUE('SelfClosing', 'SelfClosing', IFCBOOLEAN(.F.), $);
#144 = IFCPROPERTYSINGLEVALUE('SmokeStop', 'SmokeStop', IFCBOOLEAN(.F.), $);
#145 = IFCRELDEFINESBYPROPERTIES('2fHMxamlj5DvGvEKfCk8nj', #2, $, $, (#124), #132);
#146 = IFCELEMENTQUANTITY('0bB_7AP5v5OBZ90TDvo0Fo', #2, 'BaseQuantities', $, $, (#147, #148));
#147 = IFCQUANTITYLENGTH('Height', 'Height', $, 1.400);
#148 = IFCQUANTITYLENGTH('Width', 'Width', $, 7.500E-1);
#149 = IFCRELDEFINESBYPROPERTIES('0FmgI0DRX49OXL_$Wa2P1E', #2, $, $, (#124), #146);
The code I use :
void window_test ()
{
Registry registry( SchemaInit );
InstMgr instance_list;
STEPfile sfile( registry, instance_list, "", false );
sfile.ReadExchangeFile( "simple_wall.ifc" );
sfile.Error().PrintContents(cout);
Severity readSev = sfile.Error().severity();
SdaiIfcwindow* window = (SdaiIfcwindow*)
instance_list.GetApplication_instance(124-1);
if ( window == ENTITY_NULL ) { cout << "NULL" << endl; exit(1); }
SDAI_String global_id = (SDAI_String) window->globalid_();
cout << "Window #" << window->StepFileId() << " " << global_id.c_str() << endl;
EntityAggregate* aggr = window->isdefinedby_(); // there is a lot a properties for my window
if(aggr) cout << aggr->EntryCount() << endl; // so aggr should be defined here
else cout << "NOT DEFINED" << endl; // but "NOT DEFINED" is printed
}
Thank you for your help.
Regards,
GuillaumeTo view this discussion on the web visit https://groups.google.com/d/msg/scl-dev/-/wtTW4WtNOyUJ.
--
You received this message because you are subscribed to the Google Groups "STEPcode - Developers Mailing List" group.For more options, visit this group at http://groups.google.com/group/scl-dev?hl=en.
To post to this group, send email to scl...@googlegroups.com.
To unsubscribe from this group, send email to scl-dev+u...@googlegroups.com.
Of course, I should have joined it before.
--
You received this message because you are subscribed to the Google Groups "STEPcode - Developers Mailing List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/scl-dev/-/cpo1VzTLayAJ.
const EntityDescriptor * ed = registry.FindEntity("ifcwindow");
const Inverse_attributeList &ial = ed->InverseAttr();
cd build/
cmake .. -DSCL_ENABLE_TESTING=ON
make tst_inverse_attr
bin/tst_inverse_attr ../test/p21/test_inverse_attr.p21
file id 1; name Object
Hi Mark,
Thank you for your help, your code helped me a lot to get my properties.
I still have some difficulties in several points.
First, the first part of your code, in which you find inverse attributes of an Entity, does not work with my IFC example. There is no inverse attribute from my instance (window).
Then, I didn't find how to get the nominal value of my properties. I used attributes list (from my properties) to get them and I don't think it is a good way.
On Mon, Jul 2, 2012 at 11:32 AM, guparan <gup...@gmail.com> wrote:
Hi Mark,
Thank you for your help, your code helped me a lot to get my properties.
I still have some difficulties in several points.
First, the first part of your code, in which you find inverse attributes of an Entity, does not work with my IFC example. There is no inverse attribute from my instance (window).It looks like they only show up for the entity for which they are declared in EXPRESS. I don't know whether this is by design or not. (Anybody?)
Hi Mark,
Sorry but I didn't understand the point of your build option.
What are the advantages ?
Regards,
Guillaume
Hi Mark,
Thank you for your help, your code helped me a lot to get my properties.
I still have some difficulties in several points.
First, the first part of your code, in which you find inverse attributes of an Entity, does not work with my IFC example. There is no inverse attribute from my instance (window).
Then, I didn't find how to get the nominal value of my properties. I used attributes list (from my properties) to get them and I don't think it is a good way.
--
You received this message because you are subscribed to the Google Groups "STEPcode - Developers Mailing List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/scl-dev/-/HUtQSHs3zekJ.
I have improved upon the inverse attribute test. Now, it looks for inverse attributes in the supertypes as well - stepcode/test/cpp/schema_specific/inverse_attr1.cc
You mean that you don't like using a constant for the index, i.e. attributes[2] ? For entities which don't have multiple inheritance, I think that the attribute index will always be the same unless the schema changes (i.e. IFC2x3 -> IFC2x4).
I added another example/test (test/cpp/schema_specific/attribute.cc) that searches for an attribute by name. Let me know whether it's what you are looking for or not.
Le dimanche 15 juillet 2012 14:55:12 UTC+2, mark a écrit :I have improved upon the inverse attribute test. Now, it looks for inverse attributes in the supertypes as well - stepcode/test/cpp/schema_specific/inverse_attr1.cc
Did you test it with an IFC structure ? Because I still can't get any of my Ifcwindow relations (ifcpropertyset notably).
For the moment, I manage with the solution you suggested on 2012/07/02.
You mean that you don't like using a constant for the index, i.e. attributes[2] ? For entities which don't have multiple inheritance, I think that the attribute index will always be the same unless the schema changes (i.e. IFC2x3 -> IFC2x4).
You may be right !
I added another example/test (test/cpp/schema_specific/attribute.cc) that searches for an attribute by name. Let me know whether it's what you are looking for or not.
I'm not searching for attributes but relations. Since relations are not referenced in window declaration, I cannot use this trick (or I should search in each relation for my window id, which is already - and unfortunately - what I am doing).
Regards,
Guillaume
OK. I'm thinking about adding a method to SDAI_Application_instance that initializes the inverse attribute pointers, or initializing all of them when an instance is first requested from the InstMgr. Either way will be slow unless we can find a way to avoid searching through all instances that might match the inverse attribute.Regards
Mark
On Mon, Jul 16, 2012 at 4:44 AM, guparan <gup...@gmail.com> wrote:Le dimanche 15 juillet 2012 14:55:12 UTC+2, mark a écrit :I have improved upon the inverse attribute test. Now, it looks for inverse attributes in the supertypes as well - stepcode/test/cpp/schema_specific/inverse_attr1.cc
Did you test it with an IFC structure ? Because I still can't get any of my Ifcwindow relations (ifcpropertyset notably).
For the moment, I manage with the solution you suggested on 2012/07/02.
Oops, it only looks through the immediate supertypes; it also needs to look through their supertypes (and so on).