RevitCity.com Logo

Home  |  Forums  |  Downloads  |  Gallery  |  News & Articles  |  Resources  |  Jobs  |  FAQ  |  SearchSearch  |  Join  |  LoginLogin

Welcome !

231 Users Online (95 Members): Show Users Online - Most ever was 626 - Mon, Jan 12, 2015 at 2:00:17 PM

 

Forums

Forums >> Workflow & Implementation >> API & Third Party Apps >> ISelectionFilter for CADLinkTypes

Search this ThreadSearch this Thread | Page 1 of 1 |

Sat, Jul 20, 2013 at 5:03:48 PM | ISelectionFilter for CADLinkTypes

#1

stealthnyc


active

Joined: Fri, Sep 14, 2007
63 Posts
5 Stars: 1 Votes


Hopefully I'm going about this the right way but with no sucess, I'm trying to make an ISelectionFilter to only allow picking of CAD files in a project.  I've also tried using the CADLinkType class.  My code so far is:

 

public class CADPickFilter : ISelectionFilter         {             public bool AllowElement (Element e)             { if (e.Name.EndsWith(".dwg"))                  {                     return true;                 }                 return false;             }             public bool AllowReference (Reference r, XYZ p)             {                 return false;             }         }

 

Thanks for any help.


This user is offline

 

Sat, Jul 20, 2013 at 5:06:54 PM | ISelectionFilter for CADLinkTypes

#2

stealthnyc


active

Joined: Fri, Sep 14, 2007
63 Posts
5 Stars: 1 Votes


I'll try again to make it more readable:

public bool AllowElement (Element e)

{

     if (e.Name.EndsWith(".dwg"))

    {

       return true;

    }

    return false;

}

public bool AllowReference (Reference r, XYZ p)

   {

     return false;

    }

}


This user is offline

 

Tue, Jul 23, 2013 at 2:43:35 PM | ISelectionFilter for CADLinkTypes

#3

cshha


active

Joined: Tue, Mar 5, 2013
1 Posts
5 Stars: 1 Votes


Try using RevitLookup to determine what properties you can use to filter the object.

It's part of the SDK and allows you to inspect elements that are currently selected.  You'll be able to determine a class, category, or some other property that you'll be able to use for filtering.


This user is offline

 

Tue, Jul 23, 2013 at 10:09:58 PM | ISelectionFilter for CADLinkTypes

#4

stealthnyc


active

Joined: Fri, Sep 14, 2007
63 Posts
5 Stars: 1 Votes


Thanks so much!  Should have thought of that before.  I changed it to:

if (e.Category.Name.EndsWith(".dwg"))

and now it works as I wanted it to.


This user is offline

 

Search this ThreadSearch this Thread | Page 1 of 1 |

Site Stats

Members:

1651485

Objects:

22099

Forum Posts:

151693

Job Listings:

3

Sponsored Ads

Home | Forums | Downloads | Gallery | News & Articles | Resources | Jobs | Search | Advertise | About RevitCity.com | Link To Us | Site Map | Member List | Firm List | Contact Us

Copyright 2003-2010 Pierced Media LC, a design company. All Rights Reserved.

Page generation time: 0.0089

Login

User Name:

Password:

Remember Me  

Forgot Password?

Search Forums

Advanced Search

Search Forums

Advanced Search


Clear Highlights


Clear Highlights