buildingSMART Forums

How can I show one 2d representation and a different 3d representation in Revit?

I’ve read in the specification that I can have two geometric representation sub-contexts, one for 3d ‘body’ shapes and one for 2d ‘plan’ shapes.

I’m creating a new IFC authoring tool, and I’ve tried to set this up and I’m struggling to get it to work using Revit as my desired viewer.

I set up one main GeometricRepresentationContext of type ‘Model’, with the two subcontexts mentioned above, but I can never get my 2d shape to show up in the plan view unless I also put my 3d shape in that plan subcontext as well.

I’m trying to have door swings appear in 2d (with a basic open door shape) but in 3d have the door closed with full 3d geometry.

Here is what I have so far. I’m using a rectangle for my temporary swing representation but it doesn’t seem to be working.

Any suggestions?

ISO-10303-21;
HEADER;
FILE_DESCRIPTION((‘ViewDefinition[CoordinationView]’),‘2;1’);
FILE_NAME(‘Test.ifc’,‘2019-11-25T15:38:47’,(‘Test Author’,‘testAuthor@test.com’),(‘Test Organization’),’ IFC Object Library’,‘Automated Test Suite’,‘Test Authorizer’);
FILE_SCHEMA((‘IFC2X3’));
ENDSEC;
DATA;
#1=IFCORGANIZATION(’’,‘Test Organization’,,,); #2=IFCAPPLICATION(#1,'Test Version','Automated Test Suite','IFC Tests'); #3=IFCPERSON(,‘Person’,‘Test’,,,,,); #4=IFCPERSONANDORGANIZATION(#3,#1,);
#5=IFCOWNERHISTORY(#4,#2,,.NOCHANGE.,,,,1574696328);
#6=IFCCARTESIANPOINT((0.,0.,0.));
#7=IFCDIRECTION((1.,0.,0.));
#8=IFCDIRECTION((0.,1.,0.));
#9=IFCDIRECTION((0.,0.,1.));
#10=IFCDIRECTION((1.,0.));
#11=IFCAXIS2PLACEMENT3D(#6,#9,#7);
#12=IFCAXIS2PLACEMENT2D(#6,#10);
#13=IFCGEOMETRICREPRESENTATIONCONTEXT(,'Model',3,0.,#11,#8); #14=IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Body','Model',*,*,*,*,#13,,.MODEL_VIEW.,); #15=IFCGEOMETRICREPRESENTATIONCONTEXT('FootPrint','Plan',2,0.00001,#12,#10); #16=IFCGEOMETRICREPRESENTATIONSUBCONTEXT('FootPrint','Plan',*,*,*,*,#15,,.PLAN_VIEW.,); #17=IFCDIMENSIONALEXPONENTS(0,0,0,0,0,0,0); #18=IFCDIMENSIONALEXPONENTS(1,0,0,0,0,0,0); #19=IFCDIMENSIONALEXPONENTS(2,0,0,0,0,0,0); #20=IFCDIMENSIONALEXPONENTS(3,0,0,0,0,0,0); #21=IFCSIUNIT(*,.AREAUNIT.,.MILLI.,.SQUARE_METRE.); #22=IFCSIUNIT(*,.VOLUMEUNIT.,.MILLI.,.CUBIC_METRE.); #23=IFCSIUNIT(*,.PLANEANGLEUNIT.,,.RADIAN.);
#24=IFCSIUNIT(,.LENGTHUNIT.,.MILLI.,.METRE.);
#25=IFCMEASUREWITHUNIT(IFCREAL(25.4),#24);
#26=IFCCONVERSIONBASEDUNIT(#18,.LENGTHUNIT.,‘inch’,#25);
#27=IFCMEASUREWITHUNIT(IFCREAL(92903.039062),#21);
#28=IFCCONVERSIONBASEDUNIT(#19,.AREAUNIT.,‘square foot’,#27);
#29=IFCMEASUREWITHUNIT(IFCREAL(28316846.),#22);
#30=IFCCONVERSIONBASEDUNIT(#20,.VOLUMEUNIT.,‘cubic foot’,#29);
#31=IFCMEASUREWITHUNIT(IFCREAL(0.017453),#23);
#32=IFCCONVERSIONBASEDUNIT(#17,.PLANEANGLEUNIT.,‘DEGREE’,#31);
#33=IFCSIUNIT(
,.SOLIDANGLEUNIT.,,.STERADIAN.); #34=IFCSIUNIT(*,.MASSUNIT.,,.GRAM.);
#35=IFCSIUNIT(,.TIMEUNIT.,,.SECOND.); #36=IFCSIUNIT(*,.THERMODYNAMICTEMPERATUREUNIT.,,.DEGREE_CELSIUS.);
#37=IFCSIUNIT(
,.LUMINOUSINTENSITYUNIT.,$,.LUMEN.);
#38=IFCUNITASSIGNMENT((#26,#28,#30,#32,#33,#34,#35,#36,#37));
#39=IFCPROJECT(‘3pH5OaQE93ph$izSLtkju3’,#5,’’,’’,’’,’’,’’,(#13,#15),#38);
#40=IFCLOCALPLACEMENT($,#11);
#41=IFCSITE(‘3JXWKp$eX4BA$uXDKAd0Kh’,#5,‘Default Site’,‘Description of Default Site’,,#40,,,.ELEMENT.,(50,59,25),(113,57,40),0.,,); #42=IFCRELAGGREGATES('1kDfIGlpz938lWVTQasHQX',#5,,,#39,(#41)); #43=IFCLOCALPLACEMENT(#40,#11); #44=IFCBUILDING('3isdCqxQv3juXLpQ57ijoE',#5,'','','',#43,,,.ELEMENT.,,,);
#45=IFCRELAGGREGATES(‘0KquEtz351hha$DdIX_snZ’,#5,’’,’’,#41,(#44));
#46=IFCLOCALPLACEMENT(#43,#11);
#47=IFCBUILDINGSTOREY(‘0IMkiUWXP4rgzCktFcfzqS’,#5,‘Only Storey’,’’,,#46,,,.ELEMENT.,0.); #48=IFCRELAGGREGATES('0HDromRTL7gQwULKCTF412',#5,'','',#44,(#47)); #49=IFCAXIS2PLACEMENT3D(#6,#9,#7); #50=IFCLOCALPLACEMENT(#46,#49); #51=IFCCARTESIANPOINT((0.,0.)); #52=IFCDIRECTION((-1.,0.)); #53=IFCAXIS2PLACEMENT2D(#51,#52); #54=IFCRECTANGLEPROFILEDEF(.AREA.,,#53,200.,4.);
#55=IFCCARTESIANPOINT((0.,0.,0.));
#56=IFCAXIS2PLACEMENT3D(#55,,);
#57=IFCEXTRUDEDAREASOLID(#54,#56,#9,90.);
#58=IFCSHAPEREPRESENTATION(#14,‘Body’,‘Brep’,(#57));
#59=IFCPRODUCTDEFINITIONSHAPE(,,(#58));
#60=IFCWALLTYPE(‘25vdYkj9zC4874gZ$l6F6R’,#5,’’,‘KingMakerCustomItem_Type option’,,,,'Test Wall','Test Wall',.STANDARD.); #61=IFCWALLSTANDARDCASE('2cvJIQEFD1SQ0PHBDJl0hd',#5,'Test Wall',,’’,#50,#59,‘Test Wall’);
#62=IFCRELDEFINESBYTYPE(‘0QglFifDjDMhTV4HJgZJAa’,#5,,,(#61),#60);
#63=IFCCARTESIANPOINT((50.,-36.));
#64=IFCDIRECTION((1.,0.));
#65=IFCAXIS2PLACEMENT2D(#63,#64);
#66=IFCRECTANGLEPROFILEDEF(.AREA.,,#65,30.,72.); #67=IFCCARTESIANPOINT((0.,-2.,0.)); #68=IFCAXIS2PLACEMENT3D(#67,#8,#7); #69=IFCEXTRUDEDAREASOLID(#66,#68,#9,4.); #70=IFCSHAPEREPRESENTATION(#14,'Body','SweptSolid',(#69)); #71=IFCPRODUCTDEFINITIONSHAPE(,,(#70)); #72=IFCOPENINGELEMENT('11JlNZUhnCEeUzqUTBy3gv',#5,'Opening','Opening Description','Opening',#50,#71,);
#73=IFCRELVOIDSELEMENT(‘1kFELI_kT5Ff$SF2iTf11S’,#5,,,#61,#72);
#74=IFCCARTESIANPOINT((50.,0.));
#75=IFCDIRECTION((-1.,0.));
#76=IFCAXIS2PLACEMENT2D(#74,#75);
#77=IFCRECTANGLEPROFILEDEF(.AREA.,,#76,29.,2.); #78=IFCCARTESIANPOINT((0.,4.,0.)); #79=IFCAXIS2PLACEMENT3D(#78,,); #80=IFCEXTRUDEDAREASOLID(#77,#79,#9,71.); #81=IFCSHAPEREPRESENTATION(#14,'Body','Brep',(#80)); #82=IFCCARTESIANPOINT((50.,0.)); #83=IFCDIRECTION((1.,0.)); #84=IFCAXIS2PLACEMENT2D(#82,#83); #85=IFCCARTESIANPOINT((-10.,5.)); #86=IFCCARTESIANPOINT((10.,5.)); #87=IFCCARTESIANPOINT((10.,-5.)); #88=IFCCARTESIANPOINT((-10.,-5.)); #89=IFCPOLYLINE((#85,#86)); #90=IFCPOLYLINE((#88,#87)); #91=IFCPOLYLINE((#85,#88)); #92=IFCPOLYLINE((#86,#87)); #93=IFCGEOMETRICSET((#89,#90,#91,#92)); #94=IFCSHAPEREPRESENTATION(#16,'FootPrint','GeometricSet',(#93)); #95=IFCPRODUCTDEFINITIONSHAPE(,,(#81,#94)); #96=IFCDOORSTYLE('33JaY3GD9E9eFXgGxnjOAB',#5,'','KingMakerCustomItem_Type option',,,,‘Test Door’,.SLIDING_TO_LEFT.,.ALUMINIUM.,.F.,.F.);
#97=IFCDOOR(‘1sJB7tpULFevZmiwlPC1JY’,#5,‘Test Door’,$,’’,#50,#95,‘Test Door’,72.,30.);
#98=IFCRELDEFINESBYTYPE(‘2joLajRBjBzws$O116d$FS’,#5,,,(#97),#96);
#99=IFCRELFILLSELEMENT(‘2$iR5z1nHC3f7WZEzm89hO’,#5,,,#72,#97);
#100=IFCRELCONTAINEDINSPATIALSTRUCTURE(‘0PNkllgiLF7eoKyAR82nEC’,#5,,,(#61,#72,#97),#47);
ENDSEC;
END-ISO-10303-21;

There are a few issues with your IFC. Firstly, null values should be $, not left blank. New entities should be on new lines, not as shown on #93. At a glance I suspect Revit doesn’t parse the GeometricSet. Have you tried other representations?

BlenderBIM allows free and open source authoring of IFC and supports exporting of different geometric representation contexts and sub-contexts, which may interest you. It is based on IfcOpenShell, which I highly recommend which may help you shortcut a lot of work such as fixing those syntatical problems above, if you are building your own authoring tool (or, perhaps join as a contributor to BlenderBIM?) This example shows an export of three types of geometry: a body, clearance geometry, and footprint curve for a single IFC product:

image

Revit is able to import this successfully:

image

Note that although Revit can import it, it can only modify certain representation types, and the context data is lost if you try and export it out of Revit.

I’ve attached the IFC file for you to inspect: test.blend.ifc (14.7 KB)

1 Like

Thank you, Moult, I recognize your name – having seen a couple articles from your site previously.

I should have uploaded my IFC file instead of pasting it in to the discussion window. I believe that when I pasted it in, the dollar signs were stripped out and the line breaks were messed up. I’ll attach it instead next time.

When I open, in Revit, the IFC file you attached to your reply, I see the three different elements, but all at the same time in both the 3d and plan views.

There are still two questions I have.

  1. If the 2d element were a door swing I didn’t want to be visible in revit’s 3d view, is there a way in IFC to specify that it should only appear in the plan view and not in the 3d view?

  2. If the 3d body element were a closed door, is there a way to specify in IFC that it should be hidden in the plan view and only appear in the 3d view?

No worries, if you could attach your IFC file that would help debug.

I think (could be wrong) that from the IFC side the file has already specified all that it can in terms of saying “this geometry is footprint in a plan view” and “this geometry is clearance” and “this geometry is body”.

It suggests that out of the box, Revit does not automatically set visual settings based on attributes like PLAN_VIEW. This sounds like a Revit limitation. Perhaps there is a property which Revit records that you can then set a filter for in your views? I’m not sure.

My file is really not too different from the file you attached except for the use of the ‘Plan’ IfcGeometricRepresentationContext under which the 2d shape’s sub-context is placed. I had tried that as well without much success. I will explore the possibility of using properties to hide/show elements from inside Revit. Those would be custom properties, as opposed to a Revit-defined property that already controls visibility, correct?

For example, when creating a family in revit, there are checkboxes that allow a user to select whether a shape should appear in 2D or 3D plan views. Those aren’t able to be pre-populated through IFC via properties as far as you know, are they?

It is unfortunate that Revit doesn’t quite seem to reach the level of flexibility with shape visibility promised by the specification’s IfcGeometricRepresentationSubcontext element which seems to infer that I could have even different LOD versions of an element.

Each IfcProduct can then have several instances of subtypes of IfcRepresentation , each being assigned to a different geometric representation context ( IfcGeometricRepresentationContext or IfcGeometricRepresentationSubContext ). The application can then choose the most appropriate representation for showing the geometric shape of the product, depending on the target view and scale.

The IfcGeometricRepresentationSubContext is used to define semantically distinguished representation types for different information content, dependent on the representation view and the target scale. It can be used to control the level of detail of the shape representation that is most applicable to this geometric representation context.

PS. In your example, with the file open in Revit, is there a way to toggle between the clearance geometry and the body geometry views for the project as a whole?

As far as I am aware, those Revit checkboxes are not connected to IFC data. I was kind of referring to regular IFC psets, which you could then put a filter on. But upon thinking it through, the three shapes are merged into a single object in IFC, so it may be very hard to separate them.

I am not aware of Revit supporting the ability to toggle geometry contexts. It’s a shame, as it would be tremendously useful :frowning:

1 Like

I was able to accomplish separate representations in Revit’s model and plan view by using a second IfcGeometricRepresentationContext. I tried using a sub-context, but I couldn’t get it to work in Revit 2020. Below is an excerpt of a door that is an extruded solid in model view and just header lines in plan view using a ‘footprint’ representation.

#3 = IFCGEOMETRICREPRESENTATIONCONTEXT($, 'Plan', 3, 1.E-5, #35, #37);
#4 = IFCGEOMETRICREPRESENTATIONCONTEXT($, 'Model', 3, 1.E-5, #35, #37);

#93 = IFCPRODUCTDEFINITIONSHAPE($, $, (#96, #94));
#107 = IFCRELFILLSELEMENT('2grsEu5292wx21mtGUqqJA', #2, $, $, #88, #12);
#94 = IFCSHAPEREPRESENTATION(#3, 'Footprint', 'Curve2D', (#95));
#95 = IFCPOLYLINE((#82, #83, #84, #85, #86));
#96 = IFCSHAPEREPRESENTATION(#4, 'Body', 'SweptSolid', (#97));
#97 = IFCEXTRUDEDAREASOLID(#98, #105, #8, 7.7);
#98 = IFCARBITRARYCLOSEDPROFILEDEF(.AREA., $, #99);
#99 = IFCPOLYLINE((#100, #101, #102, #103, #104));

Yes, except doors are usually more than 0.00001 feet high :slight_smile: What you’ve done doesn’t sound like separate representations in model and plan view, it sounds like you’ve just made the body representation unnoticable.

1 Like

I meant to say that I used a second IfcGeometricRepresentationContext instead of the perscribed sub-context. I fixed the post and included the extra two lines at the top, but the plan view should only have 2 dimensions. I also gave the door a height to make it cleaner.

1 Like

Thanks Trevor,

Can you attach or share a copy of that entire IFC file for me to play with?

Sure. Here’s the file of a wall with a doorless opening.Without the lines in plan view, there is just an empty gap in Revit. PlanVsModelExample.ifc (5.4 KB)

Thanks for your file. From my tests it seems as though the behaviour is a little specific to your situation of a door filling up an opening element. If the door doesn’t fill the opening element, or if you swap the footprint to the wall object itself, your example ceases to work.

I ran my own tests of three building element proxies. From left to right first there is an object which has both a Model Body representation (cube) and a Plan Footprint representation (thin rectangle), the second object is purely a Model Body representation (common case), and the third is purely a Plan Footprint representation. In Revit, in 3D, we see all representations:

In plan view (and I have been able to consistently reproduce this with different objects and scenarios e.g. subcontext vs context assignment, curve 2d vs curve 3d), we see this: if an object has both model and plan, both are shown. If an object is just a model, it is shown. If a model is just a plan, somewhat unexpectedly, nothing displays. This is the opposite of what you have managed to achieve with your door and opening element.

I have attached my test file here:

context.ifc (10.7 KB)

My results have been similar to Moult’s. The 2D representation always appears in 3D no matter what combination of IfcGeometricRepresentationContext or IfcGeometricRepresentationSubContext I use.

I do have one IFC File where somehow only a door swing appears in plan view but the full door (without the swing) appears in the model view. I suspect this is a glitch somehow but I’m not sure what the glitch is or how to reproduce it since this is the effect I would like.2dMissingDoor.ifc (37.8 KB)

2D
image

3D

File is attached…

I can confirm that it seems to work in the corner case of objects filling in openings. Other than that, no dice :frowning:

Interesting to see in your file @npackham that it doesn’t really care if the Footprint shape representation is assigned to the Annotation subcontext (which is not correct, to my understanding, as they must match).

Explanations can be found as well at
https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2/HTML/schema/ifcrepresentationresource/lexical/ifcgeometricrepresentationcontext.htm

especially “Figure 418 — Example of using geometric representation contexts”

But this does not provide an answer on the question why there exist many different implementations, some far away from common sense.

“I’m trying to have door swings appear in 2d (with a basic open door shape) but in 3d have the door closed with full 3d geometry.”

Use DWG instead of IFC.
Load in a XREF of 2D linework (in one 3D view only)