Structural Connections not exported via Document.Export (Revit 2018/Python)

Structural Connections not exported via Document.Export (Revit 2018/Python)

igmuz
Contributor Contributor
3,300 Views
29 Replies
Message 1 of 30

Structural Connections not exported via Document.Export (Revit 2018/Python)

igmuz
Contributor
Contributor

I am trying to export REVIT Structural Connections to IFC with Document.Export.

 

When export is run from Python, all Generic Models with Family Category set to "Structural Connections" get exported, while none of the REVIT Structural Connections is exported.

From User Interface I manage to export both without a problem. In Family Mapping File, Revit Category Structural Connections is mapped to IFC Class Name IfcBuildingElementProxy.

 

Python code is shown below:

options=IFCExportOptions()
options.ExportBaseQuantities = False
options.FileVersion = IFCVersion.IFC2x3CV2
options.SpaceBoundaryLevel=0
options.WallAndColumnSplitting=False
options.FamilyMappingFile="D:\IFC_options.txt"
options.AddOption("ExportInternalRevitPropertySets","true")
options.FilterViewId = views[i].Id
DocumentManager.Instance.CurrentDBDocument.Export("D:\IFC eksport","Structural_Connections.ifc",options)

0 Likes
Accepted solutions (2)
3,301 Views
29 Replies
Replies (29)
Message 2 of 30

jeremytammik
Autodesk
Autodesk

Dear Igmuz,

 

Thank you for your query.

 

It makes no difference whether you are using Python or any other programming language to drive the Revit API.

 

I am surprised that you observe a difference between the export generated through the user interface and the API driven result.

 

I would expect it to be due to the options you are setting.

 

Are you sure the exact same options are applied when exporting manually?

 

The best place to discuss questions related to IFC export and import is the Revit IFC open source discussion forum:

 

https://sourceforge.net/p/ifcexporter/discussion/general

 

I hope this helps.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 30

igmuz
Contributor
Contributor

Dear 

 

 

 

options=IFCExportOptions()

0 Likes
Message 4 of 30

jeremytammik
Autodesk
Autodesk

Okey-doke, sorry to hear it, time to ask the development team to take a look.

 

Please provide an absolutely minimal reproducible case:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

Presumably, a minimal structural model containing only one or two structural connections that export perfectly well driven manually will suffice, with a (Python?) SharpDevelop macro attempting to export them in the same way that fails.

 

Thank you!

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 30

igmuz
Contributor
Contributor

Hi again,

 

I am attaching the test model, Dynamo script and the FamilyMapping text file.

 

In REVIT structure looks like this:

 

REVIT.PNG

IFC exported by user interface looks like this:  

Export UI.PNG

 

And when exported via API, structural connection defined via REVIT Add-In is not exported:

Export API.PNG

 

Notice that elements of Structural Connection category, if modelled as  Family, do get exported.

 

Thank you very much for your help.

Igor Muzdeka

 

0 Likes
Message 6 of 30

igmuz
Contributor
Contributor

It looks like I cannot attach Dynamo script, so I am pasting Python code instead:

 

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
# RevitServices to access the REvit file content (aka document)
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import os



# Define the doc you want to work with
doc = DocumentManager.Instance.CurrentDBDocument
#Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

for v in FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Views):
    if v.Name=="Export Structural Connections":
        view=v

output=[]


options=IFCExportOptions()
options.AddOption("Name","IFC Export")
options.AddOption("IFCVersion","21")
options.AddOption("IFCFileType","0")
options.AddOption("SpaceBoundaries","0")
options.AddOption("SitePlacement","0")
options.AddOption("ActivePhaseId","0")
options.AddOption("ExportBaseQuantities","False")
options.AddOption("SplitWallsAndColumns","False")
options.AddOption("ExportInternalRevitPropertySets","False")
options.AddOption("ExportIFCCommonPropertySets","True")
options.AddOption("Export2DElements","False")
options.AddOption("VisibleElementsOfCurrentView","True")
options.AddOption("Use2DRoomBoundaryForVolume","False")
options.AddOption("UseFamilyAndTypeNameForReference","False")
options.AddOption("ExportPartsAsBuildingElements","False")
options.AddOption("ExportSolidModelRep","False")
options.AddOption("ExportSchedulesAsPsets","False")

options.AddOption("ExportUserDefinedParameterMapping","True")
options.AddOption("ExportUserDefinedParameterMappingFileName",os.path.abspath("C:\ProgramData\Autodesk\ApplicationPlugins\IFC 2018.bundle\Contents\2018\ParameterMappingTable.txt").ToString())

options.AddOption("ExportUserDefinedPsets","False")
options.AddOption("ExportUserDefinedPsetsFileName",os.path.abspath("C:\ProgramData\Autodesk\ApplicationPlugins\IFC 2018.bundle\Contents\2018\IFC2x3 Coordination View.txt").ToString())

options.AddOption("ExportBoundingBox","False")
options.AddOption("IncludeSiteElevation","False")
options.AddOption("UseActiveViewGeometry","True")
options.AddOption("ExportSpecificSchedules","False")
#options.AddOption("TessellationLevelOfDetail",str(0.5))
options.AddOption("UseOnlyTriangulation","False")
options.AddOption("StoreIFCGUID","False")
options.AddOption("ExportRoomsInView","False")
options.AddOption("ExportLinkedFiles","False")
options.AddOption("ActiveViewId","0")
options.AddOption("ExcludeFilter","")
options.AddOption("COBieCompanyInfo","")
options.AddOption("COBieProjectInfo","")
options.AddOption("IsBuiltIn","False")
options.AddOption("IsInSession","False")
options.AddOption("FileVersionDescription","IFC 2x3 Coordination View 2.0")
options.FamilyMappingFile="D:\REVIT 2018\DYNAMO\Export Structural Connections\Export Structural Connections.txt"


options.FilterViewId = view.Id
x=doc.Export("D:\REVIT 2018\DYNAMO\Export Structural Connections","Export Structural Connections_API.ifc",options)
output.append(x)
        
        
#End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = output

0 Likes
Message 7 of 30

matthew_taylor
Advisor
Advisor

Hi @igmuz / @jeremytammik ,

 

Any news on this?

 


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
Message 8 of 30

jeremytammik
Autodesk
Autodesk

Dear Igmuz and Matt,

 

Thank you for your sample material and prompt for progress.

 

I logged the issue REVIT-143711 [Structural Connections are missing after Document.Export -- 14594124] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

I have not heard back from them yet on it.

 

I see two vaguely related issues:

 

  • RVTLMV-467 [Failed to export Structure connection (Revit 2017 new element], closed as 'by design'; checked with Structure team, both generic connection and red connection have no really geometry, so export nothing.
  • REVIT-62829 [[Export IFC] Some DirectShapes are not exported as properly categorized items in IFC], still open; Attached project is placed structural framing which is created as direct shape geometry. After exporting IFC format, only Structural Connections and Structural Column category disappeared.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team and prioritised against all other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 9 of 30

angel_velez
Autodesk
Autodesk
Accepted solution

Sorry for the slow response.  Please try adding:

 

options.AddOption("IncludeSteelElements","true")

 

and see if that fixes the issue.  I will try it locally, and also suggest that we make that the default, to match the UI.

 

Regards,

Angel



Angel Velez

Principal Software Engineer
0 Likes
Message 10 of 30

igmuz
Contributor
Contributor

Hi,

options.AddOption("IncludeSteelElements","true") did not solve the problem.

Structural Connections are still not exported to IFC modell.

0 Likes
Message 11 of 30

jeremytammik
Autodesk
Autodesk

Dear Igor,

 

Angel repeats that it works fine for him.

 

Can you please check that your structural connections are not set to 'not exported'?

 

Thank you.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 12 of 30

igmuz
Contributor
Contributor

Hi Jeremy,

 

In the code I am specifying same IFC Options that are used in export via User Interface:

options.FamilyMappingFile="D:\REVIT 2018\DYNAMO\Export Structural Connections\Export Structural Connections.txt"

 

IFC Options  er set up so Structural Connections are exported as IfcBuildingElementProxy:

Merknad 2019-03-29 113946.png

0 Likes
Message 13 of 30

jeremytammik
Autodesk
Autodesk

Dear Igor,

 

Thank you for your update and confirmation.

 

I passed it on to the developers.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 14 of 30

jeremytammik
Autodesk
Autodesk

They reply:

 

Have you tried to replicate this in the native Revit API?

 

I haven't tried Python, but using Revit API it works.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 15 of 30

igmuz
Contributor
Contributor

Jeremy, what do  you exactly mean with native Revit API?

I wrote a macro in C# and it did not work either! 😞

0 Likes
Message 16 of 30

jeremytammik
Autodesk
Autodesk

Yup, that's exactly what I meant.

 

Good for you.

 

Can you provide a minimal reproducible case to share with the development team to prove to them unequivocally that it does not work?

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

A minimal sample model with just a very few elements plus that macro should do the trick, plus exact step by step instructions to reproduce the problematic behaviour.

 

Thank you!

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 17 of 30

igmuz
Contributor
Contributor

Hi,

 

I am attaching the same minimal reproducible case file as before, this time with macro included.

0 Likes
Message 18 of 30

igmuz
Contributor
Contributor

This time with correct REVIT file.

0 Likes
Message 19 of 30

jeremytammik
Autodesk
Autodesk

Dear Igor,

 

Thank you for your update and reproducible case.

 

I opened your sample file in Revit 2019 and noted that it is stored in Revit 2018 format.

 

I see your macro IFC Export in there and executed it.

 

It is taking a very long time to complete...

 

In fact, it does not seem to be completing at all, just running forever.

 

I cancelled the first attempt after a couple of minutes and looked at the macro code next.

  

[Window Title]
Run Macro Failed

[Main Instruction]
Revit failed to execute IFCExport. 

[Expanded Information]
A problem has been detected. 

Autodesk.Revit.Exceptions.InvalidPathArgumentException: The folder does not exist.
Parameter name: folder
   at MacroModule.executeMacro_(MacroModule* , AString* macroName)
   at MacroModule.executeMacro(MacroModule* , AString* macroName)
   at MacroModule.executeMacro(MacroModule* , AString* )
   at UIMacroGeneralManager.runMacro(UIMacroGeneralManager* , MacroModule* pModule, AString* macroName)

[^] Hide details  [Close]

  

OK, I see that I have to edit the folder path.

 

I fixed the output folder path, and I still get the same problem.

 

Oh, looking again, I see that your code specifies several input files as well, e.g., ParameterMappingTable.txt, IFC2x3 Coordination View.txt, Export Structural Connections.txt.

 

They seem to be spread all over the place in your system.

 

Well, they are apparently not present in mine.

 

Unfortunately, I cannot run your code like this, nor pass it on to the development team.

 

Please realise that a reproducible sample setup means that it can truly be reproduced, preferably with a single click.

 

If any paths need to be edited, please specify that explicitly.

 

Please specify every single minute step required to reproduce the issue.

 

Nobody is ever eager to reproduce any problems, so you have to make it very convincing and simple, inevitable.

 

If you do not, people will not be able to see any problem, and it will remain yours only.

 

Can you please supply the missing files and instructions, so I can give it another try?

 

Thank you!

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 20 of 30

igmuz
Contributor
Contributor

Hi again,

 

I forgot to send Parameter Mapping File. Attached within this post.

 

Have fixed the directory issue. In the new attached file, code is refering to current file directory so please keep parameter mapping file within same folder as REVIT file.

 

ExportUserDefinedPsets is now set to false and the path to user defined pset is commented out.

 

Sorry for the inconveniece. 

0 Likes