Is there a cmd line sort of way to debug new ulp scripts and show my own debug lines

Is there a cmd line sort of way to debug new ulp scripts and show my own debug lines

mjstn2011
Advocate Advocate
107 Views
4 Replies
Message 1 of 5

Is there a cmd line sort of way to debug new ulp scripts and show my own debug lines

mjstn2011
Advocate
Advocate

The language of the ULP scripts is basic enough to understand.

Because I am trying to develop an improved BOM ulp it is complex enough to want to output lines to see what is in different variables or to output lines to see what I am doing.

 

There is mention in web hits for fusion360 ulp scrips of ways to run a sort of console but I feel like many other web hits that is 'ancient' info as I cannot find utilities - add ons or anything like that in current fusion 360.

 

HOW can I modify and develop my own ULP scripts?  Have I just missed some obscure menu pick or is this not really possible yet?

 

The things I would like is to see my own 'printf' sort of putputs and to pause or at least delay so I can see the printfs.   

 

So far I am blind and just run it and see what it does but the bom scrip is not at all 'friendly' in terms of explaining the data structures and what it is doing so I really need 'printf' sort of debug.  

I don't expect trace or other things like breakpoints but ANYTHING is way better than totally blind try and fail approach.

 

Thanks, Mark

0 Likes
108 Views
4 Replies
Replies (4)
Message 2 of 5

chuck_toddN7PTC
Advocate
Advocate

This is how I do debug in ULPs.

 

I output print text to a file called _Debug.txt

I can turn the debugging on/off by DbugTrace = 1 or DbugTrace = 0, respectively.

 

I place the IF statement through the code to be able to trace what's going on.

Hope this helps.

 

int DbugTrace = 1;

 

if (DbugTrace)
{
output("_Debug.txt", "at"){printf("Debug Trace =  %s\n", EAGLE_DIR);}
}
 
if (DbugTrace)
{
output("_Debug.txt", "at"){printf("Debug Trace = %d\n", 4);}
 
BR -Chuck

 

Chuck
0 Likes
Message 3 of 5

mjstn2011
Advocate
Advocate

Thanks @chuck_toddN7PTC .  I often do this approach in other environments with no debugger using a debug flag that is composed of sometimes one bit per area I want debugs.    I thank you for the syntax to use in the ULP environment as a head start.

 

Have you discovered some form of 'sleep for x seconds' call that can be used in these ulp scripts?   

0 Likes
Message 4 of 5

jorge_garcia
Autodesk
Autodesk

Hi @mjstn2011 ,

 

Here's the debug library I tend to use to see how the design is running, it kind of works like setting breakpoints. You include it in the file you are interested in testing and then just patch the variables you want to review to the debug functions. When the ULP hits the debug function a dialog will pop up showing you the value of interest and then you can click OK to allow the ULP to continue running.

 

Best Regards,



Jorge Garcia
​Product Support Specialist for Fusion 360 and EAGLE

Kudos are much appreciated if the information I have shared is helpful to you and/or others.

Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.
0 Likes
Message 5 of 5

chuck_toddN7PTC
Advocate
Advocate

@mjstn2011 

 

Here is what I found.

chuck_toddN7PTC_0-1757338077386.png

 

If you don't already have it. I have attached the ULP programming reference document.

 

BR -Chuck

Chuck
0 Likes