Originally Posted by
damon.sidel
Thank you boostyourbim!
I'll give this a try and see how it goes. I just started (for the third time) with Autodesk's "My First Plug-In" series and I'm very slowly working my way through it. I'll also look into your blog and class. Thank you.
If you don't mind, I do have three questions:
1. I am using the Curtain Panel category instead of Generic Model. Looking in the Revit API at the BuiltInCategory Enumeration, I find "OST_CurtainWallPanels". Is that how I should reference Curtain Panels?
2. To change the family I want to look at, do I change "Diagnostic Tripod-3 point" to "Panel 3pt AC" or whatever else I've named it?
3. I've tried creating and running this macro and two things happened. First, I get two Warnings as soon as SharpDevelop opens: "There was a mismatch between the processor architecture of the project building built "MSIL..." Second, when I run it, it does nothing. Here is everything from the SharpDevelop window (I had to add the "using..." :
using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;
using System.Linq;
namespace RenumberPanelIDs
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.UI.Macros.AddInId("DD536125-D810-4EF2-B9AF-DC21C01369BC")]
public partial class ThisApplication
{
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
public void StripParamFirstDigit()
{
Document doc = this.ActiveUIDocument.Document;
using (Transaction t = new Transaction(doc,"Set Parameter Value"))
{
t.Start();
foreach (FamilyInstance fi in new FilteredElementCollector(doc)
.OfClass(typeof(FamilyInstance))
.OfCategory(BuiltInCategory.OST_CurtainWallPanels)
.Cast<FamilyInstance>()
.Where(q => q.Name == "Panel 3pt AC"))
{
Parameter p = fi.get_Parameter("Panel ID");
int curVal = p.AsInteger();
int newVal = Convert.ToInt32(curVal.ToString().Substring(1));
p.Set(newVal);
}
t.Commit();
}
TaskDialog.Show("Panel ID", "Your Panel IDs have been truncated");
}
}
}