Hi,
I found several example for importing SAT files in Revit and see that I could do it in two way, one is Document.Import and other is ShapeImporter.Convert
Why there is two way to do it. Is there a recommanded one?
We actually use Document.Import and it seems to be fine in Revit 2020.
We try the same SAT file in Revit 2022 and found that there is some missing element.
We then try with ShapeImporter.Convert and then create a DirectShape and missing element appear, the missing element are imported as mesh.
is this change in Revit 2022 a bug or the expected beahvior? Is there ane change note which explain why?
Finally, in all the example I found on internet for using ShapeImporter, I see that, we should do ShapeImpoter.Convert then open a transaction, create a direct shape and then commit the transaction.
In my test I found that if a run the command ShapeImporter.Convert outside a transaction, I've got an exception of type "Autodesk.Revit.Exceptions.ModificationOutsideTransactionException" with message Attempt to modify the model outside of transaction.
Is it require to open a transaction before calling ShapeImporter.Convert?
What is the modification done to the document (I've understand that the ShapeImporter create the geometry list but doesn't write it toe the file) ?
Thanks
Solved! Go to Solution.
Hi,
I found several example for importing SAT files in Revit and see that I could do it in two way, one is Document.Import and other is ShapeImporter.Convert
Why there is two way to do it. Is there a recommanded one?
We actually use Document.Import and it seems to be fine in Revit 2020.
We try the same SAT file in Revit 2022 and found that there is some missing element.
We then try with ShapeImporter.Convert and then create a DirectShape and missing element appear, the missing element are imported as mesh.
is this change in Revit 2022 a bug or the expected beahvior? Is there ane change note which explain why?
Finally, in all the example I found on internet for using ShapeImporter, I see that, we should do ShapeImpoter.Convert then open a transaction, create a direct shape and then commit the transaction.
In my test I found that if a run the command ShapeImporter.Convert outside a transaction, I've got an exception of type "Autodesk.Revit.Exceptions.ModificationOutsideTransactionException" with message Attempt to modify the model outside of transaction.
Is it require to open a transaction before calling ShapeImporter.Convert?
What is the modification done to the document (I've understand that the ShapeImporter create the geometry list but doesn't write it toe the file) ?
Thanks
Solved! Go to Solution.
Solved by jeremy_tammik. Go to Solution.
To answer your first question, I would use whichever approach works best for you. Apparently, importing the SAT file directly fails and creating a direct shape works. In that case, create the direct shape.
I am not aware of any documentation of such a change. It may also depend on your specific SAT file.
When you create a direct shape, it is stored as a Revit database element in the Revit document. This requires a modification of the document. This requires a transaction. So, yes, you need a transaction and a successful commit to complete this operation.
To answer your first question, I would use whichever approach works best for you. Apparently, importing the SAT file directly fails and creating a direct shape works. In that case, create the direct shape.
I am not aware of any documentation of such a change. It may also depend on your specific SAT file.
When you create a direct shape, it is stored as a Revit database element in the Revit document. This requires a modification of the document. This requires a transaction. So, yes, you need a transaction and a successful commit to complete this operation.
Can't find what you're looking for? Ask the community or share your knowledge.