Fusion 360 rolled out a new update yesterday and there are quite a few API enhancements. For a complete list you can go to the Fusion 360 API help, but here are some of the highlights.
Getting the Active Length Unit
There’s been a problem since the beginning of the API that we just recently discovered and have fixed in this release, but it’s possible that you may need to react to this change in your code. If you want to find out what length units the user has chosen to use, (as shown below), you can use the defaultLengthUnits property of the UnitsManager object that you get from the Design object.
This returns a string indicating what the current length units are. The problem was that the string returned wasn’t consistent and depended on the preference settings highlighted below. So if the units were inch you could get back “inch”, “in”, or " (a single double quote). It’s likely that you didn’t discover this in your testing because the preferences were always consistent on your machine but then when someone else uses your program it could break because they have a different setting. The API now always returns the abbreviated form of the unit. So you can now always expect one of the following “in”, “ft”, “mm”, “cm”, or “m”. If you were looking for other versions like “inch” or “centimeter” in your code, you’ll need to adjust for that.
Additional Feature Creation
The API now supports the creation of some additional features. These are Loft and two different flavors of Delete Face; deleting a face in the Patch workspace (SurfaceDeleteFaceFeature) and deleting face in the Model workspace (DeleteFaceFeature). If you hadn’t noticed previously, these commands behave quite differently in the two workspaces. When deleting faces in the Patch workspace faces are removed from the model. When deleting faces in the Model workspace, the face is removed and then the model is “healed” to close the solid.
Getting a Body as NURBS
A body in Fusion can consist of a mix of surfaces of different geometry types. For example, a box with a hole in it is made up of 6 planes and 1 cylinder. Freeform surfaces in a body are represented by NURBS surfaces. Some applications prefer to deal exclusively with NURBS rather than a mix of NURBS and analytic surfaces. The new BRepBody.convert method creates a new transient body that is a copy of the original body but all of the geometry has been converted to NURBS surfaces. New functionality is also provided through the new tempId property of the BRepFace, BrepEdge, and BRepVertex objects and the new findByTempId method of the BRepBody to find the vertices, edges, and faces, that match between the original body and the new body.
We’re working hard on some other API enhancements for the update currently scheduled for the end of September.