I know the unit is feet. (1 = 609.600 mm)
This is my macro code, but is only works when I put the Radius to 1, 2, 3 etc.
/*
* Created by SharpDevelop.
* User: ricau
* Date: 13/03/2019
* Time: 11:14
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;
using System.Linq;
namespace ChangeSize
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.DB.Macros.AddInId("1B7B8078-5C56-4D16-A6C4-D0C7370EAFA9")]
public partial class ThisApplication
{
public void SelectConduitSize(){
Document doc = ActiveUIDocument.Document;
Selection sec = ActiveUIDocument.Selection;
ICollection<ElementId> selectedIds = sec.GetElementIds();
List<Element> list = new List<Element>();
if (selectedIds.Count == 0){
Reference obj = sec.PickObject(ObjectType.Element);
if (obj != null) {
Element e = doc.GetElement(obj.ElementId);
list.Add(e);
}
}
else
{
foreach (ElementId id in selectedIds)
{
Element e = doc.GetElement(id);
list.Add(e);
}
}
if (list.Count > 0){
Transaction trans = new Transaction(doc);
trans.Start("SelectConduitSize");
foreach (Element e in list) {
ConnectorSet conns = GetConnectors(e);
if (conns != null)
{
foreach (Connector conn in conns)
{
if (conn.Shape == ConnectorProfileType.Round)
{
conn.Radius = 0.1;
}
}
}
}
trans.Commit();
}
}
private static ConnectorSet GetConnectors(Element element)
{
if (element == null) return null;
try {
FamilyInstance fi = element as FamilyInstance;
if (fi != null && fi.MEPModel != null)
{
return fi.MEPModel.ConnectorManager.Connectors;
}
MEPSystem system = element as MEPSystem;
if (system != null)
{
return system.ConnectorManager.Connectors;
}
MEPCurve duct = element as MEPCurve;
if (duct != null)
{
return duct.ConnectorManager.Connectors;
}
}
catch (Exception)
{
}
return null;
}
private void Module_Startup(object sender, EventArgs e)
{
}
private void Module_Shutdown(object sender, EventArgs e)
{
}
#region Revit Macros generated code
private void InternalStartup()
{
this.Startup += new System.EventHandler(Module_Startup);
this.Shutdown += new System.EventHandler(Module_Shutdown);
}
#endregion
}
}