shared parameters by API

shared parameters by API

Anonymous
Not applicable
409 Views
3 Replies
Message 1 of 4

shared parameters by API

Anonymous
Not applicable

Hi

 

from our CAD system we create through the APIs in Revit CAD objects
This CAD objects, we provide with properties.

These properties we would like to create a "shared parameters".
Can you generate through the APIs shared parameters?

If yes how?

How do we create the text file in which we declare the parameters.
- Shall we already transmit this during setup of our Revit Exporters?
- Or it will be created through the APIs

- How should the link be made of the shared file parameters to shared parameters in CAD object?

 

 

thanks

0 Likes
410 Views
3 Replies
Replies (3)
Message 2 of 4

IbrahimNaeem
Advocate
Advocate

what do u mean by cad object? are Revit families what you mean or objects inside another application like Autocad? and yes shared parameters creation and handling can be achieved using the Revit API.

0 Likes
Message 3 of 4

Anonymous
Not applicable

Sorry, of course the CAD objects we generate are families

0 Likes
Message 4 of 4

IbrahimNaeem
Advocate
Advocate

Well, Better if you define and bind shared parameters inside the family before "exporting" or producing them. 

to kick-start let's create the shared parameter file and get it to create bindings as far as you need: 

string spfile = String.Format(@"{0}//my_shared_parameter_file.txt", Namespace.classname.Assemblydir);   // or write the location on your local drive //instead. 
// Define a transaction called trans
trans.Start();
Createexternalsharedparameterfile(spfile);
DefinitionFile myfile = openspf(commandData.Application.Application, spfile);
//Create parameters and bindings
trans.Commit();


//the methods used above is here below
private void Createexternalsharedparameterfile(string sharedpfile)
{
  System.IO.FileStream fs = System.IO.File.Create(sharedpfile);
  fs.Close();
}
private DefinitionFile openspf(Autodesk.Revit.ApplicationServices.Application app, string filedir)
{
app.SharedParametersFilename = filedir;
return app.OpenSharedParameterFile();
} 

Thanks, Ibrahim Naeem 

0 Likes