Iselection filter for massing

Iselection filter for massing

Anonymous
Not applicable
521 Views
1 Reply
Message 1 of 2

Iselection filter for massing

Anonymous
Not applicable
I want to write a Iselection filter to only have my UI select Mass in the revit document. I have done it for roof element, the code is as follow: public class MySelectionFilter : ISelectionFilter { public bool AllowElement(Element elem) { return elem is RoofBase; } public bool AllowReference(Reference reference, XYZ position) { return true; } } public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements) { try { while (true) { UIDocument doc = commandData.Application.ActiveUIDocument; //pick an object from the document that is of roof type Reference selRef = doc.Selection.PickObject(ObjectType.Element, new MySelectionFilter(), "select a roof"); //turn the selected object into a roof element RoofBase roof = (RoofBase)selRef.Element; so i tried to modify the script by wanting to change return elem is RoofBase to return elem is Mass, but I realise there is no massing class in Revit API? Or is there any other that I can limit my UI selection filter to only select the massing objects in my document ? Thanks
0 Likes
522 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

sorry din realise my post was in such a awful format I reposting it again I want to write a Iselection filter to only have my UI select Mass in the revit document. I have done it for roof element, the code is as follow:

 

public class MySelectionFilter : ISelectionFilter

{

   public bool AllowElement(Element elem)

  {

     return elem is RoofBase;

  }

   public bool AllowReference(Reference reference, XYZ position)

  {

     return true;

  }

 }

  public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements)

 { try

   { while (true)

    {

     //pick an object from the document that is of roof type    

     UIDocument doc = commandData.Application.ActiveUIDocument;

 

    Reference selRef = doc.Selection.PickObject(ObjectType.Element, new MySelectionFilter(), "select a roof");

 

    //turn the selected object into a roof element

    RoofBase roof = (RoofBase)selRef.Element;

 

so i tried to modify the script by wanting to change return elem is RoofBase to return elem is Mass, but I realise there is no massing class in Revit API? Or is there any other that I can limit my UI selection filter to only select the massing objects in my document ? Thanks ....

0 Likes