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: 

Extrude-Cut in API (and also Interactively)

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
1298 Views, 2 Replies

Extrude-Cut in API (and also Interactively)

I am writing a simple command, wish takes a profile and calls Extrude-with-Cut-boolean. For this the code I have written is:

 

    def Execute(self, selectedProfile):
 
        if not isinstance(selectedProfile,adsk.fusion.Profile):
            return;
            
        app = adsk.core.Application.get();
        doc = app.activeDocument
        d = doc.design
        rootComp = d.rootComponent
        
        extrudes = rootComp.features.extrudeFeatures
        extrudeInput = extrudes.createInput(selectedProfile, adsk.fusion.FeatureOperations.CutFeatureOperation)
        distance = adsk.core.ValueInput.createByReal(.5);
        extrudeInput.setDistanceExtent(False, distance);
        extrude = extrudes.add(extrudeInput)

 

But it fails saying that, 'No body to intersect/cut' was found. But I had drawn cut-profile-sketch on a face of a body. That body should have been the obvious choice to cut with the computed tool-body.

 

Interactively also it fails. After searching some posts here, it seems that its bit inconsistent. sometimes it works.

 

CutFails.png

 

Any clues?

2 REPLIES 2
Message 2 of 3
david_reaume
in reply to: Anonymous

To perform a cut in the scenerio you're dealing with, you'll need a negative value for the distance.  Choosing the cut operation does not automatically flip the positive direction of the extrude to point into the body to be cut.

 

So you should try:

distance = adsk.core.ValueInput.createByReal(-.5);

 

Happy Coding!

 

DaVeR

DaVeR
Message 3 of 3
Anonymous
in reply to: david_reaume

Perfect!!! Thanks a lot.

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

Post to forums  

Autodesk Design & Make Report