Self written script not working anymore after update, might this be a bug?

Self written script not working anymore after update, might this be a bug?

gvbeek
Participant Participant
521 Views
1 Reply
Message 1 of 2

Self written script not working anymore after update, might this be a bug?

gvbeek
Participant
Participant

Hi there, 

 

After the latest update a self written script is not working anymore as it did before.

 

note: I actually can't really write code in python, so I just puzzled some stuff together and it worked perfectly before, and now it does not. Also I read all the API changes in the update list as well, and could not find a change in the commands I used in my script. Though there were some changes which involves selecting things, so therefore I thought maybe something got a bit messed up? Also a befriended coder had a look at it he also could not figure out what was going wrong here.

*Since I never write code in Python, there is still a lot of bloat, still need to clean it up. 

 

Here is the part of the code where it goes wrong. The message box appears. But after that i can't select a plane, skips this step and runs the code over and over.

 

ui.messageBox('select a plane')
selecteditem1 = ui.selectEntity("Select a plane", "ConstructionPlanes")
selecteditem1Value = selecteditem1.entity
 
When I cancel I get this error message:
 
Screenshot 2020-08-19 at 18.04.48.png
But what I think this means is that it is basically telling me that I did not select anything. (But there was never a moment where I could.) 
Also after this fusion crashed completely.
 
Happens both on Windows and Mac.
 

Though I used these lines in two scripts, and in one of the two it is still working.

I added the two scripts in a zip file. To get it working edit name of the .py files and remove everything after and including the "+". And install this in the appropriate destination.

 

Note: the still-working script is a prior version to the not-working one. This does not include adding a button in a menu.

 

The intention of this script is to draw rectangle steel profile tubes super quick, I need to draw these often therefore I thought let's script this.

When you activate the script pressing on the SteelProfileGen button you put in width height and length of the tube and material thickness. Then you should select a construction plane and voila, it draws it for you, and names the component to its dimensions. Worked like a charm, especially when you make a 2d drawing afterwards, you have all the parts you need in a table. 

 

This is what it looks like when it works correctly:

Working.png

 

Thanks for reading, hopefully I'm not wasting anybodies time!

 

 

Kind regards, 

 Goof

 

 

 

0 Likes
522 Views
1 Reply
Reply (1)
Message 2 of 2

goyals
Autodesk
Autodesk

ui.selectEntity function is not designed to work in a command. Not sure how it was working earlier. May be you can consider to use a command dialog to gather all inputs. Please take a look at http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-8B9041D5-75CC-4515-B4BB-4CF2CD5BC359. Thanks.



Shyam Goyal
Sr. Software Dev. Manager