Fusion Manage Forum
Welcome to Autodesk’s Fusion Manage (formerly Fusion 360 Manage) Forum. Share your knowledge, ask questions, and explore popular Fusion Manage topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

script time out error

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
leungjcp
791 Views, 11 Replies

script time out error

Hi guys,

 

I get a time out error when the transistion runs my action script.  This is the first time I'm seeing this and the only thing different about this record is the large number of attachments.  There are 33 files attached to this record where I'm taking each attachment and creating a hyperlink for each.  Ususally the file attachment sizes are under 10 but this was an exception.  

 

When I try the same script with say 1 file, it is able to run.  What options can I look into?

 

 

2016-05-31 16:34:31.166Jason Leung (leungjcp)[ECO_Notify_complete (line 136, col 0)] org.mozilla.javascript.WrappedException: Wrapped com.dms.scripting.exceptions.ScriptTimeLimitException: Script ran too long: 10733ms (ECO_Notify_complete#136)
11 REPLIES 11
Message 2 of 12

There is a time limit on script execution. It is hard to say what you
could do differently without seeing your script. You may be able to
optimize it or you may need to choose another approach, such as an on
demand script or other type of behavior. Can you post your script,
without any identifying information, for us to provide assistance?
Message 3 of 12

This seems to be the offending code.

 

for (k = 0; k < arraylength; k++)
{
filename[k] = item.attachments[k].fileName;
fileid[k] = item.attachments[k].fileID;

 

drawing_links[k] = '<html><body><br><div style="text-align: left; padding-left: 200px"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">'
+ '<a href="https://nucap.autodeskplm360.net/servlets/DownloadFile/'
+ filename[k] + '?fileID=' + fileid[k] + '&dmsID=' + dmsID + '&workspaceID=94">Updated Drawing: ' + filename[k] + '</a></font></br></body></html>';


format_link[k] = '<br><a href="https://nucap.autodeskplm360.net/servlets/DownloadFile/'
+ filename[k] + '?fileID=' + fileid[k] + '&dmsID=' + dmsID + '&workspaceID=94">' + filename[k] + '</a>';

}

 

 

When I remove this portion of the code it works fine.  Even if I leave the first line in the for loop, it times out. All I'm trying to do is get the hyperlinks to the attached files....and put them in another work space for others to see.  See image.hyperlinks.JPG

Message 4 of 12
gasevsm
in reply to: leungjcp

Hi Jason, seeing the image...have you considered adding a link to the item attachment tab itself that contains all the files you're looping through? Users will click on one link taking them to attachments tab both ways.

Martin Gasevski | Fusion 360 Team Product Manager
Message 5 of 12
leungjcp
in reply to: gasevsm

Hi Martin,

 

I initially, during development, thought about using the above mentioned method but we utilize reports heavily to see pending tasks.  When Engineering finishes their work, the result are part drawings and multiple records are then created for specific departments to monitor their progress.  In each new record, I write to a field all the hyperlinks for the attachments.

 

Each department point person can now view and have easy access to the drawings through a link in their report.  Here's a sample image.

 

pending.JPG

 

 

Message 6 of 12
leungjcp
in reply to: leungjcp

Bastien helped me today to resolve this issue for now. My script was timing out at around 22 attached pdfs.  We removed "getprintview" line of code which I was not using and it gave me 1 extra pdf for a total of 23 before time out.  For us....it may be an on-going issue.

Message 7 of 12
jpiggee
in reply to: leungjcp

Doesnt look like this was metioned,

 

Another solution you can look into is reducding the over all scirpt and inculding 3 functions,

1. to collect to given information,

2. create the hyperlink

3. to populate the given information to target workspace.

 

This will extened the amount of time you have to run the script overall, provided you with flexibilty on changing the script or adding changes, and you might find it to actual run faster

 

~Joe P

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 8 of 12
leungjcp
in reply to: jpiggee

Hi Joe,

Do you mean create a library script so that my action scripts chains to the library script which would give me more time before the entire script times out? It was mentioned by chaining I would be given more time before timing out?
[http://www.nucapbrakes.com/images/image001.jpg] Jason Leung - Design Engineer
NUCAP Industries Inc.
3370 Pharmacy Avenue, Toronto ON
Ph.416 494 1444 FAX.416 494 2505
Jason.Leung@nucap.com

Please visit us at www.nucap.com www.gripmetal.com



[http://www.nucapbrakes.com/images/banner-nrx.png]
Message 9 of 12
jpiggee
in reply to: leungjcp

Yes,

 

So it would be something like this:

Action script to find the item > pass item and target location to first library

>library script to create the hyperlink > pass hyperlink and target location to second library

>>library script to add to workspace > write information to target item

 

The values you would pass would be

item in question

link to target workspace

 

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 10 of 12
leungjcp
in reply to: jpiggee

Thanks Joe,

 

I will give it a shot and see if there is improvement.  

Message 11 of 12
leungjcp
in reply to: leungjcp

Whoa...so I created a library and I input item.attachments to it.  From there I do all my looping.  The output is a list of hyperlinks.

 

The computation is much faster now.  Visibily the spinning wheel finishes faster.  I was only able to attach roughly 22 pdfs before. Now I am able to attach at least 43 pdfs just by placing my loop in a library script.  

 

Thanks all.

 

 

Message 12 of 12
jpiggee
in reply to: leungjcp

Glad I could help out

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report