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.

How to Copy a Part with featurescript

patrick_farleypatrick_farley Member Posts: 32
Hi, i am trying to make a feature script that could make a Wall or 2x4 for a house.
i was able to make the script that built the 2x4 and name it, but i have a hard time figuring how to repeat the part.

i try to repeat the sketch with an offset, but i have to create a new sketch with a new variable name each time and i don't know how to put that in a for loop (creating name of a variable depending on the counter of the for next loop).

check the 2x4,  at if (definition.size == Size.X204)


i am able to repeat all the code with an offset, but i don't thinks that make sense if i what 32 times  2x4

Thanks for the help
Pat F








Best Answer

Answers

  • MBartlett21MBartlett21 Member Posts: 1,501 EDU
    You can use opPattern
    MB - I make FeatureScripts: view FS (My FS's have "Official" beside them)
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 910
    Eduardo is correct -- that will fix the immediate issue, but I would second Morgan's recommendation for opPattern -- it will work faster.
    Ilya Baran \ Director of FeatureScript \ Onshape Inc
Sign In or Register to comment.