Posible BUG with profile curve's BoundingBox over Spline

Posible BUG with profile curve's BoundingBox over Spline

Jorge_Jaramillo
Collaborator Collaborator
307 Views
0 Replies
Message 1 of 1

Posible BUG with profile curve's BoundingBox over Spline

Jorge_Jaramillo
Collaborator
Collaborator

Hi,

 

I was expecting that a boundingbox build from profile's curves formed with a spline was adjusted to the curved.

What I'm getting is a boundingbox that is both wider and taller than the spline.

I was also able to reproduce the same issue with manual-drew splines (both fitted and control point splines).

Should it be considered a BUG?  Or what the gap between the curve and boundingbox means?

 

On this image I draw the box with the boundingbox build from profile curve's boundingbox property:

Jorge_Jaramillo_2-1721273437887.png

 

When I draw another box in other sketch with the sketch-curve's boundingbox property I got a box that is adjusted to the spline:

Jorge_Jaramillo_1-1721273377616.png

 

I build the following script is someone want to reproduce the error on its environment (just run it on a empty design):

def profile_loop_boundingbox_test() -> None:
    # 1. Create a XY-sketch and a spline on it
    sk1 = root.sketches.add(root.xYConstructionPlane)
    sk1.name = 'spline'

    ctrl_points = [
        [1, 1, 0],
        [9, 2, 0],
        [2, 7, 0],
        [1, 1, 0],
    ]
    knots = [0,0,0,0,1,1,1,1]
    nc = adsk.core.NurbsCurve3D.createNonRational(
        [adsk.core.Point3D.create(*pts) for pts in ctrl_points], 
        3, 
        knots, 
        False)
    sfs = sk1.sketchCurves.sketchFixedSplines.addByNurbsCurve(nc)

    #2. Create a second sketch and draw a box with profile curves's boundingbox
    sk2 = root.sketches.add(root.xYConstructionPlane)
    sk2.name = "profile curves-boundingbox"
    for profile in sk1.profiles:
        profile_loop_n = 0
        for profile_loop in profile.profileLoops:
            profile_loop_n += 1
            bb: adsk.core.BoundingBox3D = None
            profile_curve_n = 0
            for profile_curve in profile_loop.profileCurves:
                profile_curve_n += 1
                if bb:
                    bb.expand(profile_curve.boundingBox)
                else:
                    bb = profile_curve.boundingBox.copy()
            skt_lines = sk2.sketchCurves.sketchLines.addTwoPointRectangle(
                bb.minPoint, 
                bb.maxPoint)
            for skt_line in skt_lines:
                skt_line.isConstruction = True
            app.log(f'{profile_loop_n=}  {profile_curve_n=}')
    
    #3. Create a third sketch and draw a box with profile sketchcurve's boundingbox
    sk3 = root.sketches.add(root.xYConstructionPlane)
    sk3.name = "profile sketchEntities-boundingbox"
    for profile in sk1.profiles:
        for profile_loop in profile.profileLoops:
            bb: adsk.core.BoundingBox3D = None
            for profile_curve in profile_loop.profileCurves:
                if bb:
                    bb.expand(profile_curve.sketchEntity.boundingBox)
                else:
                    bb = profile_curve.sketchEntity.boundingBox.copy()
            skt_lines = sk3.sketchCurves.sketchLines.addTwoPointRectangle(
                bb.minPoint, 
                bb.maxPoint)
            for skt_line in skt_lines:
                skt_line.isConstruction = True

 

Regards,

Jorge Jaramillo

 

0 Likes
308 Views
0 Replies
Replies (0)