Message 1 of 9
Framing section reorganization
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I am trying to create a code to recognize the structure framing section as the guideline from @Anonymous https://thebuildingcoder.typepad.com/blog/2013/12/security-framing-cross-section-analyser-and-rex.html
But when I run it, there was an error message as following:
And following is the code I am using:
public class MainCode : IExternalCommand
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class MainCode : IExternalCommand
{
void RexXsecAnalyis(
ExternalCommandData commandData,
Element e)
{
// Initialise converter
RVTFamilyConverter rvt = new RVTFamilyConverter(
commandData, true);
// Retrieve family type
REXFamilyType fam = rvt.GetFamily(e,
ECategoryType.SECTION_PARAM);
// Retrieve section data
REXFamilyType_ParamSection paramSection = fam
as REXFamilyType_ParamSection;
REXSectionParamDescription parameters
= paramSection.Parameters;
// Extract dimensions, section type, tapered
// predicate, etc.
// If different start and end sections are
// required, use DimensionsEnd as well.
REXSectionParamDimensions dimensions = parameters
.Dimensions;
ESectionType sectionType = parameters
.SectionType;
bool tapered = parameters.Tapered;
bool start = true;
Contour_Section contour = parameters.GetContour(
start);
List<ContourCont> shape = contour.Shape;
TaskDialog.Show("info", sectionType.ToString());
}
static System.Reflection.Assembly OnAssemblyResolve(
object sender,
ResolveEventArgs args)
{
Assembly a = Assembly.GetExecutingAssembly();
return Autodesk.REX.Framework.REXAssemblies
.Resolve(sender, args, "2018", a);
}
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
// Get control of the current document
UIDocument uIDocument = commandData.Application.ActiveUIDocument;
DocumentSet alldocuments = uIDocument.Document.Application.Documents;
// Get document control
Document document = uIDocument.Document;
// Get current active view
Autodesk.Revit.DB.View currentview = document.ActiveView;
Selection selection = uIDocument.Selection;
IList<Reference> SelectedElements = selection.PickObjects(ObjectType.Element);
foreach (Reference refe in SelectedElements)
{
Element selectedElement = document.GetElement(refe);
RexXsecAnalyis(commandData, selectedElement);
}
return Result.Succeeded;
}
}
So if you have experience about this, pleas help me to give a hint how was the problem and how to fix it.
Thank you and have a nice day.
Best Regards,
Sino