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: 

Error when creating a new foundation wall

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
jordanmarr
842 Views, 5 Replies

Error when creating a new foundation wall

I am trying to create a foundation wall to go along with a newly created Wall, but the Create.NewFoundationWall is throwing this exception:

 

SEHException was caught

External component has thrown an exception.

 

Here is my code:

        private void CreateFooting(Wall wall)
        {
            var coll = new FilteredElementCollector(Doc);
            ContFootingType type = coll.OfClass(typeof(ContFootingType)).Cast<ContFootingType>().First();
            Doc.Create.NewFoundationWall(type, wall); // Throws SEHException
        }

 

5 REPLIES 5
Message 2 of 6
ollikat
in reply to: jordanmarr

Have you ran with the debugger and checked that neither of the parameters are carbage?

 

Also you could provide little bit more accurate information about the thrown exception.

Message 3 of 6
jordanmarr
in reply to: ollikat

The exception message:

Message: "External component has thrown an exception."

ErrorCode: -2147467259

Source: RevitAPI

 

That is all the information provided by the exception, and the inner exception is null. 

 

I believe my input parameters are not garbage, but here are copies of each from the Watch window:

 

ContFootingType (in Watch window):

-		type	{Autodesk.Revit.DB.ContFootingType}	Autodesk.Revit.DB.ContFootingType
-		base	{Autodesk.Revit.DB.ContFootingType}	Autodesk.Revit.DB.HostObjAttributes {Autodesk.Revit.DB.ContFootingType}
-		base	{Autodesk.Revit.DB.ContFootingType}	Autodesk.Revit.DB.ElementType {Autodesk.Revit.DB.ContFootingType}
-		base	{Autodesk.Revit.DB.ContFootingType}	Autodesk.Revit.DB.Element {Autodesk.Revit.DB.ContFootingType}
+		AssemblyInstanceId	{-1}	Autodesk.Revit.DB.ElementId
+		Category	{Autodesk.Revit.DB.Category}	Autodesk.Revit.DB.Category
		DesignOption	null	Autodesk.Revit.DB.DesignOption
+		Document	{Autodesk.Revit.DB.Document}	Autodesk.Revit.DB.Document
		Group	null	Autodesk.Revit.DB.Group
+		Id	{74960}	Autodesk.Revit.DB.ElementId
		Level	null	Autodesk.Revit.DB.Level
		Location	null	Autodesk.Revit.DB.Location
+		Materials	{Autodesk.Revit.DB.MaterialSet}	Autodesk.Revit.DB.MaterialSet
		Name	"Bearing Footing - 900 x 300"	string
		ObjectType	null	Autodesk.Revit.DB.ElementType
+		OwnerViewId	{-1}	Autodesk.Revit.DB.ElementId
+		Parameters	{Autodesk.Revit.DB.ParameterSet}	Autodesk.Revit.DB.ParameterSet
+		ParametersMap	{Autodesk.Revit.DB.ParameterMap}	Autodesk.Revit.DB.ParameterMap
		PhaseCreated	null	Autodesk.Revit.DB.Phase
		PhaseDemolished	null	Autodesk.Revit.DB.Phase
		Pinned	false	bool
+		SimilarObjectTypes	{Autodesk.Revit.DB.ElementSet}	Autodesk.Revit.DB.ElementSet
		UniqueId	"5f508b89-6196-4580-8385-8276203b8fd3-000124d0"	string
		ViewSpecific	false	bool
+		WorksetId	{0}	Autodesk.Revit.DB.WorksetId
+		Non-Public members		

 

 

Wall instance (in Watch window): 

-		wall	{Autodesk.Revit.DB.Wall}	Autodesk.Revit.DB.Wall
+		base	{Autodesk.Revit.DB.Wall}	Autodesk.Revit.DB.HostObject {Autodesk.Revit.DB.Wall}
		CurtainGrid	null	Autodesk.Revit.DB.CurtainGrid
		Flipped	true	bool
+		Orientation	{(0.000000000, 1.000000000, 0.000000000)}	Autodesk.Revit.DB.XYZ
		StructuralUsage	Bearing	Autodesk.Revit.DB.Structure.StructuralWallUsage
-		WallType	{Autodesk.Revit.DB.WallType}	Autodesk.Revit.DB.WallType
-		base	{Autodesk.Revit.DB.WallType}	Autodesk.Revit.DB.HostObjAttributes {Autodesk.Revit.DB.WallType}
-		base	{Autodesk.Revit.DB.WallType}	Autodesk.Revit.DB.ElementType {Autodesk.Revit.DB.WallType}
-		base	{Autodesk.Revit.DB.WallType}	Autodesk.Revit.DB.Element {Autodesk.Revit.DB.WallType}
+		AssemblyInstanceId	{-1}	Autodesk.Revit.DB.ElementId
+		Category	{Autodesk.Revit.DB.Category}	Autodesk.Revit.DB.Category
		DesignOption	null	Autodesk.Revit.DB.DesignOption
+		Document	{Autodesk.Revit.DB.Document}	Autodesk.Revit.DB.Document
		Group	null	Autodesk.Revit.DB.Group
+		Id	{1060}	Autodesk.Revit.DB.ElementId
		Level	null	Autodesk.Revit.DB.Level
		Location	null	Autodesk.Revit.DB.Location
+		Materials	{Autodesk.Revit.DB.MaterialSet}	Autodesk.Revit.DB.MaterialSet
		Name	"Foundation - 300mm Concrete"	string
		ObjectType	null	Autodesk.Revit.DB.ElementType
+		OwnerViewId	{-1}	Autodesk.Revit.DB.ElementId
+		Parameters	{Autodesk.Revit.DB.ParameterSet}	Autodesk.Revit.DB.ParameterSet
+		ParametersMap	{Autodesk.Revit.DB.ParameterMap}	Autodesk.Revit.DB.ParameterMap
		PhaseCreated	null	Autodesk.Revit.DB.Phase
		PhaseDemolished	null	Autodesk.Revit.DB.Phase
		Pinned	false	bool
+		SimilarObjectTypes	{Autodesk.Revit.DB.ElementSet}	Autodesk.Revit.DB.ElementSet
		UniqueId	"74e46f31-7d48-47ee-9207-931708e57a52-00000424"	string
		ViewSpecific	false	bool
+		WorksetId	{0}	Autodesk.Revit.DB.WorksetId
+		Non-Public members		
		Kind	Basic	Autodesk.Revit.DB.WallKind
		Width	0.98425196850393681	double
		Width	0.98425196850393681	double

 

 

Message 4 of 6
jordanmarr
in reply to: jordanmarr

I still have not solved this problem.  Does anyone know if there are certain requirements on the wall object that I am passing in as a parameter? 

 

I really have no clue why I am getting this exception, and the error message gives no clue whatsoever as to the real nature of the problem. 

 

 

Message 5 of 6
jeremytammik
in reply to: jordanmarr

Dear Jordanmarr,

 

I am answering this rather belatedly, since I just saw the same issue raised for the Revit 2013 API in this thread:

 

http://forums.autodesk.com/t5/Revit-API/Can-t-create-wall-foundation/m-p/4896020

 

Here is the answer that I provided there:

 

I am sorry to inform you that there was an issue with the NewFoundationWall method in Revit 2013.

It has been fixed in Revit 2014.

I found this information searching through my old ADN issues and encountering case 07700489 [Error when creating a new foundation wall] and SPR #230113 [NewFoundationWall does not work] that I explored back in October 2012.

Sorry for the bad news for Revit 2013, and happy to let you know it should work fine in Revit 2014.

Best regards,

Jeremy



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

Message 6 of 6
jordanmarr
in reply to: jeremytammik

Thanks Jeremy.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community