Get started with Fusion 360 API

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the broadcast is now starting all attendees are in listen-only mode hi I wanted to welcome every to today's presentation on fusion 360 API and my name is Brian Deakins I'm the designer for the fusion API and also work with ADM then be helped to support the API as more of as you start to use it and we give people just a couple more minutes to to come on I got a little poll here we can try and during the priest to ask questions off to the side and they either save those up for the end and or there's some other people from on our desk watching and maybe bill to answer some as we go so there's the results so I see yeah you know quite a few just that curious about what Fusion is so hopefully you can answer some of your questions yeah so this presentation is focused on the API but we'll learn a little bit about just fusion in general too let's go ahead and get started and so here's what I hope you get out of this presentation then and I think it's listed as being scheduled for for two hours but that was just what was scheduled that we're gonna be closer to should be under an hour and but here's what I get I hope that you get out of sitting in on this presentation as you know understand what what a script is and what an add-in is and have a basic understanding of what we call the object model and know what the API can and can't currently do and then sauted what's available with Fusion to help you write and run and debug programs and then what documentation is available so and first I want to clear up a little bit misconception so there there's been an API in fusion for quite a while and you can't remember exactly when it came in but it's an old common legacy API and in in this latest version of fusion it's even called legacy C add-ins legacy and that is is going away so the part of the confusion with that is on the exchange store now there are some apps for fusion very few of them but they're using this old legacy API and now with some of the functionality we're getting into the API and especially some that just came in in this release that I'll talk about and what's coming in the next couple of releases you know what we should start seeing a lot more abs for fusion starting to show up on on the exchange store and hopefully you bill to to participate with some of them but so there's this old API and I'm not talking about that at all that that'll disappear at some point but there's the this new API and sorry I think I've got the wrong need to get rid of this poll here there we go so you're just a ejectives hopefully we get out of this and here's about the the old API sorry about that and now about the new API so it was it's new it was released for the first time just this past September and in that September release is supported writing scripts in in JavaScript and then in November we added support for Python and now with this this release earlier this month we added support for add-ins and in the future we'll support also C++ so so those are some kind of bigger milestones with the API and something that it's kind of interesting with the API is so there's multiple languages so today Python and JavaScript and coming C++ will see nothing else is planned right now but we'll see in the future but so there's multiple language supported but there's really just a single API and when I designed the API I actually design it in a language that's that is language agnostic it doesn't it's not specific to C++ or Python or JavaScript I just designed the API by saying here's here's an object and here's methods on it and what are the arguments for that method here's a property so I just define what the API will look like and then a process looks at my design and then automatically creates the internal code to support that and wrappers get built for each language so so there's this and the API is exposed through what we call an object model which I'll describe a little more detail and you have this object model and each object in this structure represents an object confusion and some that are api specific and we'll look at an example in just a second and something that's confusing to some people that are new to this is an object model is showing ownership between objects it's not representing any kind of inheritance model so that's separate yeah even though there is some inheritance but this object model chart that I'll show in just a second is just showing ownership between objects and there's one special kind of object in this it's API only called a collection and a collections provide access to a kind of set of related objects and they also support the ability to create new objects and we'll see that in just a second in this example so here's the entire big API object model and with this last release that got big enough I had to move it onto a D size sheet and but so there are quite a few objects and it will continue to grow a fair amount over the the next several releases but at here's a detailed view I've taken just a section of that object model and and blown it up here so we want to write a program that'll create an extrusion and I want to show how how you would use this object model to do that and a key object does that top-level object called the application object and that represents all of fusion so here's some code that lets me get that application object so I'm calling we have a namespace called a dsk and it's divided up into two pieces core and fusion so core has a lot of just generic functionality and then fusion of course has the fusion specific functionality and then on that there's the application object and I'm calling a static function on it to get it so now in this variable the app variable I have a reference to this top-level application object so now we're hooked into this object model and so next on that application object I'm calling a property that is supports called active product and with fusion documents are divided up into pieces internally and so it has a piece where all of the design data is stored that's when you're modeling with fusion sketches the model everything is stored in this design clump if you had cam data it's stored in its own clump drawings would be stored in its own clump and what this active product is doing is it's getting in this case I'm just assuming that a design is open if something else was open this would break but I'm asking the app give me what the user is currently editing and so it returns that product which in this case happens to be a design object so now I have this design object that you can see in the in the chart right so then with the design object I call a property on it called a root component and that returns a component object so the root component is the very top level component if you were in fusion and looked at the browser that's the very top one that owns everything else in in that document so now we have the the root component and from the root component I call sketches property so now that gives me the sketches object that you see in the chart and as I said before so the sketches object is a collection it's one of these so it gives me access to all of the existing sketches in a document and it also supports ways to create in new sketches so that's where this add method is so on the sketches collection I'm calling add and it wanted when you create a sketch it needs a plane and so that could be a planar face or in this case I'm calling this XY construction plane property on the route component so that's one of the base construction planes and passing that in and so that creates a new sketch and then returns that so now that sketch variable has one of these sketch objects that you can concede in the chart and so now we wanted to draw a circle and so from the sketch I call a property on it called sketch curves and you can see that object in the in the chart kind of in the middle under sketch there so that's another collection and that collection contains all of the curves in a sketch so that's kind of everything in a sketch is set for text and points so that in decals or images so so now I've I've got the sketch curves collection and then it has a collection under it the four circles so that would give me all of the existing circles and so now I have a reference to that collection and then I'm calling the add by center radius on that collection to create a new circle so I'm creating a coordinate XYZ coordinate by using that point 3d create and then the second argument is just the radius of the circle so now we've created a circle and you can also see under a sketch there's a profiles collection so as you work in fusion you'll notice this as you draw a sketch and and as areas become closed they kind of highlight or they fill and so fusion automatically as you draw sketch geometry is calculating closed areas within that and those are called profiles and so this from the sketch is going to the profiles collection and it's just getting the first profile in that that collection and because I just drew the circle I'm expecting one to be there and so I'm just getting the first one so now I have the profile and now I want to create an extrusion with that and so now I'm moving over into this second part of the chart so from a component I can access the features collection and the it I can get as the extrude features collection so again that's I can access all of the existing extrude features in a document or I can use that to create new extrude features and that's what we're doing here so I have this extrudes variable which is referencing this extrude features collection and I call a method on that extrude features collection called create input and so this is a concept that's used fairly frequently in the API and mostly for creating slightly more complex objects and so when I create an input and here I'm passing in the profile and then what kind of operation I want to do but nothing's happened inside fusion so you can think of these when you create an input is it's it's kind of like the API equivalent of a dialog so when you run the extrude command if it's leading you through all of the input that that's required to create an extrude and that's the same thing this input is is it it's just gathering up all of the stuff that it needs to do to be able to create an extrusion so I've created this input with some basic information and then continue to provide some more so in this case I want to do a distance I want to dis extrude a certain distance so on that input I'm doing a set distance extent I'm this argument false is saying I want to just go to one side rather than symmetric and then how deep I want it to go and so I create one of these value input objects this is something that people stumble over a little bit is when I'm creating in an extrusion and defining that depth that's going to become a parameter in the in the extrude that gets created and so a parameter can be defined in the API by just a value that you've calculated somehow or it could be a string that's an expression so I could a with as a string one space in4 one INT or if there's a very parameter already called length I could say length divided by two something like that so you can have have strings that have equations in them and and reference other things or just define a simple value with a unit or I can use a double value like I'm doing here and and then that since I'm doing length it's always interpreted to be centimeters that's the internal database unit for length and so when I use a real value it's always centimeters regardless of what the user is working on and so so the input for this distance is a value input and here I'm creating it just with a double value but there's also a create by string where I could do an expression it's anyway so now we've defined all of the input that's needed for an extrude and so the final thing is to actually create the extrude mr. UD's collection call the add method and pass in that input object that has all the information that that's required and then the actual extrude is created so what what can you do with the API and so most of what you can do manually in the UI is and so most just because the API doesn't have full coverage yet but eventually you should build anything you do in the UI you should be able to do through the API and so some people might say well if I can already do it manually in the UI then why would I want to do it in the API and just show a simple example of that and just run a little script all right so here's a script to draw a gear so it's giving me asking for some input click OK and so here's the finished gear right so could you create this manually sure it's just you know it's there's a base sketch that's extruded and then another sketch that's a single tooth on the gear that's extrude and then there's a fillip that does the base fill it and then it's patterned and round so you could do that manually you could get out your calculator and figure out the the points on that that tooth you know how to calculate an involute and so it's possible manually would anybody want to do it manually no yeah so you know this isn't a perfect example of why you would on an autumn 8 tasks that you can do manually but you wouldn't ever want to do manually so it's things that would be you know kind of tricky having to calculate those points along an involute or well in other cases it would be really tedious to do and so it's nicer to write a program and just automate the process all right so here's a list of what currently the API supports so as I said it it sports a lot of what you can do manually and we're working on filling in the pieces that you can't so I'm on in modeling on the create panel you can see so I can do extrusions rawls sweep whole thread pattern mirror and and in some cases there's we know of some changes coming in the short-term infusion and this is a case for all of these primitive things so we've intentionally held off on doing the API so we don't have to just change it when the fusion changes but some of these others are just we just haven't gotten to them and a lot of them are planned for this upcoming release and so on the modify panel you can see there's most of it is there and most of what's missing will be in the next release sketch so most of sketch is supported through the API construction so those are construction planes axes and points that's pretty much all supported you can see I have a circle through the assembly panel so nothing in assemble is supported right now there's are some changes coming in this next release and so it probably won't be until the following races after that but but that's that's planned and there's nothing in inspection or select the patch environment there's a little bit today and a lot in this next release and there's nothing for render animation or cam right now so so we have quite a bit for features so that the timeline like you can see at the bottom here so that's that's exposed to the API it's a sketches just what I talked about parameters are exposed to the API you can query and assign materials and the same with appearances and there's also has some basic a 360 access that is you can query and look to see what what projects you have what folders are in each project what files are in in each folder you can open those you can save files to a particular folder so so that's supported today some more things that are more kind of API specific and is you can through the API you can traverse the assembly structure to see you know what what components you have and what sub assemblies and what parts are inside those so that's all possible today through the API you can also query the geometric information out of a model so we solid and services are defined by what we call a beer a pour boundary representation so I can see oh I have this models that say it's a box so I can look at this and say oh that it's it's a solid and have six phases they're all planes and they're bounded by lines and so you can get that kind of information and also you can get a mesh so like a triangular mesh of representation of a user preferences are exposed through the API camera related functionality and you can create commands we'll talk more about that in a little bit and with this release just came out earlier this month we can now do a dance which I'll talk about in just a second so some future functionality C++ support and that's not coming in the next release but hopefully the release after that and as I mentioned already assembly joints the features that are still missing T splines is ability to create custom graphics so none of this is here today right things sometime in the future drawing support cam support and and much more and and a lot of this we would really like to hear your input because there's still quite a bit to do and and we'd rather you know focus the effort on getting what you want done first rather than I was just guessing so alright so choosing a language so today as I mentioned the API supports both JavaScript and Python and they both have full access to the API so there's really not any limitations of one versus the other it's a personal choice so so JavaScript you generally think of JavaScript as as being used to drive a web page you know it's it's all the intelligence behind the the web page but here it's being used just as a general-purpose language and in fact you don't have a web page so you can't display any HTML at least today hopefully that will change in the future and JavaScript by design doesn't have any any functionality to access the file system for security reasons they don't want you reading riting files on the user's system webpage so there's no file system access but so we've added some of that to the API just to support JavaScript because that's something you would very commonly want in a script bill to to read a file and then do something in fusion with that data which all the script you can use any text editor you want if you have a favorite editor for writing JavaScript you're free to use that we do deliver an editor with Fusion call brackets and so when you go through fusion and say edit Brett the brackets editor will come up hopefully in the future we can make this more flexible so you could choose some other editor instead but the editor is used just to write the code and then debugging is done if you're on Windows in chrome if you're on Mac on WebKit browser so you write in one tool and debug in something else it runs out a process in its own invisible browser instance and you can use external javascript libraries so you can you know import additional functionality through and through referencing external javascript libraries and python so it runs in process diffusion in its own Python interpreter so javascript remembers running out of process so this runs in process and there's all of that is as for two things one running in process and then it has less overhead too and just how that it calls the API so so Python can be quite a bit faster than the JavaScript and some of these numbers I did some testing and so just making pure calls not really testing not doing anything in fusion but just making a very simple call Python was 275 times faster than JavaScript and then I wrote another little script that actually did something in fusion it drew a whole bunch of lines and that was 23 times faster so so it's all you can say for sure is it's going to be faster how much faster depends on what your program actually does so so it might be making a simple call and then a la fusions taking a lot of time to bail the to handle that call so in that case you're gonna see you know hardly any difference so it just depends on on what the program does but so python has full access to the file system and you can also use any editor you want to edit but we deliver an editor with fusion called spider and spider is also used for debugging so so there's one one tool that you use for or can use for both editing and debugging and python comes with the library to build a dialogues your own GUI development called TK enter and unfortunately we it doesn't work with Mac we've had some issues with getting to work with Mac it works for Windows but not Mac but so so neither one of them and wit so with JavaScript you can't use HTML as Python you can use TK inter but it's only on Windows so neither one of them really have a good that grade of solution right now for for building a Dewey but I'll talk about commands in a second because it's not a critical issue and and you can also use other Python libraries there's a rich set of libraries out there for Python to do all kinds of things all right so here's an example script very similar to what we looked at before and it's taking a while to screen to update there we go okay so so here's an example of a script they say it's it's very similar to what we did before actually a simpler version of that extrude this doesn't create an extrude it just draws a circle and then adds a dimension to it to control the diameter of the circle and so here's the JavaScript and then I'm gonna switch to the exact same program for Python and it's so slow to update here but so there identical I'm gonna switch back and forth a couple of times and so you can kind of compare the two but so here's JavaScript and here's Python and so as I said before so this really is a good demonstration of how there's a single API and the only differences between these two programs that are just the language syntax differences so I've got bar in front of each variable where I'm using it for the first time in in JavaScript and I have semicolons and that's basically the only difference between between the two oh also javascript gets a little pickier about type so I have to do a cast here to get the the design object and and that's really the only difference between the two so it makes it when you have really pure fusion API code it's pretty easy to port from from one language to the other but then when you start getting into where they're using you know more language specific functionality then then you have to do makes it a little harder to port because you're converting you know fight it Python ifs to Jeff descriptive sir and that kind of stuff all right so scripts and add-ins so so scripts is what we've had in the API since it came out in September and so they're usually I'm saying here run and done that's something you go into the UI you find your script you say run and it might have a dialogue I might not but you you run it and then it's done then and then to run it again you go back to the dialogue and say run it again and addy typically automatically get started by fusion at startup and then they just remain running through the whole session and I'll show you how that's an advantage so it depends on you know really what you're doing if you have just some little utility that you use once in a while you know a script is a great way to do it if you have some you want to do you want to create a command and have that available all the time then you would tend to do that as an ad in sale go into that a little more detail so add-ins there's a little more overhead in building an add-in it requires a manifest file just a small little JSON file that has information about the add-in so what's the name does it automatically load it start up some other information description and in the code itself Fusion expects that you implement certain functions so when Fusion starts it up it calls a particular function it's called a run function and so that's kind of the entry point for your for the add-in and then there's a stop function the fusion will call when the atom gets unloaded but so imagines expected to kind of follow some certain rules and scripts can follow those same rules but don't have to all right so scripts and add-ins and hopefully the performance here is good enough I can do a little bit of a demonstration so I think the slide and talks about some things that this dialogue does but I'm going to instead just demonstrate it so go back to fusion and there scripts and add-ins command and so it's divided into two tabs I have a scripts tab and add-ins tab and each one has a list of samples do so these are a good ones to go look at so in my scripts are ones that I've created and if I expand this I can see some more detailed information about each one and for example your the description here's actually where the script lives on disk and so let's create a new script so I want to so they can do that through here so create and then here I can now say am i creating a new script or a new add-in and it's a Python or JavaScript so let's let's do a Python one first I'll show show how that works and so just give it a name I could give it a description and author that's all optional and create so it's it's created it so now in here I can say edit and so for for Python it's going to use the spider development environment and so it's created a skeleton Python program for me and you can see here has a main function so so fusions just going to run this program and here's a call to main and so this ends up getting called and executed and right now the it's just getting the application like we saw on that sample before and from the application it gets an object called user interface that supports access to all all the user interface in and fusion plus some some basic UI tools like in this case to display a message box so so if I ran this right now it would just display a message box but let me go back to the presentation and grab this script code and I'll just paste it in ok so here's here's our program and I can go ahead and save that and now I could go back into into fusion and and run this from from the scripts and an add-ins dialog but I can also run it from Spyder and let me delete what I've got here all right so from bihter I can click this which would just run it and but instead I want to show debugging so I can set a breakpoint in the program and then click this debug command now starts it's actually broken since I did debug it it's at the import statement over here on the right I have this variable Explorer and that's showing me that the values of variables so far is not much to see yet but all of this run and so now it's hit the breakpoint I set and now I could step through and so here I see app is referencing application object and I continue to step through here so we just created a sketch I can use the console window to do some more examination so I could say sketch and sketch has a property called name it's a sketch name so it's sketch two is what we've created but now it's going to create get the sketch circles collection and create a circle and add a constraint to that and I'll just let it run through and there we go so just graded the circles so that's how I can create a new script and and debug it for Python so let's look at doing the same thing with JavaScript and let me go back to I'll just get my the code from our sample just copy that and we'll go to the scripts and add-ins command inside fusion and I want to create a new script just like we did before and except this time I want it to be JavaScript so create and now I want to add it and so for a script fusion by default displays or uses this brackets editor and so it's again built me a skeleton script and this top section that if a desk debug equals true is is used for debugging so it if you're debugging it will break there so then you have an opportunity to set other breakpoints and but we want to paste in that code all right so now we have our JavaScript code and I need to save this so I can't debug from here this is strictly an editor so let's say you could use any editor you want so but I saved this I need to close it or just leave it open doesn't matter and now to debug I have to go back to the scripts and add-ins command to pick the sample and then instead of run from here a click debug and so machine which I have chrome launches if on a Mac machine then the web toolkit will launch and so here's here's my code running and it's broken at that debugger statement I could add additional breakpoints if I want or just step through my code I'll go ahead and step through here so it's just running through one of the nice things that at least Chrome has I haven't used a web toolkit but I can hover over a variable and it shows me all the properties on that so a product has AZ all of these so I can click this active component I can expand it even and so let's see sketches I can expand that right now there's zero sketches in this file but so that that's nice to be able to quickly see the value of some basic properties but so that's how debugging works here and go ahead and just run that so once it was done it terminated so this isn't a an error or anything's just it's done and there's what it just built all right so I earlier that neither Python or JavaScript has a good solution for dialogues but and that it's not and most cases probably not that critical that a dozen because fusion has kind of built-in dialogs through commands and so commands first of all they can be used by scripts or add-ins there's nothing specific about them that they would be limited to to one or the other and fusion has a very well-defined concept of what a command is and what what that is is so you create what's called a command definition and this command definition has all the information that needs to build to basically create something in the user interface for that and I have down them in the bottom right a little command it's supposed to be a paper airplane but when I scaled it so small it doesn't show up very well but so I created this command definition I gave it the icon I gave it the tool tip I gave it a name I also told it that in the UI you would be represented as a button I could have checkboxes or a list of items to select from so there's kind of different flavors of commands but so I create this command definition and then I use the API to actually create a control the references that definition so I insert it into the user interface and that example below I've inserted it into what's called the navigation toolbar that's where all the the camera and view related functionality is at the bottom of the screen so because this is a camera related command and so I can insert my command anywhere in the UI that I want and then when the user clicks that button fusion creates a command object so inside the API there's a command there's a class called the command and fusion creates one for this particular command and and gives it to you so when you create a command you you connect to an event and so you're notified when your button gets clicked and fusion creates this command and gives it to you so so far the user hasn't really seen anything he's clicked on a button and nothing's happened but you have this command and then on that command object you can create command inputs and in this case to the right this example there's four command inputs the first two are a selection input and the third one is a slider and then the fourth one's a button and so there's several different kinds of command inputs and we're expanding that with the each release what's supported but so you you create these inputs and then once you're finished doing the inputs then fusion automatically builds up this dialog and displays it to the user and then you connect up to some some other events associated with the command and those events allow you to as a user is interacting with the dialogue you get input every time they they change some some value you get an event to let you validate if everything that's required has been provided and so that would determine if the OK button is enabled or not you get an event so you could actually show a preview of the result if you want and that then once it's all done and the user clicks ok then you create whatever that command is supposed to create and fusion automatically knows that all of that APF Dada's part of this command get grouped together and into one undo operation and it's all automatic you don't need to do anything special for that so it makes it you know fairly easy to to build and interact with the you know what can be a fairly complex command and imitation and let me demonstrate this so documentation is available inside fusion so you just go to the regular fusion help there's not a separate link for the API or anything and inside the fusion help there is a table of contents at the bottom there's a programming interface topic and if I expand that and you can see here so there's a welcome to the API what's new in this release and then these three topics a user's manual expand that so this has some overview information and so this would be the place to kind of go and get started so you're writing your first script you know how do you create and debug that so it leads you through what I just demonstrated some basic concepts of the API so that object model and how what are collections and inputs so some things we've talked about here already what are add-ins and how do you create and work with that Innes yeah so these give an overview of these topics and then this reference manual that lists every object that is in that that object model so here all of the objects listed if I expand on one of those and it shows me all of the methods and properties that that has you know it's an clicking will take me to the topic for that object or or here takes me to information for this create by three points method and I see kind of a sample of that in both Python and JavaScript with the tab at the top and then so that's the reference manual and then there are also samples here and there they're linked to from from the other topic so if there was a sample for this crate by three points there would be a link to the sample from there but and then here are just the same samples categorized and so there's JavaScript and Python code for each one that you can just copy and paste into a program and run it to see that that functionality work all right so that's a documentation there's also a fusion API a specific forum and so there's you know you're welcome to post questions there and then there's been some sample scripts posted there from other people outside of the Fusion Development Group and so this is is reasonably active and you know when we watch this very closely so that if you have questions and or just suggestions this would be a good place to go all right so so getting started you know the first thing you want to do is is install Fusion and then start to play with it you know get a feel for you know not with the API yet just the Fusion itself get a feel for what it what it does how it works and then start looking at the API documentation that just described you know probably that that user's manual section I'm just overview of getting started and then start looking at the sample programs so there's the samples that are part of help and then I also quickly showed that there were some samples that you can get to from that the scripts and add-ins dialog and then there's the forum if you have any questions and said look we'd be happy to get input you know we welcome input on on what functionality that that you need that's that's not there yet and so we can help prioritize and so that's that's what I have for today so are there any questions right yep yeah so there I've never actually quite a few questions during the presentation not sure if you just want to scroll through them in the questions area on the on the panel or do not just point out the questions that I couldn't answer so there was for example one question is about cloud API seem to remember we were thinking about providing yeah sort of server-side API right the there's no plans right now at at some point maybe but right now they're there while there is no server version of fusion so it's kind of pointless okay then there was a question what version of Python we have work with fusion API it is Python it's the latest what is it three point whatever it is just going through them why do you need a 3d point while editing an XY plane oh that's a good question so so see sketches in fusion are our 3d though so I'm you're drawing in 3d space so that I could have had a value for Z and it would draw it off of the XY plane it kind of treats the xy-plane is special and so like a circle in that case would be drawn parallel to the xy-plane but and so usually you do draw just in the XY plane but that's not a requirement and a sketchy is a 3d thing uh-huh yeah it was also pointed out that lots of things compile to JavaScript so for example someone is playing with Scala as an example so I guess that meant that you could develop and I think maybe in a another language as well and then that would be translated to JavaScript I haven't played with that but I mean if it if you can end up with JavaScript code it doesn't care where it came from right yeah and then why are the internal units centimeter just like in Inventor that's what the fusion I chose to use what was that based on I seem to remember it was mentioned once that that covers the best with the best Precision's very small and very big objects yeah it's kind of a medium range yeah so you know probably doesn't cover designing you know things for something that would cover a whole city or maybe suffer the micron level or you know it's super tight but for most things it gives good accuracy so yeah which is just a choice they made there none of our other plans for API suppose for the hsm component so they can point there there are plans for that and we started doing some initial investigation but I don't have any any dates right now but but there will be an API for that at some point some people would prefer to see the documentation in a JSON format the documentation they can JSON yeah Marilyn that's what I understood this basically says any plans to release a machine readable version of the documentation on the website right now I'm scraping it to get bad definitions it would be nice to get that in and easier to pass form Jason first time I've ever seen problems ever come up so but it could be done easily the the the documentation internally is actually stored in as XML and then it's gone through a process to now put it into what we see on the web mm-hmm so it could be done if there's that you know a need in a big enough big enough need for it wouldn't be much hot next one are we thinking about adding an eID function on the bodies collection so yeah so there's two two pieces to that well yeah that we are in fact I just SPECT that earlier this week so we should see that the either in the next release or the release after I think but the the one qualification with that is is in this initial version so it it will it would let you create a body from some existing body so you still have to have a body that the part that is inspect yet is being able to create a body from scratch like you could an inventor so that's something we still plan to do too but that will be a little further out so it sort of ties into this the other question is copy paste of body supported in the API no not yet so would that be through the earth on the bodies collection yeah probably that would let you turn can we choose a text editor that would be launched from fusion so not today it's it's it will always use you know spider for for Python and brackets for JavaScript but that that's something that we've talked about and yeah want to change it just hasn't happened yet so that you could you know set a preference and say I want to use my other editor for for JavaScript as my default uh-huh next one how do you read run a script like the Python thing so do you have to go through the menu and the dialogue at the Moomins right yeah today you have to do that that's where add-ins are kind of nice is you can create a UI for it and hopefully fusion will add some support like inventor had where you could you know easily create a button to run a script but but today it's you have to go through the dialogue every time so it's kind of a nuisance so it says it seems that both scripts and headings need to reside locally under using machine keeping with the concept of cloud have any plans to allow you to store them on the server so that I could access them from any machine I want to use fusion from yeah that's a good a good point and that is something we're working on right now is so that when you so you could write a script and and it would it is local but then it would automatically get synced to the cloud so when you go work on another machine that will get pulled down to that machine then you would have access to it so that was a question oh that's her go ahead that is that is in the plans just not right now and that was a question but suddenly I had an idea but anyway so how do you jump into the JavaScript debugger from a command you have to add that a debugger keyword in the code or something with that to it yeah was yeah so you would always want that in the code and and so debugging I guess by a command they mean and so and an add-in that would have a command yes way so yeah so you would just let's see so the in that case so with with add-ins it's optional whether they start at at startup or not so when you're debugging you had set it so it doesn't automatically start when inventor starts so it's just a program sitting out there that's not running and then you would go to the the scripts and add-ins dialog and say I want to you would click the your add in and say I want to debug this and then it would jump in just like we saw I would start debugging that that add in and so it would go through the code where it's creating its commands and adding them to the UI and then it's just gonna sit there and then when I click the button it's gonna hit that event and I can have breakpoints and all of that and and debug it and so there's there is one thing I didn't mention earlier is today debugging with Python there's a couple of issues and they're corrected in the next release and and those issues are documented in both the add-ins topic and the help and also there's a topic there's a two topics and one that's specific to JavaScript and one that's specific to Python just kind of talking about issues with each one and anyway so that's documented there but if a lot of debugging Python though those issues like say are all cleaned up in the next release but there's workarounds in the current release yeah and there's a comment which must be based on something you said but I'm not sure how eyes into your presentation or where where exactly it was set so the comment is that's actually not quite through the initial fetch is really just an HTML page and you can have the JavaScript served from anywhere in fact in the latest version you probably want to serve it from an actual web server not use a file URL because there's an issue with reloading you changed file right yeah you yeah the fusion doesn't care where it came from I mean it's it's but you know if you have well yeah it's up to you I guess where you where you store it and then with respect to take it there I'm not sure I haven't told that one you know what that is yeah you have to talk about it yeah so not working on Mac is that just for development could you create a dialog in Windows using that or and they would work in both operating systems no it's just it's at runtime when there's problems so we it just doesn't work on a Mac and they they've spent quite a bit of time looking at it and haven't figured out a solution so looked at some other potential things in Python also supports some some toolkits to let you use QT which is also a you know popular multi-platform GUI builder and but there's some issues with QT too so you know we haven't found a solution that we can really comfortably recommend that works everywhere unfortunately okay any way to talk over network it would be nice to do some calculations outside fusion HTTP fetches for example well whatever you can do in neither JavaScript or Python I mean you can do so there's nothing in the fusion API to support it but whatever those languages let you do your open to do yeah so other than any classful dozen idea not right now mm-hmm so I I think waiting to see a little bit what ends up happening with the dotnet on Mac now that fusion has now that Microsoft is has opened up dotnet so we'll see and then tying back to the 3d point object so when would you use the point to the object the point 2d is used to return things when you're examining a face and parametric space and the parametric space of a surface is 2d and so points in that case would be returned as 2d but but just general modeling is always going to be 3d so to tease a very kind of limited special case another question so no plans or I guess so no plans on the API to support cam objects well there are plans and and the initial investigation is working with the cam team now and figuring out the you know how to do it but there's no schedule right now mm-hm but I would expect the beginnings to be this year sometime yeah can you talk a bit about quality my experience has been that scripts crash constant yeah well well I've experienced a little bit about that too but so I did I mean the best thing is you know if you're finding something that that's crashing if you could send it to us so we can reproduce it and fix it you know whether it's in the API site or in the fusion site and necessary to add the method to insert the transient object NURBS curve as a fixed curve in a sketch this resolve the problem of communication with external applications or modeling NURBS curves yeah and I just added that and into the at least into the API design last week and so that should show up possibly this coming release but maybe the release after that so this coming and release the the development cycle is is almost done they're supposed to be mostly finished by the end of this week so but there's some stabilization period after that so we'll see how much more can still go in but that that's coming and question on debugging so can you break into the debugger when the add-in is running so I guess the only other is just a window type echo I think you have to start it in debug mode I don't know why I can using matrix three it should be on the panel yeah one one-line high and I can't yeah it's broke oh there you can see it yeah well no again I can only see one line at a time and won't let me okay yeah but when you click on it then there should be a smaller pen around anything oh there we go I moved it off into its own window so now I can see okay you can see it now yeah so we are on the last two questions when using matrix reading uh-huh so this now you might have to say it loud because I don't think first time here so what yeah when using matrix CD for arbitrary transformation when creating on it resulting bodies of the component are broken when you inspect the size is always 0 does it mean that matrix 3d should only be used for translations and rotations but not for scaling skewing yeah I haven't really I've only used it first for translations and rotations but a fusion itself doesn't really support scaling and skewing and so I think in the API we probably need to block that actually we're probably passing it through and fusion just isn't checking it it's always assuming that it won't have scaling or skewing and so it's it's taking it and doing what it can but it's not really set up to handle that so so it should just be translations and rotations so scaling is actually done through a feature there's a scale feature that lets you modify a body so you can't just take an occurrence and create a new occurrence it sort of scale so we we need to limit that make it more obvious being the behavior and so the next one will be scripts and a 360 yeah oh yeah we kind of talked about that so yeah so in the in the future and this is being designed right now as scripts will be pushed up to a 360 and be managed there so that so that when you move to another machine your script you'll automatically have access to it and looks like that's it first yeah so any other questions from anyone all right well thank you for attending and they say the the forum is a great place to learn from what other people are posting but also to post your own questions so if you have think of some more later and Oh what do you think about ez fusion on github so I so for those that haven't seen it it's it's kind of a wrapper over the fusion API to try and make it easier to use and and I think you know in concept I like it I think it's probably just a little too early when the API still still coming so and and a lot of things I mean if there's some things that are really hard to use it would be better to make the fusion API easier to use itself rather than creating another wrapper over the top of it so but I think in concept and what is trying to solve is a good idea so we'll see and there's also question about the recording and and attack so I guess we can just post it on there on both of them on your blog and the ADM dog right yeah just post a link or something yeah and then I'll post a notice pointing probably to the blog on the forum do that it's there so yeah we won't we'll make this available and also there's a question will you pick up some ideas from ez fusion so I guess if you are going to integrate some some of that into NASA yeah yeah sure we can look at what's there and and I mean and besides just what's easy fusion just anybody any comments people have yeah so just again both the presentation material the PPT and and the video will be posted later on on the alien site and on motor machine yeah which is Brian's go so you can find it there as well yes it does seem like we don't have any more questions yeah one more so will action recorder be available so I'm assuming that's like like what you would have in Excel for the bell to record a a macro or script and play a back and and this has been kind of in the plans since we first started designing the API but it's it's in the future and we'll see I I really hope so I hope it happens but kind of we we need almost complete coverage in the API before it's feasible to have have record so we need to wait a little bit for that and so we'll see and will it be in a server approach for a fusion server and and possibly in fusion was kind of designed to be able to support that it doesn't yet but but the it was designed to do it at some point so so we'll see so it's really more of a question not you know on the fusion side rather than API specific so looks like maybe that's it yeah I know again thanks for attending everybody and and good luck playing regions so hey thanks yeah thanks Brad
Info
Channel: Autodesk DevTV
Views: 25,263
Rating: undefined out of 5
Keywords: Fusion 360, Autodesk, Application Programming Interface (Literature Subject)
Id: g0xWqLen7gI
Channel Id: undefined
Length: 77min 51sec (4671 seconds)
Published: Wed Mar 25 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.