Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Options

Demonstration: Enhanced Debugger FeatureScript

deDev0deDev0 Member Posts: 5

Yes! The debugger can actually be smooth to use. And with this little trick, you can surgically Debug!

Essentially this involves incorporating the → 'arrow' syntax, and a standard use of Lambdas to bypass the ever abundant "context". Some other functions for println, and colored Debug are also included.

https://cad.onshape.com/documents/1b537493cc24dea3fbea7e56/w/22ee6367e145bb6e2d9b5052/e/d18fee2f2b526d12bc7c0f50

Here are the snippets for easy access. Though the actual document is fully commented.

var c is Context = context;
var clrs = [DebugColor.RED, DebugColor.GREEN, DebugColor.BLUE, DebugColor.CYAN, DebugColor.MAGENTA, DebugColor.YELLOW, DebugColor.ORANGE]; // DebugColor.BLACK

var d = s => { c -> debug(s); return s; };
var dc = (s, clr is DebugColor) => { c -> debug(s, clr); return s; };

var p = (arr is array) => println(arr -> foldArray((a, b) => { return a ~ "\n" ~ toString(b); }));
var pl = (s is string) => println("-=-=-=-=-=-=-=-" ~ (s != "" ? " [" ~ s ~ "] -" : "" ) ~ "=-=-=-=-=-=-=-");

Comments

  • Konst_ShKonst_Sh Member Posts: 62 PRO

    Nice to meet same arrow syntax abuser as myself 😅

    Using for long time an overload of debug function which takes value as first argument and context as second one and returns value.

    export function debugReturn(value, context is Context)

    {

    debug(context, value);

    return value;

    }

Sign In or Register to comment.