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

Request for help - FeatureScript

grzegorz_kondrackigrzegorz_kondracki Member, Developers Posts: 23 PRO
I start the adventure with featureScript and I have some problems, questions.
1. The problem with opDelete - It works but erases part. The second time running.
2. Can you simply do - make a hole. I was creating a solid and subtract. - I tried to remove with the extraction of but it did not work.
4.Where can I find a simple description of examples featureScript?
5. Can I change the name of the part - I would like to give the diameter and length of the pin.
link 
https://cad.onshape.com/documents/fb600dd4023c7ba3b66138e3/w/d954121ade68e4ba7ba40c57/e/459ab1ca3f1ea6d53b3b16ec

I am very please with the comments that I have to improve.

p.s. 
I completed beam of different profiles - steel profiles of L, C, HEA, HEB, HEM, round tubes, etc. - If there is a desire from the use of this library for free. I would have to change into English.

Grzegorz (Greg) Kondracki

Comments

  • Options
    kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited March 2017
    1. FeatureScript id's are hierarchical, so if you do qCreatedBy(sketchId), you'll also get qCreatedBy(sketchId + "revolve1"). I suggest changing the id of your revolve to id + "revolve1" (in two places)
    2. Making a solid and subtracting is a perfectly reasonable way to go. Performance-wise, it's actually ideal, since those two operations happen at a low level every time you do an operation with options "add", "remove", etc.
      If you want a interface which does both in one function call you can call the extrude feature.
    3. <attempt to dereference non-container undefined>
    4. http://www.onshape.com/featurescript has a healthy heap of FeatureScript examples. Beyond examples, all documentation FeatureScript is kept under https://cad.onshape.com/FsDoc/
    5. You can't change the name of a Part with FeatureScript (yet!). However, you can set the name of a feature to a template that includes custom values (set with setFeatureComputedParameter). For an example of this, see this fork of the "Measure distance" feature, which includes the distance in the feature name:
      https://cad.onshape.com/documents/58bde11a15a35b0f811476f6/w/537eeab94735cbe746d2a0d9/e/a9914b1afced59fe46558190
  • Options
    grzegorz_kondrackigrzegorz_kondracki Member, Developers Posts: 23 PRO
    Thank you very much for the advice, I will test and write what results

    Grzegorz (Greg) Kondracki

  • Options
    grzegorz_kondrackigrzegorz_kondracki Member, Developers Posts: 23 PRO
    I thank you very much for your help. I read a, I now understand more. Everything works as it was working.

    I have one more question. I have onshape part of such variables  x and y.
    These variables I calculate in another program in python. I would now like to send it to the model in Onshape. Automatically model will improve and I would like to automatically change the drawing and then download the pdf.
    Is it possible? 

    Grzegorz (Greg) Kondracki
  • Options
    NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,396
    @grzegorz_kondracki you can import the data in CSV format into another tab and have your FS read that, but you cannot connect your Python program directly to your Onshape account using FeatureScript - you would have to use the REST API.

    Senior Director, Technical Services, EMEAI
  • Options
    grzegorz_kondrackigrzegorz_kondracki Member, Developers Posts: 23 PRO
    I would like to take advantage of Rest API but is not anywhere about how to do it. Rest API suits me very well.
  • Options
    Jason_SJason_S Moderator, Onshape Employees, Developers Posts: 210
    edited March 2017
    @grzegorz_kondracki,
     
    To access our APIs:
    1. Go to the Dev Portal
    2. Sign the agreement
    3. Go to the Onshape App Store
    4. Subscribe to the API Explorer app
    5. Go in a document, press the (+) button and add the API Explorer to your document
    6. Explore!

    Best of luck!
    Support & QA
  • Options
    grzegorz_kondrackigrzegorz_kondracki Member, Developers Posts: 23 PRO
    I thank you very much for your help. now I understand everything.

    Grzegorz (greg)
Sign In or Register to comment.