jeremytammik / RevitLookup

Interactive Revit RFA and RVT project database exploration tool to view and navigate BIM element parameters, properties and relationships.
http://thebuildingcoder.typepad.com
MIT License
1.03k stars 294 forks source link

Visualization setting: Solid scale feature #251

Closed ricaun closed 2 weeks ago

ricaun commented 3 weeks ago

First really at all amazing implementation of the visualization. Great job @Nice3point, pretty interesting the way you scale the vertex in model. 👏

One thing I think is missing is a way to scale the Solid, only because you can scale Face, Mesh, Line... And is easier to visualize if you can scale in front of the original geometry.

image

Nice3point commented 3 weeks ago

Thank you) makes sense. I didn't want to delay the first release as scaling Solid would take longer, that's the only reason why I added Cage instead of scale. Wait for the future, I'll add it

Nice3point commented 3 weeks ago

TODO:

We need to split volumes for tesselation, instead of using original solid. Sometimes faces array is empty (curtain walls) изображение

ricaun commented 3 weeks ago

We need to split volumes for tesselation, instead of using original solid. Sometimes faces array is empty (curtain walls)

Interesting, I didn't know that.

This is the code for the Solid right?https://github.com/jeremytammik/RevitLookup/blob/dev/source/RevitLookup/Core/Visualization/SolidVisualizationServer.cs

Nice3point commented 3 weeks ago

This is the code for the Solid right?https://github.com/jeremytammik/RevitLookup/blob/dev/source/RevitLookup/Core/Visualization/SolidVisualizationServer.cs

yeah, right

Nice3point commented 2 weeks ago

@ricaun

I added a minimum Expansion so that the rendering does not overlap the current geometry изображение

I need your opinion, to make the scaling a percentage, or to a specific value like Faces? In favour of an inch value goes the scaling of too small details, which even at x2 is hard to see изображение

Scaling is performed from the Solid centroid

branch: https://github.com/jeremytammik/RevitLookup/tree/dev_solid-scaling

Nice3point commented 2 weeks ago

also solved the problem with rendering of super thin solids, for comparison how it is displayed using RevitAPI UiDocument.Selection.SetReferences and visualisation

SetReferences: изображение

Visualization: изображение

ricaun commented 2 weeks ago

Neat!

ComputeCentroid is the center of gravity in the solid, I use the Origin from the BoundingBox to get the middle of the solid to perforce a scale in the middle of the solid. Could use the Min/Max as well.

/// <summary>
/// GetOrigin using bounding box transform origin
/// </summary>
/// <param name="solid"></param>
/// <returns></returns>
public static XYZ GetOrigin(this Solid solid)
{
    return solid.GetBoundingBox().Transform.Origin;
}

I need your opinion, to make the scaling a percentage, or to a specific value like Faces? In favour of an inch value goes the scaling of too small details, which even at x2 is hard to see

I guess in the solid would make more sense to be percentage.

Nice3point commented 2 weeks ago

I use the Origin from the BoundingBox

The behaviour is the same using Centroid and GetBoundingBox().Transform.Origin

I guess in the solid would make more sense to be percentage.

I can try it, I'll have to test it for a couple of days to see what's more convenient We need to determine what min and max values of scale are optimal and whether we should use a downscaling, probably not.

ricaun commented 2 weeks ago

The behaviour is the same using Centroid and GetBoundingBox().Transform.Origin

Is not the same, if is a irregular solid the centroid gonna be different from the center of the boundbox.

Like this Cone with 1x1x1:

image

We need to determine what min and max values of scale are optimal and whether we should use a downscaling, probably not.

Maybe 1x to 10x, don't know if more than 10x is necessary,

Nice3point commented 2 weeks ago

изображение Scaling by 4x this fireplace loads the cpu a lot and rendering takes 10 sec

ricaun commented 2 weeks ago

Scaling by 4x this fireplace loads the cpu a lot and rendering takes 10 sec

O.o That is generating a lot of triangles per faces, the Triangulate in the face has a parameter, set to 0 just to test. The Mesh gonna be really bad.

Nice3point commented 2 weeks ago

Triangulate in the face has a parameter, set to 0 just to test

изображение square for a round face?) no But this option works super fast

ricaun commented 2 weeks ago

Hehehe, zero is too much. 🤣

Basically you can control the resolution of the triangulation, without the value Revit gonna define a value depending of the size of the face. If is a round face and is really big, Revit gonna generate more triangles.

If you set a value the quantity of triangles gonna be fixed maybe, no sure. You could put a slide in the Face to see what the value does in the Triangulate. If you set to 0.1 probably gonna show a little better intend of a square 🤣

Nice3point commented 2 weeks ago

Released 2025.0.7. Tessellation kept as it is. In Release build it is not so slow. And slowdowns happen on very complex shaped objects, on normal objects it is extremely fast