Hello,
REVIT 2022
I am trying to use a Custom Exporter to get the Lines of a modelpattern of a Ceiling.
There is a Topic to get the references, but I need the actual Lines of the modelhatch.
I think the use of a Custom Exporter is the only way to get them, right?
I created a Custom Exporter, it runs fine on a 3D view, but 'OnPolylineSegments' is not invoked.
So I am trying to export a CeilingPlan, but the error message says:
"The view is not exportable, such as a template view or wrong type view, for example"
https://www.revitapidocs.com/2020/5a648f8c-62a0-d4c7-873c-8eab9f7abe7d.htm
So it is possible to export a 2D view
https://www.revitapidocs.com/2020/58d06458-fd6a-bdef-c457-2c52b50a70e8.htm
"Note that currently the only 2D view types exported are IncludeGeometricObjects FloorPlan, CeilingPlan,Elevation, Section, Detail, EngineeringPlan, AreaPlan"
Dim context As New RevitExporter1.MyExportContext(MyDoc)
Dim Exporter As New CustomExporter(MyDoc, context) With {
.IncludeGeometricObjects = True,
.ShouldStopOnError = False,
.Export2DGeometricObjectsIncludingPatternLines = True,
.Export2DIncludingAnnotationObjects = True}
Exporter.Export(MyView)
I checked the 'MyView', the ViewType = CeilingPlan.
Anybody a solution?
Thanks in advance,
Chris Hanschen
LKSVDD architecten
The Netherlands
Solved! Go to Solution.
Solved by RPTHOMAS108. Go to Solution.
I think it has something to do with implementing
Implements Autodesk.Revit.DB.IExportContext
Implements IExportContext2D
if both implemented: 3D view will fail
if only 'IExportContext' is implemented: 2D views will fail.
Is this documented like this?
Chris
Yes it is well documented the 2D version (IExportContext2D) came about in the 2020 version. The original which could only export 3D views was around in the 2014 version (IExportContext).
Since 2016 IExportContext is inherited by two different interfaces e.g.:
IPhotoRenderContext (directly) & IModelExportContext (indirectly)
This is what is said about those:
"This base class (IExportContext) contains methods that are common to both the leaf interfaces. Although it is still possible to use classes deriving directly from this base interface (for backward compatibility), future applications should implement the new leaf interfaces only."
So in other words you should only be directly using:
IExportContext2D (For exporting 2D views, supports some not all)
IModelExportContext (For exporting 3D views)
IPhotoRenderContext (For exporting 3D views with render information).
You should only be implementing one of these above interfaces per exporter (for your purpose IExportContext2D). If you need to export both 2D and 3D views then you will need two exporters (each implementing one of the appropriate interfaces).
Below is the inheritance as understood from reading RevitAPI.chm.
@RPTHOMAS108 , Thanks for your explanation, this helps a lot!
I still find it confusing that Revit shows a message "The view is not exportable", it should (also) mention something like "Or use the right Class for 2D/3D (IExportContext2D /IModelExportContext)" or something like that 😉
Thanks again!
Chris Hanschen
LKSVDD architecten
The Netherlands
Can't find what you're looking for? Ask the community or share your knowledge.