likage, perhaps if you told us a little bit about what it is that you want to have happen when you run your code. Tell us about the expected results and what you expect to have happen. Are you looking to import a `.chan` file and have it applied onto a channel of a transform node? Are you looking to make it into a NURBS curve?
At first, I thought your question was about intercepting the import command from the File menu, but that doesn't seem to be the case any more. Until I understand what you are looking for, it's quite difficult to point you in the right direction. On 7 September 2014 15:08, likage <[email protected]> wrote: > Pardon my noob-ness in this. > > Earlier I tried importing, specifically citing for a file format which is > *.chan* > Then as I implemented the bailed-out scenario and your code that you have > written, I got the same set of errors that I have posted previously and I > am not getting any statement etc. > > Still getting the unrecognized file error. > > > On Sunday, September 7, 2014 5:17:09 PM UTC+8, Justin Israel wrote: >> >> What I was saying was that if you are going to use the fileDialog >> approach, as you did, and you see that it returns an error, you would have >> to make sure that you take a look at the API documentation to confirm that >> you are using it properly. In this case, the fileDialog returns an array of >> strings, and you are passing that array to the file() command, which only >> takes a string. So you end up with an error. >> >> Because you are using a fileDialog command that allows the user to choose >> one existing file, you will need first check the filename variable to make >> sure it is set to something and that the user did not cancel the dialog. >> Because the people that designed the Maya cmds API love and value >> consistency, you will notice that if the dialog is canceled you get back a >> None instead of an empty list. Your check would be something like this: >> >> fileList = cmds.fileDialog2(fileMode=1, fileFilter=multipleFilters, >> dialogStyle=2)if not fileList: >> # return or print something or bail out early >> >> filename = fileList[0] >> cmds.file(filename, i=True) >> >> If you are allowing multiple files: >> >> fileList = cmds.fileDialog2(fileMode=4, fileFilter=multipleFilters, >> dialogStyle=2)if not fileList: >> # return or print something or bail out early >> for filename in fileList: >> cmds.file(filename, i=True) >> >> At this point, you have control over knowing which file is being imported >> and having the opportunity of doing pre/post >> >> >> -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/9f367c51-cb0a-4a60-a341-b7addb27e3ae%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/9f367c51-cb0a-4a60-a341-b7addb27e3ae%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- *Marcus Ottosson* [email protected] -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOC%3DYoGU7UHLu8srS_uy0hpFio9SL5iW087%2BMvdVCwRpZQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
