Selection for RebarPresentationMode

Selection for RebarPresentationMode

Anonymous
Not applicable
730 Views
2 Replies
Message 1 of 3

Selection for RebarPresentationMode

Anonymous
Not applicable

Hi Everybody,

 

I'm actually building a macro (C#) to change the RebarPresentation of existing Rebar in my project.

I'm using the method SetPresentationMode and for the PresentationMode Middle and First/Last it works great.

My problem for the PresentationMode Select (following code).

In this case, I'm not able to set a selection of the Element from the Rebar Set (For example Index 2).

 

The following code selects all elements from Rebar Set.

 

 

 

            foreach (ElementId Id in selectedIds)
            {
                Rebar Rebar = doc.GetElement(Id) as Rebar;                 
                using (Transaction t = new Transaction(doc, "Change Presentation"))
                {
                    t.Start();
                    int test = Rebar.NumberOfBarPositions;
                    Rebar.SetPresentationMode(ActiveView, RebarPresentationMode.Select);
                    t.Commit();
                }
            }

 

Does somebody have an idea?

 

Thanks,

 

0 Likes
731 Views
2 Replies
Replies (2)
Message 2 of 3

igmuz
Contributor
Contributor

Hi,

 

Try this code to hide second bar in the set.

 

           foreach (ElementId Id in selectedIds)
            {
                Rebar Rebar = doc.GetElement(Id) as Rebar;                 
                using (Transaction t = new Transaction(doc, "Change Presentation"))
                {
                    t.Start();
                    int test = Rebar.NumberOfBarPositions;
                    Rebar.SetPresentationMode(ActiveView, RebarPresentationMode.Select);
Rebar.SetBarHiddenStatus(view,2,true); t.Commit(); } }

 

Message 3 of 3

matyas.csanady3GW48
Explorer
Explorer

Still no update on this?

I get that rebar.SetBarHiddenStatus() is a workaround for this, but then why would this enum be exposed in the API if it's good for nothing? As far as I'm aware this isssue still exits in the 24 API

0 Likes