Isolate elements on a newly created view

Isolate elements on a newly created view

tuuletin
Collaborator Collaborator
1,926 Views
14 Replies
Message 1 of 15

Isolate elements on a newly created view

tuuletin
Collaborator
Collaborator

Hello, friends, why my isolation in the newly created view doesn't work?

 

So, I do the following:

1. I have a set of elements to isolate (els = System.Collections.Generic.List'1[Autodesk.Revit.DB.ElementId]).

2. Then a view is created:

view = ViewSection.CreateSection(doc, viewFamilyTypeId, BoundingBox)

3. After that i'm trying to isolate els:

view.IsolateElementsTemporary(els)

If I open this view, the isolation mode is on (light blue frame is on), but nothing from els is isolated. The other view parameters (via get_Parameter) are accessible and writeable.

Any suggestions, please? Cat Tongue

0 Likes
1,927 Views
14 Replies
Replies (14)
Message 2 of 15

tuuletin
Collaborator
Collaborator

Hello again,

but 

view.IsolateCategoriesTemporary()

works fine!

What's the problem? Cat Mad Cat Mad Cat Mad Cat Mad Cat Mad Cat Mad Cat Mad Cat Mad Cat Mad Cat Mad Cat Mad 

0 Likes
Message 3 of 15

Revitalizer
Advisor
Advisor

Hi,

 

perhaps you need a document.Regenerate() or uiDocument.RefreshActiveView() ?

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 4 of 15

tuuletin
Collaborator
Collaborator

No, this doesn't help :c

More peculiarity: "reverse" method

View.HideElements()

works perfectly!

 

Now, I see no other way to solve my task.

The first collector will include any element in model (including links).

The second collector will include elements to be isolated.

The third collector consists of the first collector with the excluded second collector.

Then, I just hide any element I don't want to be isolated by means of the third collector.

 

Seems, very bad way to evade this bug...

0 Likes
Message 5 of 15

Anonymous
Not applicable
Are the elements actually visible in the view if you don't enable the isolate?
0 Likes
Message 6 of 15

tuuletin
Collaborator
Collaborator

Yes, they are visible.

I create a new view (so, any graphic settings are set to default — all elements are visible), then I want to isolate some elements in this created view...

0 Likes
Message 7 of 15

ChristopherSchwalbe
Explorer
Explorer

I have encountered the same problem, could you please let me know if you find a solution. I will respond in this forum if I find the solution. - cheers

0 Likes
Message 8 of 15

tuuletin
Collaborator
Collaborator

Hello,

I have stopped seeking the solution. Maybe it is just a lack of revit 2015 api. Hope, this will be fixed in revit 2016/2017/2018/.../2032 api (don't have revit 2016-2017 right now, so, I can't check this).

By the way, what version of revit do you use?

0 Likes
Message 9 of 15

Anonymous
Not applicable

I would like to re-open this issue. It is still happening in Revit 2017. I have created a simple test case with macros embedded to show it.

 

testOne macro:

Shows that we can isolate a element in the view.

 

testTwo macro:

duplicates the Level 1 floorplan view and tries to isolate a Element. But the element is not isolated, unexpected behavior.

0 Likes
Message 10 of 15

tuuletin
Collaborator
Collaborator

That's sad :c Maybe we should make an official bug report for autodesk and wait for the fix?..

I don't know, where we can report this bug.

0 Likes
Message 11 of 15

jeremytammik
Autodesk
Autodesk

Dear Tuuletin and Michal,

 

Thank you very much for your report and especially to Michal for the reproducible case.

 

I escalated this thread to an ADN case 12169975 [Isolate elements on a newly created view] and created an internal development issue REVIT-99069 [Isolate elements on a newly created view -- 12169975] for the development team to take a closer look.

 

The issue was logged with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team, and prioritised against all of the other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

Best regards,

 

Jeremy



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

0 Likes
Message 12 of 15

jeremytammik
Autodesk
Autodesk

Dear Tuuletin and Michal,

 

Thank you for your patience.

 

The development team responded to the issue REVIT-99069 [Isolate elements on a newly created view -- 12169975] and say:

 

I can reproduce this issue. When just 1 transaction is used to create the new view and also to isolate the element, then the isolate element fails. 

 

However, I can get the desired behaviour using two separate transactions as follows:

 

  • Use a transaction to create the new view. Close transaction.
  • Activate the new view. This is important; isolation fails if the view is not active.
  • Use 2nd transaction to isolate the wall. Close transaction.

 

Is this an acceptable workaround?

 

Note: I also tried the attached file and macros in our internal development release cannot reproduce the behaviour there.

 

I tested macro "test 2" which uses just 1 transaction to create the new view and isolate the wall, and when the screen updates the single wall is really and truly isolated in the new view.

 

So the workaround described above will not be needed forever.

 

I hope this helps.

 

Best regards,

 

Jeremy



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

0 Likes
Message 13 of 15

michaelmorris
Autodesk
Autodesk

Hi all,

 

Thanks Jeremy for posting my workaround about activating the view before doing IsolateElementTemporary.  In fact this appears to be needed for all uses of IsolateElementTemporary, regardless of if the view is newly created or not!

 

Also, I thought this behavior was fixed in our internal development release...but it is not.  Sorry for any false hope there.  We'll keep digging for the root cause.


Michael Morris
Software Engineer
0 Likes
Message 14 of 15

Anonymous
Not applicable

Ok, so the internal version of Revit still has this "issue", lets hope you guys can track it down.

 

Thanks for the work around, i tried two transactions as well before, but it didn't work. The trick is as you guys described to set the active view to the new created view.

 

Here is the snippet for those interested:

 

 

		public void testTwo()
		{
			View newView;
					
			using (Transaction t = new Transaction(this.Document))
			{
		       	        t.Start("Trans");
		       	
				// Get Floorplan for Level1 and copy its properties for ouw newly to create ViewPlan.
				View existingView = this.Document.GetElement(new ElementId(312)) as View;
				
				// Create new Floorplan.
				newView = this.Document.GetElement(existingView.Duplicate(ViewDuplicateOption.Duplicate)) as View;
			
				t.Commit();
// important to set new view as active view. this.ActiveView = newView; t.Start("Trans 2"); // Try to isolate a Wall. Fails. newView.IsolateElementTemporary(new ElementId(317443)); t.Commit(); } // Change the View to the new View. this.ActiveView = newView; }

 

It somewhat sucks having to commit twice and therefore having to regenerate twice. But the workaround is solid and does the job, thanks guys!

 

Message 15 of 15

jeremytammik
Autodesk
Autodesk

Dear Michal,

 

Thank you for your test, confirmation and sample code!

 

I summarised, cleaned up and published our conversation here of others to enjoy better still:

 

http://thebuildingcoder.typepad.com/blog/2016/10/need-to-commit-twice-roomedit3dv3-and-forge.html#2

 

Cheers,

 

Jeremy



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

0 Likes