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: 

FamilyInstrance geometry of lighting fixture is not available in CustomExporter

14 REPLIES 14
Reply
Message 1 of 15
Act-3D
1057 Views, 14 Replies

FamilyInstrance geometry of lighting fixture is not available in CustomExporter

Hi All,

 

Problem of CustomExporter:

In default example scene rac_basic_sample_project.rvt in {3d} view:
When I modify FamilyInstrance of lighting fixture (for example moving a lamp in Living room).
FamilyInstrance geometry is not available for Custom Exporter.
OnInstanceBegin() and OnInstanceEnd() are called but no OnPolymesh().
 
When I call Export() in OnStartup() of my application then it works Ok.
But when I call Export() in OnDocumentChanged() after moving a lamp, then the lamp geometry is not exported.
 
I tried:
1. Document.Regenerate()
2. FamilySymbol.Activate()
 
No success.
 
Question:
How Can I make geometry of FamilyInstrance of lighting fixture available in {3d} view after change?
14 REPLIES 14
Message 2 of 15
mattmas
in reply to: Act-3D

That's weird - it does still sound like the geometry is not fully "ready".

 

You could try something like:

- In the DocumentChanged event, setup an ExternalEvent or IdleEvent callback.

- Do the Export() inside of those callbacks, which can happen a little later when Revit is "done"?

 

 

Message 3 of 15
Act-3D
in reply to: mattmas

Thank mattmass for the tip!

 

I moved Export() to OnIdling() and I got the same result. No OnPolymesh() is called.

 

What I found during investigation:

- OnMaterial() is called like allways

- famlilySymbol.get_Geometry(geometryOptions); works as expected.

- The problem occurs when I export {3d} view. In "Living room" view - exporter works correctly when moving a lamp.

 

Any advice why FamilyInctance geometry could be inaccessible in CustomExporter?

Message 4 of 15
mattmas
in reply to: Act-3D

No idea - I've never seen that happen (or noticed it happen, I suppose).

Message 5 of 15
jeremytammik
in reply to: Act-3D

Dear Artur,

Thank you for your query.

I'm checking with the development team for you.

Cheers,

Jeremy



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

Message 6 of 15
Act-3D
in reply to: jeremytammik

Thank you Jeremy!

 

What I found today is that if Family Instance of lamp is selected then geometry in {3d} view is no available for CustomExporter.

The workaround is unselect family instance, export and select again. But maybe there is more elegant solution.

 

 

Message 7 of 15
Act-3D
in reply to: Act-3D

Hi Jeremy,

 

Do you have any news from the development team?

My workaround doesn't work for all FamilyInstances.

Sometimes geometry is unavailable even if instance is not selected.

 

/Artur

Message 8 of 15
jeremytammik
in reply to: Act-3D

Dear Artur,

 

Thank you for your prompt.

 

Yes, the development team replied:

 

I think you should submit an issue to the development database since you tried the basic things (regenerate).

  

I assume there's an end of transaction call as well?

 

DocumentChanged should be called after transaction is committed.  

 

But it’s possible that “graphics” are not yet up to date.  If you run the export from another command just after the move, does it work?

 

I think it would be good to test the below as unselecting accomplishes the same. It’s a good guess that OnDocumentChanged() is too early to call custom export as it depends on the graphics layer, not DB.

 

I tried it without the callback – exporting a view with a light, then selecting the light and running the command again, both with and without moving it manually.  I see the same output for all of these including the Polymeshes.

 

So, I definitely think it’s traceable to the use of the callbacks after modification.  When you move a single element in Revit there is only a localized redraw of the view in the locations where the modification took place – it’s possible that the fact that the object is also selected means this doesn’t run in the same way.  Unselecting the element prior to export could be reasonable in this case. 

 

Can you please submit a complete minimal reproducible case?

 

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

 

Thank you!

 

Cheers,

 

Jeremy



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

Message 9 of 15

I have exactly the same problem. If no light is selected in the viewport, I get hundreds of calls to OnPolymesh when I do an export and everything is fine. If a light is currently selected in the viewport and I do an export -- not a single call to OnPolymesh is called. 

 

And I am not starting the export from a document changed handler. In fact nothing is changed in the document. The only difference is whether the lamp is selected or not. If it is selected, no OnPolymesh is called. If is not selected everything is fine.

 

There is definitely something wrong.

Message 10 of 15

Dear Artur, Dear Rossen, @rossen.hristov@Act-3D,

 

Please note my answer above:

 

The development team replied:

 

I think we should submit an issue to the development database for this since you tried the basic things (regenerate).

 

Can you please submit a complete minimal reproducible case?

 

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

 

Thank you!

 

Cheers,

 

Jeremy

 



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

Message 11 of 15

Here is a very simple project that reproduces the issue.

1. Open Revit 2019 and open iesfile.rvt

2. Add-Ins -> External Tools -> External Command: OnPolymesh is called 171 times.

3. Select the lighting fixture on the ceiling of the room in the middle. It is called "M_Downlight - Spot 90 Degree Tilt - 277V"

4. Add-Ins -> External Tools -> External Command: OnPolymesh is called 0 times.

5. If you de-select the lamp and run the export OnPolymesh will be called 171 times again.

 

So basically, when the user has selected a lamp, we can't export any geometry from Revit because it stops calling OnPolymesh. Currently we have hacked this and we programmatically de-select all lamps from the selection.

 

Here is a screencast: https://www.screencast.com/t/KatZK5TGUMnw

 

Message 12 of 15

Dear Rossen,

 

Thank you very much for the very clear reproducible case.

 

I am very glad to hear that you have a workaround in place that you can live with for the time being.

  

I logged the issue REVIT-133039 [custom exporter OnPolymesh not called when lighting fixture selected -- 12799336] 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 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.

 

Cheers,

 

Jeremy

 



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

Message 13 of 15

Hello, Jeremy,

 

Here is the info:

  • Impact on your application and/or your development: Very Low
  • The number of users affected: We don't know
  • The potential revenue impact to you: We don't know, but not very high for sure
  • The potential revenue impact to Autodesk: We can't know this
  • Realistic timescale over which a fix would help you: 3-6 months.
  • 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 should be a simple bug fix

As I said, there is an easy workaround. I expect that someone will notice that I am de-selecting his/her lamps before export, but we will explain this on our forum.

Message 14 of 15

Hello,

 

Are there any plans to include a fix for REVIT-133039 for an upcoming Revit update?

Message 15 of 15

Yes, absolutely.

 

The ticket number has been changed now that the issue has been promoted to a code fix and is now REVIT-134687 [custom exporter OnPolymesh not called when lighting fixture selected -- 12799336].

 

The latest update I see says:

 

Release Note: Fixed an issue where CustomExporter would skip export of faces based on their size

 

So, you can expect a fix in an upcoming major release of Revit. Unfortunately, it is not scheduled for the once we imminently expect, but the one after that... I asked whether it might also make it into an update release, so we don't have to wait an entire year longer...

 

 

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open

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