Idea Station and TextNote Bounding Box

Thank you for your questions during the Autodesk answer day.

I am still busy supporting the Barcelona Forge Accelerator participants in the Autodesk office.

Wednesday night, we took time off for a two-hour sailboat cruise:

Forge Accelerator Ahoy//embedr.flickr.com/assets/client-code.js

I am also working on a very exciting new project connecting BIM and the cloud using a direct socket.io connection
to communicate changes back to the desktop, instead of the inefficient polling mechanism I implemented in previous projects such
as RoomEditorApp
and FireRatingCloud.

Once again, it consists of two parts:

  • roomedit3d, the node.js web server and View and Data API handler.
  • Roomedit3dApp, the C# .NET Revit API add-in client.

You can check out the GitHub projects in their current state as work in progress.

I’ll talk more about them as soon as I have a moment’s time.

First, however, let me mention a couple of other issues:

Revit Idea Station

Have you ever wanted to submit new or review existing feature requests for Revit?

If so, you will be glad to hear
the IdeaStation for Revit has
finally been launched.

If. like me, you are interested specifically in Revit API wishes, you can select the category Revit and the tag API.

That takes you to Revit Ideas > Tag: “API” in “Revit Ideas”.

Note that there is not yet any automatic process in place to automate the connection from the idea station into the development team system.

If something is imperative, you can still file a wish list item for it using the standard existing ADN
and Revit API discussion forum pathways.

Idea station will help support these wish list items with votes and priorities.

TextNote Bounding Box Requires Regen

Question: We found that in Revit 2017, the TextNote bounding box is null in a drafting view.

The following code returns a valid bounding box in previous versions:


BoundingBoxXYZ box = element.get_BoundingBox( view );

If the element is a TextNote and the view is a ViewDrafting, the result is always null in Revit 2017.

I use this code to position text in my electrical schematic add-in.

It worked fine in the earlier versions of Revit.

Is there any other method I can use to obtain the bounding box of a TextNote using the Revit 2017 API?

Answer: Matt Taylor provided a solution in
his comment
on What’s New in the Revit 2017 API:

When using myTextNote.BoundingBox(view) straight after TextNote.Create, it should be preceded with doc.Regenerate:


dim myTextNote as TextNote = TextNote,Create(doc, ....
doc.Regenerate '<--This is now required. Otherwise, the bounding box is null.
dim bbox a s BoundingBox = myTextNote.BoundingBox(view)

This is new behaviour in Revit 2017.

The Revit Platform API Changes and Additions.docx document should probably contain things like this.

Just sayin!

Regeneration Performance Benchmark

Later, Matt added another note on regen performance:

That was the first solution I tried, so I was pretty lucky.

I benchmarked the regeneration also, in case anyone is interested?

Approximately 1-2/1000ths of a second.

I used to be scared of using doc.regenerate (because of the performance hit) – not any more.

Many thanks to Matt for pointing this out!


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading