Making API for energy calculation, unable to "Set Parameters for certain walls to certain directions"

Making API for energy calculation, unable to "Set Parameters for certain walls to certain directions"

allazaruszcheong_21
Enthusiast Enthusiast
1,438 Views
23 Replies
Message 1 of 24

Making API for energy calculation, unable to "Set Parameters for certain walls to certain directions"

allazaruszcheong_21
Enthusiast
Enthusiast

Developing RevitAPI, calculating net energy transfer by a bulidng, it involves the directions of the walls, it works on a simple model, but not a more complicated real life model. Need help.


//Checking for SouthWest Facing Walls & Windows
bool isSouthWestFacing = IsSouthWestFacing(exteriorDirection);
if (isSouthWestFacing)
{
SouthWest_Wall_Lst.Add(WE);

inserts_0 = (WE as HostObject).FindInserts(true, true, true, true);

ParaSouthWestWall = WE.LookupParameter("SouthWest");
using (Transaction trans = new Transaction(doc, "ETTV_1"))
{
trans.Start();
ParaSouthWestWall.Set(1);

foreach (ElementId emtid in inserts_0)
{
Element emt = doc.GetElement(emtid);
emt.LookupParameter("SouthWest").Set(1);
}
trans.Commit();
}


}

the first error occurs when i try to set(1) the SpecialParameters "southwest" to a checkbox 



0 Likes
1,439 Views
23 Replies
Replies (23)
Message 21 of 24

allazaruszcheong_21
Enthusiast
Enthusiast

Hi update, there were missing parameters under the Text header, i have added them as global parameters

allazaruszcheong_21_0-1700470227802.png

 

allazaruszcheong_21_1-1700470242030.png

these are no longer an issue however a new issue arose being that being at line 1591

allazaruszcheong_21_2-1700470281969.png

this is the error that pops up.

allazaruszcheong_21_3-1700470306267.png


Anybody help?

0 Likes
Message 22 of 24

ctm_mka
Collaborator
Collaborator

First, Check that what is being dim'd as a wall, is actually a wall, and not null. Second, if it is a wall, try get parameter from the element (e) instead of the wall. 

0 Likes
Message 23 of 24

allazaruszcheong_21
Enthusiast
Enthusiast

They are walls...

0 Likes
Message 24 of 24

ctm_mka
Collaborator
Collaborator

apologies, let me rephrase that, when your code gets to line 1589, verify that wall is not null.

0 Likes