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.

Feature script for non-coders

Ben_Ben_ OS Professional, Mentor, Developers Posts: 303 PRO
edited April 2017 in Product Feedback
I wonder if there is any thing like 'record macro' from SolidWorks for Onshape? For us non-coders but who still dabble in coding anyhow, this tool was amazing. It was not used much but when you could put it to use it it was a game changer for me. 

Comments

  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
    @Ben_, unfortunately there isn't a Record Macro feature. However, you can open up the canned OS features and take a look at the FeatureScript within. I've found that to be very useful.
  • leon_pootleon_poot Member, Developers Posts: 87 ✭✭✭
    The closest thing would be what @mahir said. You can find it by right-clicking on a Part Studio tab and selecting "Show Code".
    "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    edited April 2017
    I too agree with mahir & leon, and use other's code to start a featurescript.

    You can re-engineer your part's featurescript, but the code OS creates is difficult for me to follow. I prefer using other's work. 

    There's 2 areas to any featurescript:
    -the input
    -the calculations

    The input is easy.

    The calculation part is more difficult and requires a little linear algebra. I'd recommend reading up on transformations, dot products, cross products and vector math to understand how to make things tick. 

    This is one of the best posts showing many variations of featurescripts:
    https://forum.onshape.com/discussion/comment/17606#Comment_17606

    I still refer to it often.









  • 3dcad3dcad Member, OS Professional, Mentor Posts: 2,475 PRO
    I too think that feature script takes too much to learn from non-coder.. I think it would be easier to dive in with some dialog inputs (like excel functions with dropdown menus) and not need to hassle with units and types in the beginning..

    It's always good practise to learn by altering existing code, but I still get rather frustrated with trying to learn the basics while using minimum time..

    I agree with @billy2 that input is somewhat easy to learn but everything after that.. well, needs some serious concentration to the subject
    //rami
  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    Yea, I've coded in c, c++, C#, Java, etc etc. and this is fundamentally the same, but it has some strange things going on linking between features and sketches, and preconditions.. It's just weird. I know I could figure it out if I gave it a chance, but, weird... I feel like I'm looking at a bastard form of java for some reason.. Where you have to memorize most of the API/classes before you can really do anything.

    I guess I've just been spoiled by C# .net for too long :(
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    Hi, guys...

    To what extent do you think documentation, worked examples, etc would help?

    I have climbed the FS learning curve, and i agree with @john_mcclary . It's a strange version if java that is just different enough and limited enough that it is very hard to learn. 

    There are many cases when the only way to figure out how to achieve something is trial and error. That doesn't so much come from the language, it comes from the lack of visibility to the underlying modelling kernel. 'when I run this code, will it work, or fail with BOOLEAN INVALID'


  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited May 2017
    That doesn't so much come from the language, it comes from the lack of visibility to the underlying modelling kernel. 'when I run this code, will it work, or fail with BOOLEAN INVALID'
    i think if we had access to the stack of parasolid functions in it's native C/C++ the barrier to entry would be much higher and it would have not reduce debuging problems

  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    @konstantin_shiriazdanov your right. It's much better to have FS at the highest possible level. I'm just saying it's wierd. Maybe I need a FS for dummies book or something. 

    I think the biggest challenge for me is not the snytax exactly (pretty close to C style). But the functions and classes. I've been able to read another FS and make things like logoritm circular pattern. But i had to copy the code from the docementation and edit one place. I nailed it on the first rebuild too :). But I could bearly understand the rest of the code is that file. And to start anything from scratch I can't hardly make a sketch object. Like I said if i really sit down and find good examples. I could figure it out.
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    john_mcclary said:
    I think the biggest challenge for me is not the snytax exactly (pretty close to C style). But the functions and classes.
    yep, actually all you need is knowlege of standart library to figure out what FS can do and what can't and a bit of creative itch (don't know if this proverb exist in english :* )

  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    So, given that the language will not be changing, what do you all think is the most helpful way to help inexperienced folks get started?

    If you are a technical person with the interest to learn FS, but have found it to be too hard to learn,  Please vote for one of the options below:

    (1) a list of documented examples

    (2) a series of video lessons

    (3) a cheat sheet with addition tips and tricks for all of them main STD libs (like watch out for this, etc)

    (4) a 'fs for dummies' book or blog series that actually introduces the concepts in the best order suitable for learning

    (5) none of the above is likely to make this easy enough for the vast majority of people



  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    i like (3) item the most - if any function from documentation had a several examples of using. like what pitfalls one may expect if using loops with real iterator, constructing matrices, extracting outer normal direction to the planar face from query...

  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    Honestly the long term would be this:
    https://msdn.microsoft.com/en-us/library/system.string(v=vs.110).aspx

    but a web series would be best. I almost considered starting a "John learns FS" but I don't think people wanna watch me fumble thru trial and error, and reading libraries and other code :)
  • RootentityRootentity Member Posts: 21 ✭✭
    I'd like a big old manual the most.  It's part of the reason PHP is such a great prototyping language, theres a (really) big old manual.
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    I'm learning nodejs from the university of youtube. Seems to be working for me.



    Dave, go for it,



  • michael3424michael3424 Member Posts: 688 ✭✭✭✭
    (2) or (4) for me, though the others would all be useful sooner or later.
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    Thanks for the feedback guys, keep it coming! this is one of those 'what works best for most people' sorts of things so i need data points!
  • 3dcad3dcad Member, OS Professional, Mentor Posts: 2,475 PRO
    I would probably need something like this:
    https://www.w3schools.com/ and http://stackoverflow.com to master in FS.

    Community is already pretty good but answers are too short and not explained properly. In learning sense it's not important to get something done if you don't understand how it works. I know that it is not anyone's responsibility to explain stuff and teach others. And it's great that you most likely get the needed code for free if you just ask since it's usually easier for coders to do it for you than teach you to do it yourself but that's not how you learn.

    Even if there was perfect instructions I would be still struggling if it's worth learning. Ok, I could create some buggy automation to common tasks and that would serve my actual needs to certain point. But I'm afraid that's not enough, I don't wan't to become cad coder I wan't to speed / ease up design work using cad. I hope Onshape does the coding and I can concentrate on flawless design work.

    I don't have anything against FS programming, it's amazing that anyone can code their own features inside professional cad. But nowadays things are spinning too much around FS and too many answers on 'how to' -category are answered with FS. IMHO.


    //rami
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    Lots of interesting things in this thread; I will respond to @3dcad 's concern though: while there's forum activity around FS (and that's great), our core focus remains great interactive CAD.  FS is good for some automation/customization and it is good for workarounds before features are released (e.g., rib, curve pattern, 3D spline were custom features prior to being released as standard features) and we may prioritize issues that do not have an FS workaround available over those that do.  However, programming is not and will not be a requirement for using Onshape as a CAD tool.  In the long run, the need for FS workarounds will decrease and I expect it will be primarily for automation/customization beyond what makes sense for us to build for our entire user base.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • 3dcad3dcad Member, OS Professional, Mentor Posts: 2,475 PRO
    Thanks @ilya_baran for confirming the focus is on CAD. Keep up the good work!
    //rami
Sign In or Register to comment.