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: 

System.NullReferenceException: 'Object reference not set to an instance of an object.'

5 REPLIES 5
Reply
Message 1 of 6
VanQuyet.Doan
610 Views, 5 Replies

System.NullReferenceException: 'Object reference not set to an instance of an object.'

I get an error when I duplicate family type and set parameter.
Has anyone encountered this error and is there any solution?


instance.PNG

5 REPLIES 5
Message 2 of 6

Hi @VanQuyet.Doan ,

 

It looks like there is no parameter called "t_w" in the newly created family symbol.

Make sure the parameter name is correct.

Make sure you are passing the correct parameter name in the LookUpParameter method.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 6

I have checked the names again, even though the names are correct, the same error occurs.
I think maybe it's the font error.

instance2.PNG

Message 4 of 6

Hi @VanQuyet.Doan ,

 

I have no clue why Revit is throwing an error.

1)Can you set the parameter value to this particular parameter via UI?

2)If Yes, then Could you Please try using FamilySymbol.Parameters instead of LookUpParameter?

Now Use foreach loop to access each parameter. Make sure the "H_s" parameter is present.

3)If the "H_s" parameter is present, Make sure the "H_s" parameter is not a read-only parameter and then try to set the value via API.

Sometimes the parameter can be read-only and user-modifiable. (i.e)parameter value can be changed via UI but not Via API.

For Testing purposes, Could you please try to set the value to the parameter directly instead of using MmToFeet(i.e)if the storage type is double, then pass the value as 30.00, etc.,

If nothing helps, could you please share the non-confidential file, non-confidential sample code you used, and step-by-step approach to reproduce the issue?

Please Note: Do not send us any information that you consider to be a trade secret to your company.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 5 of 6
Kennan.Chen
in reply to: VanQuyet.Doan

Is the H_s parameter an instance parameter?

Message 6 of 6

Hi @VanQuyet.Doan ,

 

I would suggest you download the RevitLookUp tool and explore the parameters.

https://github.com/jeremytammik/RevitLookup 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report