Create GlobalParameter

Create GlobalParameter

mahadev.v
Contributor Contributor
870 Views
5 Replies
Message 1 of 6

Create GlobalParameter

mahadev.v
Contributor
Contributor

can anyone tell 
how to create a Global Parameter 
here 3rd argument is Parameter Type what that mean?

Thanks

public static GlobalParameter Create(
	Document document,
	string name,
	ParameterType datatype
)


 

0 Likes
Accepted solutions (2)
871 Views
5 Replies
Replies (5)
Message 2 of 6

Mohamed_Arshad
Advisor
Advisor
Accepted solution

HI @mahadev.v 


   3rd Argument is ParameterType  i.e which type of value  you're going to save. (ex. Text,Number, Length, Area) use the

ParameterType  Enum for this. 

 

Reference Code:

 Document doc = commandData.Application.ActiveUIDocument.Document;

            using (Transaction createGlobalParameter = new Transaction(doc, "Create Global Parameter"))
            {
                createGlobalParameter.Start();

                //By using Parameter, use can able to fill only number
                GlobalParameter param = GlobalParameter.Create(doc, "Demo Length Parameter", ParameterType.Length);


                //By using Parameter, use can able to fill only Text
                GlobalParameter param_02 = GlobalParameter.Create(doc, "Demo Text Parameter", ParameterType.Text);


                createGlobalParameter.Commit();
            }

 

 

Reference Output Image:

Mohamed_Arshad_0-1693405221708.png

 

 

Hope this will helps 🙂


Mohamed Arshad K
Software Developer (CAD & BIM)

0 Likes
Message 3 of 6

mahadev.v
Contributor
Contributor

Thanks a lot Mohammed 🙏.
let me try this 😊

0 Likes
Message 4 of 6

mahadev.v
Contributor
Contributor

Hi Mohamed unfortunately Parameter type Enum is not Available in 2024 Version. can you tell me if you know the Solution.


Thank you 

0 Likes
Message 5 of 6

mahadev.v
Contributor
Contributor

my requirement is I want to disable or Un editable the Parameters.

if you know the solution then tell me it will be helpful for me.

0 Likes
Message 6 of 6

Mohamed_Arshad
Advisor
Advisor
Accepted solution

Hi @mahadev.v 

 

 For Revit 2024, Instead of Enum Kindly use SpecTypeId.Length class for forgetypeId, Autodesk  have updated the Enum to class

 

Hope this will helps 🙂


Mohamed Arshad K
Software Developer (CAD & BIM)