I'm extruding some profiles on different planes and on some planes it trys to extrude the profile in a direction tangent to the sketch plane and fails. So i'm trying to set the direction as a
adsk.fusion.ExtentDirections.PositiveExtentDirection
but I don't understand what the parameter value should be in the .setAllExtent method - i'm miss understanding this help page I think;
http://help.autodesk.com/view/NINVFUS/ENU/?guid=GUID-3e9bcf4c-7f75-4b5d-860a-827e4c342d3e
Full code here;
# Create extrusion input extrudes = rootComp.features.extrudeFeatures extInput = extrudes.createInput(profiles, adsk.fusion.FeatureOperations.NewBodyFeatureOperation) # Define distance of extrude distance = adsk.core.ValueInput.createByReal(feature['distance'] / 10) # Set the distance extent to be symmetric extInput.setDistanceExtent(True, distance) # Set the extrude to be a solid # extInput.isSolid = True # extent_def = adsk.fusion.ExtentDirections.PositiveExtentDirection # Set direction extInput.setAllExtent(1) # Create the extrusion ext = extrudes.add(extInput)
Any help much appreciated and an example would be even more appreciated!
Thanks
Based on your description, it sounds like the API isn't checking your input to make sure it's valid. The profiles that you input for an extrusion should all be co-planar. If you're able to input profiles that lie in planes oriented differently then it's not validating the input correctly. If you use the Extrude command interactively, you'll see that it has this limitation and using the API to create an extrusion is no different.
I could have misunderstood what you're doing though. If I'm correct can you confirm that's what you're trying to do and I'll log a bug so that it this will get caught earlier when you specify the profile. If I did misunderstand, I'll be happy to look at is closer if you can provide some more details.
Hi Brian, thanks for getting back to me.
I see what your saying. I'm trying to extrude sketches on different planes with in the same script, but i'm doing it with two different extrude calls and setting up two different extrude inputs;
As you can see there are two sketches here, i've imported both using createDXF2DImportOptions on the xYConstructionPlane, it doesn't seem to matter which ConstructionPlane I import on to the first sketch extrudes and the second doesn't.
It's quite difficult to debug. I don't know if the coplanar issue you mention here applies?
In this example the "profiles" used in the extrusion input is an object collection but it redefines and clears the object collection before adding new profiles for each extrude (in this case it's only one profile each time).
Since you're creating them as separate extrusions it should work. Is it possible to post a simple reproducible sample that we can look at? It's hard to tell if there's something wrong in your program or possibly an issue with geometry that was imported.
Very early test code, but i'll try and explain.
If you unzip the attachment and load the .py file into fusion from that location as a script then it should reference the other files it needs from that directory.
If you run the code on an empty "design" you should see the error;
Failed: Traceback (most recent call last): File "{}/ucf-fusion-loader.py", line 115, in run ext = extrudes.add(extInput) File "/Users/harry/Library/Application Support/Autodesk/webdeploy/production/cb5e8e435f8356e046bf6e45ad1bd4086fde57c7/Autodesk Fusion 360.app/Contents/Api/Python/packages/adsk/fusion.py", line 8289, in add return _fusion.ExtrudeFeatures_add(self, *args) RuntimeError: 5 : The path is tangent to the profile. Try adjusting the path or rotating the profile.+Tool body creation failed
The code is basically reading in a .json file and building the different features it describes.
Thanks for your help.