Performance difference between Model lines vs Detail lines through API

Performance difference between Model lines vs Detail lines through API

Anonymous
Not applicable
969 Views
8 Replies
Message 1 of 9

Performance difference between Model lines vs Detail lines through API

Anonymous
Not applicable

We have converted a raster image to DXF vector format and need to add the geometry represented in the raster to our revit document in the form of lines.  Unfortunately, the number of vectors that result from this process is very large and takes a long time (hours) to render in as model lines.   The thought is to use a detail line instead in the hope to cut down the time.   Does anyone have experience with this issue?  

 

We are looking for ways to filter unnecessary lines from the vector conversion that that is a challenge too.  

 

The original raster image was that of a CAD floor plan but we no longer have the original vector file.  Once the model lines are rendered the user traces walls, etc and eventually removes the model lines. 

 

How can we improve the rendering of lines for this purpose?

 

Thanks

0 Likes
Accepted solutions (2)
970 Views
8 Replies
Replies (8)
Message 2 of 9

jeremy_tammik
Alumni
Alumni

I would recommend running some kind of geometry recognition algorithm over the raster image before trying to import each individual pixel as a separate line. Read about vectorization, aka image tracing, before doing anything else,:

  

  

That said, a raster image definitely does not belong in model space, so I would prefer detail lines over model lines.

  

However, I would even more definitely not do anything at all with the pixels directly, but run a vectorisation algorithm over them first.

 

Search GitHub, for instance. Here is a 270-star vectorization approach using AI:

 

https://github.com/art-programmer/FloorplanTransformation

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 9

Anonymous
Not applicable
Accepted solution

Jeremy,

    We were/are not able to do any further preprocessing of extracted vectors so the solution had to be how we render  lines in the Revit document.  First we ran some test to compare overhead/speed to add 10K model and detail lines and found that it was comparable....Slow!!  Our situation from time to time requires 100K+ lines.  Yes, ridiculous but that's our situation.

   However, after further research we (one of my engineers) come up with the idea to create single a wire frame object (derived from Revit's Generic Shape Builder element) and cut down line generation from 4hrs (if it ever finished) to 17sec for a test case that was 1M lines (50K lines per wire frame object)!!

 

0 Likes
Message 4 of 9

jeremy_tammik
Alumni
Alumni
Accepted solution

Congratulations on the creative solution and glad to hear that it works for you.

 

What do the 100K+ lines look like?

 

I find it hard to imagine a situation in which such a thing can be of use and yet not allow for reduction and optimisation. 

 

Could you share a sample snapshot of what the end result might look like? Thank you!

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 5 of 9

Anonymous
Not applicable

Jeremy,

      The plugin we've developed, among other things, is given a DXF that was generated from a Potrace based process.  We proceed to filter lines (vectors) which yields reduction of lines by 40-50%.  But we cannot risk pursuing any more aggressive filtering for other reasons.  We have no control over source of original raster from which DXF was extracted.

 

Raster to vector conversion is inherently problematic because one has to make tradeoffs, as we have.  I cannot disclose any further details about the application or it's use because of client propriety.   Unfortunately, the images from from our client.

 

In any case, we are pleased that we found a way (credit to Revit API too) to improve performance in this situation, regardless how it came about.

 

Thanks for your support.

0 Likes
Message 6 of 9

jeremy_tammik
Alumni
Alumni

Here is a possibly more effective and definitely more experimental approach to raster vectorisation by creating line art:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 7 of 9

Anonymous
Not applicable



<meta http-equiv="content-type" content="text/html; charset=UTF-8" />


Jeremy,   This is very exciting work and update.  Thanks for posting
this.  We'll take a look.



Much Thanks.



0 Likes
Message 8 of 9

jeremy_tammik
Alumni
Alumni

Glad to hear you find it interesting.

  

I would love to hear whether and what you end up doing with it.

 

To my surprise, another way to speed things up might be to switch from C# to managed C++, cf. this benchmarking comparison:

 

https://forums.autodesk.com/t5/revit-api-forum/plugin-languages-comparison/td-p/10618816

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 9 of 9

jeremy_tammik
Alumni
Alumni

So, any progress to report with the 'exciting news'?

 

Or, performance improvements using managed C++?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes