Hello Reviteers,
Does anybody know how to get to the visibility settings in the family editor with the API. Manually you just select the element, click Visibility settings and change it's appeareance. Plan/RCP , Front/Back, Left/Right, Coarse, Medium or Fine.
It tried snooping, but I can't find the parameter that is changing when I alter these settings...
Help greatly appreciated,
Hi Remy,
FamilyElementVisibility visibility = new FamilyElementVisibility(FamilyElementVisibilityType.Model);
visibility.IsShownInCoarse = true;
visibility.IsShownInFine = true;
visibility.IsShownInMedium = true;
visibility.IsShownInFrontBack = true;
visibility.IsShownInLeftRight = true;
visibility.IsShownInPlanRCPCut = false;
yourElement.SetVisibility(visibility);
Best regards,
Revitalizer
Hi, thank you very much, this is what I needed 🙂
Only one question remains, you say "yourElement.SetVisibility(visibility);", but I can't get it to work.
I tried
FamilyInstance.Setvisibility
Element.Setvisibility
Both tell me they don't have a Setvisibility.
The only thing I can find is the doc.ActiveView.SetVisibility but it doesn't have a constructor for an element, only a whole category 😞
So my next question is, how to use the SetVisibility for a familyInstance (within the family editor)?
Kind regards,
Hi Remy,
oh, I see.
I used it for SymbolicCurve elements.
In the Family context, you can use it also with ModelCurves.
Also, each element whose class is derived from GenericForm will provide this method, meaning Extrusions, Sweeps and so on.
Best regards,
Revitalizer
Okay, I see. When I create a extrusion and snoop it, I see the method you mention.
But the situation I have, is I made a sweep and loaded this sweep into another family, so it's a nested family.
Snooping this family, revit sees it as FamilyInstance, which doesn't have the FamilyElementVisibility method.
And you can't simply cast the FamilyInstance to a sweep 🙂
Hi Remy,
there seems to exist another method to access the visibility.
FamilyInstances which reside in a Family document provide a parameter named GEOM_VISIBILITY_PARAM.
This is an integer typed parameter which can be set.
The only thing you have to do is to find out the relation between the integer value and the menue entries.
In the following dialog, the parameter is named "Überschreibungen Sichtbarkeit/Grafiken".
Depending on settings,...
...the parameter value changes:
So what you could do is to test different configurations and write down their according integer representations.
These values can be used for setting the visibility even with nested families.
So I hope 😉
Best regards,
Revitalizer
Super, That's it. Normally I don't like the "magic numbers" approach, but this time I'll make an exception. SO, to summerize.
The "FamilyElementVisibility" method can be used when creating solids in a family (sweeps, extrusions ect).
The "magic numbers" method can be used when using families as nested families.
To name a few :
All checked = 57406
Plan/RCP (Grundriss/Deckenplan) unchecked = 57398
Left/Right (Links/rechts) unchecked = 57374
Thanx again 🙂
Hi Remy,
this approach may be picked up by Jeremy, I hope.
It's a typical workarounding in the Revit API environment, as often.
It would be great not only to know the magic numbers but also the algorithm they are calculated by.
Also, are the values stable even between different Family documents ?
Best regards,
Revitalizer
Yes, I agree 100%. As far as I can tell these numbers are stable for 3D elements. In a detail component family there is only the coarse/medium/fine setting and the visibility/graphics overrides parameter has value 0 (no magic numbers here).
So, it would be a nice topic for Jeremy indeed 🙂 (hint)
Hi guys,
Yes, I fully agree, this looks interesting.
Two additional observations:
1. Those magic number ore probably much less magic when you look at them in binary or hexadecimal representation.
2. I would not be at all surprised if there is a enumeration value defined somewhere in the revit api, and boolean or combinations of the enumeration values provide these 'magic' or not-so-magic values.
What do you think?
Have you seen any likely candidates?
Thank you!
Cheers
Jeremy
I am sure there must be some enumeration behind it, only not available for us plebs 🙂 So for now, the numbers appear magical to me, but Joe ye already made a change request for it, so how knows...
Dear Remy and Revitalizer,
Thank you very much for the interesting discussion and all your contributions.
I discussed this with the development team and published a summary of the discussion and the resulting solution on The Building Coder blog:
http://thebuildingcoder.typepad.com/blog/2014/01/the-geom_visibility_param-visibility-settings.html
I hope that helps.
Please let us know if you see anything to fix or improve.
Thank you!
Best regards,
Jeremy