> ADN: DEVR3894> ADN service level: Professional> product: Revit MEP 2012> Version: 2012> language: Chinese> Operating System: window7 64bit> Tel: 137xxxx1960> question title: question about modifying element parameters?> Question: The last question is about traversing the link document to create a space. The final solution is: the reason why "origin to origin" fails to be selected when the document is linked is that the coordinate system is not correct. The problem is as follows: I want to set the preferred Elbow Type before connecting the air duct to the elbow. 1. If the element parameter is int or double, it can be directly modified. For how ElementId knows where to get these Id2. edit the duct type.
How to change the value of T-shaped tee, connector, and such parameters. Reference code: [Transaction (TransactionMode. Manual)]
[Regeneration (RegenerationOption. Manual)]
Cmd: IExternalCommand
{
Result Execute (ExternalCommandData upload data, msg, ElementSet elements)
{
UIDocument uiDoc = upload data. Application. ActiveUIDocument;
UIApplication uiApp = response data. Application;
Document doc = uiDoc. Document;
Selection selection = uiDoc. Selection;
Transaction ts = Transaction (doc ,);
Ts. Start ();
FilteredElementCollector collector = FilteredElementCollector (doc );
Collector. OfClass (Duct). OfCategory (BuiltInCategory. OST_DuctCurves );
Duct duct =;
(Element el collector)
{
Duct = el Duct;
;
}
FilteredElementCollector collectorFitting = FilteredElementCollector (doc );
CollectorFitting. OfClass (FamilyInstance). OfCategory (BuiltInCategory. OST_DuctFitting );
FamilyInstance fitting =;
(Element el collectorFitting)
{
Fitting = el FamilyInstance;
;
}
(Parameter p duct. DuctType. Parameters)
{
(P. Definition. Name =)
{
P. Set ();}
(P. Definition. Name =)
{
P. Set (fitting. Category. Id );}
}
Ts. Commit ();
Result. Succeeded;
}
}