Check Visibility of a Family

Hello everyone, I’m trying to check if a family in the model has been ticked “Medium” or not but right now I don’t have any idea how to do that. Can you give me some advice? Thanks a lot.

1 Like

@Luffy11 ,

i did not realy find something, … you can try look up or dir() methode to find the Parameter

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#functions
def tolist(x):
    if hasattr(x,'__iter__'): return x
    else: return [x]

#collector
collector = FilteredElementCollector(doc,doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_GenericModel)
all_elements = tolist(collector.WhereElementIsNotElementType().ToElements())


snoop = [dir(i) for i in UnwrapElement(all_elements)]

viewspecific = snoop[0]

levelDetail = [i.ViewSpecific for i in UnwrapElement(all_elements)]
invisible = [i.Invisible for i in UnwrapElement(all_elements)]

OUT = levelDetail, invisible, viewspecific

KR

Andreas

Hi there,

A few questions:

  1. Is it one specific family you wish to check or a number?
  2. Are you looking to do this from the model or from the family document?
  3. What have you tried so far?
  4. What Revit version are you in?

hi @haganjake2 , Here are my answers to your questions

  1. I have to check multiple families
  2. I want to do this from the model environment
  3. Because I want to do it from the model environment (some kind of opening and editing family in the background maybe?), I don’t know where to start. That’s why I need some advice to do it.
  4. My Revit version is 2020.

Ok great,

Well with that in mind you probably want to have a good look at the Genius Loci package which has a number of nodes to help this process, including ‘Set FamilyElementVisibility’ (assuming they are within the package in the version you have access to in R20).

I’ve not run this script and don’t have time to help more but it could look something like this:

The thing you need to work out is which elements to collect to feed into the node, and probably list lacing to feed in multiple families. But test it with one first…

Hope that helps

hi @Draxl_Andreas. It’s not about visible or invisible. To reduce the size of the DWG file after printing it.
I have to print it in Medium, so everything in the view should be a line, curve, or something like that. But some families in the model have been ticked Medium, so the whole solids appear in the Medium view (for example the elbow in the screenshot below). That’s why I need to check and edit those families later.


1 Like

@Luffy11 ,

i fully understand, i was not able to find more regarding that… the other API stuff is releated to the view like

intresting is you can collect the elements with doc.ActiveView.Id even when it is not visible in “medium” but manuel you are not able to do it.

KR

Andreas

1 Like

If it’s a family object visibility setting it has nothing to do with the detail level of the view…

It is this method that is needed:

4 Likes

@haganjake2 As far as I understand, I have to get the elements in the family (text, line, solid…) first, then I can use this method. If it’s so, Can you give me a way to do that? This is what I got so far.

I gave more steps in my screenshot above, add those in and see how you go.

Why not change the detail level in the View / View Template to Coarse for Pipes / Pipe Fittings?

I understand that this may not solve your issue
If it is one family can you fix it manually and then it is done, rather than try to do it programmatically -or- is this a problem with multiple families in multiple projects?

I think the Genius Loci nodes work on a Family Document open in the application so may not work in this instance - Further you will need to filter which elements you want to be visible - Model Curves Yes? Extrusion, Sweep, Revolution, etc. no?

2 Likes

@haganjake2 I have tried your way but got stuck in this step.

hi @Mike.Buttery , Here are my answers to your question:

  1. I have to fix multiple families so I want to do it automatically and prepare if this problem occurs again in the future.
  2. Yes, you’re right. I have to filter which elements should be visible and right now I don’t know how to do that. I think if I can filter all the elements in the family, then I can use GetVisibility() method to check if it is visible in Medium or not.

It was my understanding that the Genuis Loci node ‘FamilyDocument Edit’ outputs a family document after background opening it, therefore should be possible via that route?

@Luffy11 you are trying to get element types of the family you are opening. What you need to do is open the family and then collect the elements once you have that family open in the background.

Try collecting the

1 Like

I checked the GitHub repository for Genius Loci, you are correct that it opens the Family Document for editing and I was incorrect assuming it has to be open in the application. I was confused by the DSType

1 Like

Try this to get the ElementType

Code

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
OUT = eval(IN[0])
1 Like

Ypu need to open families in background, collect geometry elements contained or nested families and look for the visibility override options with python code in Dynamo or with nodes if they exist. I will try to do it myself as i am interested. But for the time spent doing that i would say edit all revit family types of pipe fittings and pipe accessories categories to check and modify those properties if they are not doing what you want

1 Like

Currently, I’m busy with other tasks so maybe I will be back to this problem whenever I have free time. I’ll let you guys know the result if I have the solution. Once again, I really appreciate your help.

2 Likes