drafting view

drafting view

alain.bolduc
Contributor Contributor
3,013 Views
9 Replies
Message 1 of 10

drafting view

alain.bolduc
Contributor
Contributor

 

Hi everyone,

 

I create a drafting view in Revit using the following code (from here)

 

ViewFamilyType vd = new FilteredElementCollector(doc)
.OfClass(typeof(ViewFamilyType))
.Cast<ViewFamilyType>()
.FirstOrDefault(q => q.ViewFamily == ViewFamily.Drafting);
ViewDrafting draftView = ViewDrafting.Create(doc, vd.Id);

which is working fine, UNLESS I am working with the defaultFRAFRA.rte  project template. In that case, vd is null and I obviously get a  NullReferenceExcception when Calling ViewDrafting.Create.

 

A quick debug session shows me that when I use FR-FR templates, the filtered element collector does not return any Drafting view family types.v (see http://screencast.com/t/TG9J48Wp6Wq )

 

Did anyone already have this problem? if so, do you have any work around to suggest?

 

Thanks!

 

 

0 Likes
Accepted solutions (1)
3,014 Views
9 Replies
Replies (9)
Message 2 of 10

jeremytammik
Autodesk
Autodesk

Dear Alain,

 

Thank you for your query.

 

That sounds distinctly weird.

 

Can you please provide a reproducible case for me to pass on to the development team to analyse?

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

In this case, maybe the following would be best:

 

  • The original unmodified French template file delivered with your Revit installation
  • Your version of the template file including a macro to reproduce the access violation
  • Your version of a non-French template file including the identical macro successfully retrieving the desired drafting view

 

That should provide a fool-proof reproducible case that nobody can avoid understanding 🙂

 

Thank you!

 

I hope this helps.

 

Best regards,

 

Jeremy



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

0 Likes
Message 3 of 10

alain.bolduc
Contributor
Contributor

Hi Jeremy,

 

Thank you for your reply.

 

In the attached file, I have put, as requested, 2 revit files;

 

one created using US Imperial Construction template

one created using France Default FRA FRA template.

 

both files have a CreateDraftingView macro that demonstrates the problem.

 

 

In order to make it super-foolproof, I have recorded a screencast where I demonstrate the problem (using an addin instead of the macro, but the behavior is the same) and a quick debugging session. Please note that at some point in my recording, I say that the problem is seen only in 2017 using defaultFRAFRA template. What I should have said is that this behavior is seen only using the defaultFRAFRA template, regardless of the revit version.

 

 

Steps to reproduce (if the provided addin is not installed):

 

- Open the project file created with the french emplate

- Try to create a drafting view using the code stated in the original post.

 

=> Problem: ViewFamily.Drafting is not found in the Filtered element collector and so a drafting view cannot be created.

 

 

Please tell me if there is anything else I can do to help you diagnose the problem.

 

Thank you very much

 

Alain

 

0 Likes
Message 4 of 10

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Alain,

 

Thank you for your fool-proof reproducible case and recording.

 

The development team will love it 🙂

 

I logged the issue REVIT-90965 [drafting view missing in French template file?] with them 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.

 

I hope this helps.

 

Best regards,

 

Jeremy



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

Message 5 of 10

alain.bolduc
Contributor
Contributor

Hi Jeremy,

 

The reason why I was creating a drafting view is because I was experiencing a weird behavior while exporting a view image (using Document.ExportImage). The only way I had found to overcome my problem was to activate another view, and then reactivate the view I wanted to be exported. Since our customers may be working with very large models, I wanted an empty view that was fast to create...

 

I wish I could find back what the exact problem is, but I did not comment my code enough to leave future-me precise indication of what was exactly not working... not so proud of this.. 🙂

 

(something related to this, maybe: http://thebuildingcoder.typepad.com/blog/2011/07/refresh-element-graphics-display.html )

 

Anyway, I was creating a drafting view because it was pretty fast to create and did not cause other side effects (or so I thought!)

 

Bottom line, the impact is quite low on my side. I will investigate more to find back what my original problem is, but I will probably be able to overcome this bug either by correctly fixing the problem (if I can find it) or by creating another type of view when drafting view does not work...

 

Thanks

 

0 Likes
Message 6 of 10

jeremytammik
Autodesk
Autodesk

Dear Alain,

 

Thank you for your update, further background info and patience.

 

The development team responded to the issue REVIT-90965 [drafting view missing in French template file?] that I raised with them for this on your behalf:

 

First off, thank you for the very detailed and very precise description, video and files.

 

Your report was excellent!

 

It does indeed appear that the FRA template is missing its DBViewType for drafting views.

 

As a workaround, you can copy/paste a detail view from a different document into the FRA document, select the view in the project browser, then in the type selector click on the Detail View type as if you were reassigning this detail type to the detail view. The copy/pasting of the detail view will have brought in the Detail View Type from the good document. Using the type selector to re-select the view type will add the Detail View Type ID to our internal table of recently used view types.

 

We will confirm with the content team whether the FRA template provided by Autodesk needs updating and also whether a code fix is required to patch existing documents missing this Detail View Template.

 

Please let us know whether the workaround described solves the issue for you and, if you like, how you end up implementing it.

 

Thank you!

 

Best regards,

 

Jeremy



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

Message 7 of 10

jeremytammik
Autodesk
Autodesk

Dear Alain,

 

Would you like to take a look at the new attached template file candidate DefaultFRAFRA_2016.rte that the development team created in response to the issue REVIT-90965 [drafting view missing in French template file?] for you?

 

Does it solve the problem for you?

 

Thank you!

 

Best regards,

 

Jeremy



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

Message 8 of 10

jeremytammik
Autodesk
Autodesk

Just for future reference, or in case anyone else runs into this as well:

 

The problematic French templates discussed here were fixed by the development team in response to the issue REVIT-91915 [drafting view missing in French template file -- 11758752] that we raised here.

 

Now a similar issue seems to have been discovered in some Canadian template files.

 

In this new case, the customer found a way to fix it:

 

  • Open a new project from scratch without any templates.
  • Everything is working right so far. I can create a drafting view and it automatically goes in the « ??? » categories in the project browser.
  • In the project browser, right click and copy to the clipboard.
  • Switch to your project that doesn’t work and paste the drafting view that you just copied.
  • A notification appears, asking if you want to overwrite some « generic information » related to the view sub-project. That’s the key. Click Replace and you’re done with this issue.
  • The drafting views now appear in the "???" categories in your project that wasn’t working.

 

We performed the same process in our custom templates.

 

I hope this helps.

 

Cheers,

 

Jeremy



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

Message 9 of 10

Anonymous
Not applicable

i  know about the drafting view missing some consult point you can send some view of darting detail

0 Likes
Message 10 of 10

jeremytammik
Autodesk
Autodesk



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

0 Likes