Question about modifying element parameters through Revit API?

Source: Internet
Author: User

> 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;
}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.