IfcBSplineCurveWithKnots

edited August 2022 in General

Hi,
I dont understand the NURBS curve representation at all apparently, and was wondering if someone could explain me why eg a straight line between two points get an error on import into BlenderBIM:

In contrast, the only bspline example I have found online (advancedBasin) has a representation as follows:

Which works perfectly when imported into BlenderBIM...

...Sorry for the huge pictures and bad formatting BTW, I am not sure how to add code or change image size yet..If anyone knows how to do that, I will not be offended if they shout out:p

Comments

  • Can you share your ifc file?

  • edited August 2022

    Shure I can share, see the link below:
    https://github.com/buildingsmart-private/IfcDoc/blob/master/IfcKit/examples/advanced-geometric-shape/basin-advanced-brep.ifc
    This is the file I found that successfully uses bsplinecurves, but my own lines doesnt work.
    Attached is my own file using a polyindexed curve instead, which works. The shaperepresentation is on line with id #510.
    If I replace that representation with the bsplinecurve from "advancedBasin" the rebar changes (it works).
    If I use my own attempt at a bsplinecurve, they all fails. I think the only possible error is on line ID #510 :(

  • I should mention that my bspline representations uses degree, knots and controlpoints from rhino, so I am not making these numbers up, but I must have misunderstood something when trying to describe the same curve in IFC...

  • edited August 2022

    If I use my own attempt at a bsplinecurve, they all fails.

    Can you share the file that you thought would work, and it didn't? If you can, boil it down to the simplest geometry.

  • edited August 2022

    Basically change the shaperepresentation at #38 to point to #510, then insert any lines needed to create a bspline, eg. the 3 lines I shared in my first post in this thread. The attached .ifc has changed these 4 lines according to my first comment and does not import into blenderBIM..

  • edited August 2022

    change...
    #510=IFCBSPLINECURVEWITHKNOTS(1,(#511,#512),$,$,$,(1,1),(0.0,1.0),$);
    to...
    #510=IFCBSPLINECURVEWITHKNOTS(1,(#511,#512),.UNSPECIFIED.,.F.,.U.,(2,2),(0.0,1.0),.UNSPECIFIED.);

    You can also play around with this file and uncomment entities #47(profile) and #45(path) to experiment with different ways to create IFCSURFACECURVESWEPTAREASOLID

  • Thats amazing!
    But may I ask, how did you know that changing the knot multiplicities from(1,1) to (2,2) was what was needed? I dont really need to represent a straight line as a nurbs curve, I rather want to understand what I am doing wrong so I wont need to ask again:) Maybe theres a reference somewhere i should read?
    I will definitely play around with your example file tomorrow 👌

  • But may I ask, how did you know that changing the knot multiplicities from(1,1) to (2,2) was what was needed?

    frankly, i'm having a hard time figuring out that too. I just figured it out with trial/error and looking at examples.
    Both the KnotMultiplicities and Knots attributes confuse me.

  • Here's some patterns i found from some of the examples out there...
    still doesn't make sense to me though...

  • edited August 2022

    I think I (at least almost) got it, thanks to your help:D
    The sum of the knot multiplicity vector as described in IFC should equal degree+controlPoints+1, the length of knotMultiplicity and "knotValue" should be equal, and as you said the first and last point in the knotMultiplicity vector should be equal to degree+1.
    The representation used in Rhino is different (the first and last knotMultiplicity is equal to degree, and the knotMultiplicities are written out explicitly.
    Example: 3rd degree 5 controlPoints, in Rhino the knots can be described eg. by [3,3,3,1,3,3,3] and [0.0,0.0,0.0,25.0,50.0,50.0,50.0] while the correct IFC representation is [4,1,4] and [0.0,25.0,50.0]
    In order to go from Rhino to IFC, I need to count how many times a knot is repeated and use that value instead of duplicates. If first/last point, I must ensure the multiplicity is degree+1, and also make sure the resulting knot vector has sum degree+points+1

    theoryshaw
  • Ping @aothms - he's got a good understanding of geometry and might be able to explain the knot multiplicities.


  • Thanks, I will check it out, but it seems like I have got it working:)
    Another (slightly different) question: Looking at my rebars, they are all open at the end. How do I close them?

  • edited August 2022

    I share my Rhino->IFC code snippet here, just in case someone finds it useful:

    Starting from the knot value vector, eg. [0.0, 0.0, 0.0, 41.51556731912806, 83.03113463825612, 124.54670195738419, 166.06226927651224, 207.57783659564029, 249.09340391476837, 290.6089712338964, 332.12453855302448, 373.64010587215256, 415.15567319128064, 456.67124051040867, 498.18680782953675, 539.70237514866483, 581.21794246779291, 622.73350978692088, 664.24907710604896, 705.76464442517704, 705.76464442517704, 705.76464442517704] for the long bar shown above:
    import collections as c
    lst = knots
    result = c.OrderedDict()
    for el in lst:
    if el not in result.keys():
    result[el] = 1
    else:
    result[el] = result[el] + 1
    vals = list(result.values()); vals[0]+=1; vals[-1]+=1
    keys = list(result.keys());

    Coen
  • @BIMrookie92 said:
    Another (slightly different) question: Looking at my rebars, they are all open at the end. How do I close them?

    See GIF below.
    I also put in this pull request, since i feel more often than not, upon import, the ends of these IFCSWEPTDISKSOLID's should be closed by default.

  • Nice!
    bpy.context.space_data.context = 'DATA'
    bpy.context.object.data.use_fill_caps = True
    Do you know if it is possible to trigger these blender commands from Python so the .ifc file includes this already? Or is this purely for visualization in Blender, ie. the .ifc is unchanged?

  • @BIMrookie92 thanks to @theoryshaw the latest build will default to having the caps closed.

  • Do you know if it is possible to trigger these blender commands from Python so the .ifc file includes this already? Or is this purely for visualization in Blender, ie. the .ifc is unchanged?

    If i'm following you correctly, there's no way (that i know anyway) of codifying, in the IFC file, that the ends of the IFCSWEPTDISKSOLID should be closed.

  • Ok, thank you (all three of you) for your help:)
    Then this is (one more:p) reason to convince others at my company to start using blenderbim:D

  • The ends of the swept disk solid should always be closed as per the definition of IfcSweptDiskSolid from my understanding. However, an InnerRadius may be specified which may then make it a tube with thickness, but InnerRadius is not yet implemented.

    theoryshaw
  • True, all solids (except polygonal bounded half space - which is a weird one) define a clear bounded volume. InnerRadius is implemented (albeit horribly inefficient) in IfcConvert. Would also be good to once in a while cross reference blenderbim's native mapping and the IfcConvert implementation.

Sign In or Register to comment.