Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Importing SAT file

1 REPLY 1
SOLVED
Reply
Message 1 of 2
david.vinet
147 Views, 1 Reply

Importing SAT file

david.vinet
Explorer
Explorer

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

 

 

 

 

 

 

0 Likes

Importing SAT file

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

 

 

 

 

 

 

1 REPLY 1
Message 2 of 2
jeremy_tammik
in reply to: david.vinet

jeremy_tammik
Autodesk
Autodesk
Accepted 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.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

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.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report