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: 

SEHException on Create.NewFloor

6 REPLIES 6
Reply
Message 1 of 7
michael-coffey
657 Views, 6 Replies

SEHException on Create.NewFloor

michael-coffey
Advocate
Advocate

I created a sample file from a project I'm working on.  The embedded macro creates a floor from a room's boundary.  I've used this code on hundreds of rooms but then came across a couple of places where I receive a InteropServices.SEHException (0x80004005) External component has thrown an exception.  When the code is run on Room 1, you will get the exception.  Change the roomNum variable to 2 to run on the other room and it works fine. Thanks for any help.

0 Likes

SEHException on Create.NewFloor

I created a sample file from a project I'm working on.  The embedded macro creates a floor from a room's boundary.  I've used this code on hundreds of rooms but then came across a couple of places where I receive a InteropServices.SEHException (0x80004005) External component has thrown an exception.  When the code is run on Room 1, you will get the exception.  Change the roomNum variable to 2 to run on the other room and it works fine. Thanks for any help.

Tags (2)
Labels (2)
6 REPLIES 6
Message 2 of 7
Moustafa_K
in reply to: michael-coffey

Moustafa_K
Collaborator
Collaborator

Just came through this while searching for something... I know it is very old now, but I would prefer to give a piece of advice since there are many reasons that lead to this exception, I don't think you will get an answer unless you explain more by Code. You need to show which line caused the exception and under what condition besides the whole context. 

 

Hope this helps. 

 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes

Just came through this while searching for something... I know it is very old now, but I would prefer to give a piece of advice since there are many reasons that lead to this exception, I don't think you will get an answer unless you explain more by Code. You need to show which line caused the exception and under what condition besides the whole context. 

 

Hope this helps. 

 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 3 of 7

michael-coffey
Advocate
Advocate

Hi @Moustafa_K .  I haven't found a solution to these rooms (other than creating the floor manually).  But I thought the title would clue in on where the exception is.  Create.NewFloor

0 Likes

Hi @Moustafa_K .  I haven't found a solution to these rooms (other than creating the floor manually).  But I thought the title would clue in on where the exception is.  Create.NewFloor

Message 4 of 7
Moustafa_K
in reply to: michael-coffey

Moustafa_K
Collaborator
Collaborator

Hi,

I tested your Revit File on Revit 2021, and it appears to be a bug in Revit API since it works perfectly on 2022.

 

Worth noting on Revit 2022 the Method of creation has changed to be a static call from Floor Class

 public static Floor Create(Document document, IList<CurveLoop> profile, ElementId floorTypeId, ElementId levelId);

also noting, the old method did indeed give the same Error on Revit 2022. 

 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes

Hi,

I tested your Revit File on Revit 2021, and it appears to be a bug in Revit API since it works perfectly on 2022.

 

Worth noting on Revit 2022 the Method of creation has changed to be a static call from Floor Class

 public static Floor Create(Document document, IList<CurveLoop> profile, ElementId floorTypeId, ElementId levelId);

also noting, the old method did indeed give the same Error on Revit 2022. 

 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 5 of 7
michael-coffey
in reply to: Moustafa_K

michael-coffey
Advocate
Advocate

Thanks for testing.  At least I know its not just me.  I suppose there wouldn't be any hope of it being corrected in earlier versions.  I'll try in 2022 to confirm that the new methods work.  Thanks!

0 Likes

Thanks for testing.  At least I know its not just me.  I suppose there wouldn't be any hope of it being corrected in earlier versions.  I'll try in 2022 to confirm that the new methods work.  Thanks!

Message 6 of 7
Moustafa_K
in reply to: michael-coffey

Moustafa_K
Collaborator
Collaborator

Just to share something could be a temporary solution

I just realized the in Room 1, when room boundary segments are extracted from the Walls, it creates 6 lines instead of 5. the extra line is a connection between the 2 curved joint walls. this extra arc is of length < 0.007 which is less than 1/16 inch (the max precision unit in Revit) which causes this error when it comes to creating a floor. I bet the new method in 2022 recovered that.

 

mostafa90_0-1617640352232.png

 

So if you change these 2 curved walls to one curved wall. It would work fine. 

 

hope this helps

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes

Just to share something could be a temporary solution

I just realized the in Room 1, when room boundary segments are extracted from the Walls, it creates 6 lines instead of 5. the extra line is a connection between the 2 curved joint walls. this extra arc is of length < 0.007 which is less than 1/16 inch (the max precision unit in Revit) which causes this error when it comes to creating a floor. I bet the new method in 2022 recovered that.

 

mostafa90_0-1617640352232.png

 

So if you change these 2 curved walls to one curved wall. It would work fine. 

 

hope this helps

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 7 of 7
michael-coffey
in reply to: Moustafa_K

michael-coffey
Advocate
Advocate

I did suspect that it had something to do with the two arc walls.  Thanks for confirming!

0 Likes

I did suspect that it had something to do with the two arc walls.  Thanks for confirming!

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

Post to forums  

Autodesk Design & Make Report