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: 

catch 22 - generating floor from CurveChain

21 REPLIES 21
Reply
Message 1 of 22
Anonymous
884 Views, 21 Replies

catch 22 - generating floor from CurveChain

Hello,

I want to generate a floor from a subface of a room, mostly it works like a charme but I managed to get one situation where I have the following problem:

New Floor method throws the error that the provided curve is not a closed loop, and guess what this is true. (which is funny because I get the profile Curve from a face)

So i decided to simply close the Curve, but than trying to add the line to close the curve I get an error that the curve I am trying to add is to short.


So I can't generate a floor because there is a gap, but I can't close the gap because it is too small?

21 REPLIES 21
Message 2 of 22
MarryTookMyCoffe
in reply to: Anonymous

Yes

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
Message 3 of 22
jeremytammik
in reply to: Anonymous

You could try to recreate the curve loop and modify the endpoints very slightly, for instance, by rounding them to the closest full millimetre.

  



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

Message 4 of 22
Anonymous
in reply to: jeremytammik

Hmmm,

 

I am not sure, I mean you would expect that the edges collected from a face would consist only of "valid" geometry, this would be somehow consistent... 

Message 5 of 22
Revitalizer
in reply to: Anonymous

Hi,

 

what about elongating the neighboring curves to fill the gap?

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 6 of 22
Revitalizer
in reply to: Anonymous

Hi,

 

another idea.

 

When creating ModelCurves from the non-closed loop, Revit may adjust them slightly - connecting them, like a magnet.

If you get the ModelCurve.GeometryCurve, it may vary from the input curve used for creating it.

 

Perhaps you could use Revit's AI for correcting the broken curve loop.

ModelCurves can be deleted after use...

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 7 of 22
Anonymous
in reply to: Revitalizer

No I think Jeremy's solution would be the best and I think I will go for that as a workaround but:

lets rephrase this:

It is a bug!

Message 8 of 22
MarryTookMyCoffe
in reply to: Anonymous

did you hear about: Double precision problems on .Net?

 

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
Message 9 of 22
Anonymous
in reply to: MarryTookMyCoffe

And how is this relevant in the given case? 
The gap in the given case is a multitude higher even float precision, and the location of the curve is somewhere within 100 units of 0...

Again and if so it should be handled by the geometry kernel of revit...

If I can get the edge curve of a face it should be closed? Or is there any possible definition of a face with an open edge?

Message 10 of 22
Revitalizer
in reply to: jeremytammik

Hi Jeremy,

 

rounding vertices will introduce other problems.

The Floor provides geometry that can be referenced.

The user may reference false point when using point snap (and multiply this inaccuracy by moving, rotating, mirroring other elements).

 

Rudi

 




Rudolf Honke
Software Developer
Mensch und Maschine





Message 11 of 22
Revitalizer
in reply to: Anonymous

Hi,

 

I recommend to visualize the geometry, e.g. via gbXML export.

 

https://thebuildingcoder.typepad.com/blog/2013/05/revit-2014-sdk-and-visual-debugging-tools.html

 

What you see may not be what you get.

 

If the original geometry is garbage, you can either use it or skip it.

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 12 of 22
Anonymous
in reply to: Revitalizer

Well I know that the Original Geometry is Garbage because of the limits Revit introduces to the length of curves and skipping is what I do, but it is a result of:

SpatialElementGeometryResults results = calculator.CalculateSpatialElementGeometry(R);
Solid roomSolid = results.GetGeometry();

and therefore I think that it is a bug or at least inconsistent , because:


From a Solid I can get a Face from which I can get the Boundary and the underlying Surface.
So one would expect that if I have the Boundaries and Surfaces of a Solid I am able to recrate the faces and the Solid

But in the given case this is not possible because the Boundary I get is missing a pice because the pice is to short hence I can't recreate the solid.

It is okay I don't need to find a solution, just wanted to point out that this should be fixed....

Message 13 of 22
Revitalizer
in reply to: Anonymous

Hi,

 

I totally agree!

 

 

Have a nice weekend,

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 14 of 22
Anonymous
in reply to: Revitalizer

Where to file a bug ?

This problem keeps on getting on my nerves...

Message 15 of 22
jeremytammik
in reply to: Anonymous

You can submit a problem report right here.

 

To do so, please attach a minimal complete sample project with all the elements required to reproduce the problem, and nothing else.

 

Please also attach a complete and minimal Revit API add-in or macro that can be compiled and executed with a single click or two to reproduce the problem, including exact steps for achieving this:

 

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

 

I'll pass it on to the developers for analysis for you.

 

However, I am pretty sure that they are aware of this issue and do not consider it a problem.

 

Still, we can see what they say.

 

Thank you!

 

Cheers, 

 

Jeremy

 



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

Message 16 of 22
Anonymous
in reply to: jeremytammik

I finally had the time to provide an example. Please find attached a VS 2017 solution and a revit file.

What the Code should do:

1. Select a room

2. code should add a direct shape onto all surfaces touching the room.

 

What doesn't work:
Some surfaces can't be added because they include a curveloop that contains a line that is too short.

 

Why is this a problem:

The curveLoop used to generated an Extrution is the boundary of a face. This face is part of the solid that was retrieved from the Elements touching the room. So the curveloop wasn't constructed manually but is a result of revit API operations. 
In the give case this happens becaus a drawing inacuracy  was introduced (the wall where no surface is generated has a little error). Such inacuracies will happen in big projects  and are inevitable. This makes automation a bit problematic. Further one could easily think of situations where this happens without beeing a result of drawing inaccuracies e.g. where three walls meet with different thicknesses.

 

Possible fixes:
A) remove too short curve loop 

B) limit revit coordinates to the too short curve tolerance

 

What I would expect as a feedback:
I would hope the too short curve limitation will be removed.
If not a clear explaination of why this can't be done and why this restriction was introduced in the first place.


Message 17 of 22
jeremytammik
in reply to: Anonymous

I love simplicity and KISS: https://en.wikipedia.org/wiki/KISS_principle

 

In conjunction with Revit coordinates, this has motivated me to often round all the coordinates that I collect from a Revit model to the nearest full millimetre.

 

One advantage is that from that point on, I have no rounding errors.

 

Less memory space, quicker calculation, easier to read, more suitable for both BIM work and humans.

 

Why don't you just do the same and the problem will go away?

 

 



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

Message 18 of 22
Anonymous
in reply to: jeremytammik

This sound stricking at first but if not introduced as a system wide restriction:


  trans.png

 

a) When rounding the transformations might alter the geometry... 

 

b) This would meen I would need to rebuild the complete model, otherwise the newly generated walls would not match the original elements from which they where generated. This would result most likley in colisions, if not in Revit directly but later in other programms which don't use funny restrictions.

So this Is why I actually proposed it as a bugfix ....

Message 19 of 22
jeremytammik
in reply to: Anonymous

I never modify the Revit BIM.

 

I only round the coordinates that I retrieve and export from the model for downstream use.

 



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

Message 20 of 22
Anonymous
in reply to: jeremytammik

this doesn't work in the given case because the generated elements have to be modifyable by humans in revit.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community