Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sketch.profiles and extrusion.

1 REPLY 1
Reply
Message 1 of 2
gscotti
223 Views, 1 Reply

Sketch.profiles and extrusion.

I'm trying the following code.The problem here is that the profiles contains inner profileLoops. Is there any way to filter that out, or should I create another profile and includes only the outer profile in profileLoops? This sounds very confusing to me.

 

    # search for profiles that spans larger boxes than registered maxp    
    newprofiles = {}
    for p in sketch.profiles:
        if not p.isValid:
            continue
        bbox = p.boundingBox
        d = helper.diff(bbox.minPoint,bbox.maxPoint) # diffs two points and returns vector
        if d.length > maxp[0]:
            newprofiles[d.length] = p

    # sort and pick the largest 3
    largest = []    
    for a in sorted(newprofiles, reverse=True):
        if len(largest) < 3:
            largest.append(newprofiles[a])
        else:
            break
                
    pedestal = largest[0]
    einput = extrudes.createInput( pedestal, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
    distance = adsk.core.ValueInput.createByReal(-stepdown)
    einput.setDistanceExtent(False,distance)
    extrudes.add(einput)

As a result, all profiles are chosen instead of the outermost one (which would span the largest bounding box). See the screenshot

 

1 REPLY 1
Message 2 of 2
gscotti
in reply to: gscotti

I think my geometry is bad, or offset operation creates a bogus profile. With a simpler body, the script work correctly.

I'll try something different.

 

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report