Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Visibility settings

12 REPLIES 12
Reply
Message 1 of 13
R.van.den.Bor
2239 Views, 12 Replies

Visibility settings

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,

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
12 REPLIES 12
Message 2 of 13
Revitalizer
in reply to: R.van.den.Bor

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 3 of 13
R.van.den.Bor
in reply to: 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, 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 4 of 13
Revitalizer
in reply to: R.van.den.Bor

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 5 of 13
R.van.den.Bor
in reply to: 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 🙂

 

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 6 of 13
Revitalizer
in reply to: R.van.den.Bor

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,...

 

Visi1.png

 

Visi2.png

 

...the parameter value changes:

 

Visi3.png

 

Visi4.png

 

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 7 of 13
R.van.den.Bor
in reply to: 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 🙂

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 8 of 13
Revitalizer
in reply to: R.van.den.Bor

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 9 of 13
R.van.den.Bor
in reply to: 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)

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 10 of 13

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



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 11 of 13

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...

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 12 of 13

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



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 13 of 13

And thank you Jeremy for blogging it 🙂
Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community