Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Featurescript Instantiator
Hugh_Goodbody
Member Posts: 41 PRO
I am looking to write a featurescript using the instantiator to build configured hydraulic cylinders. I have made the configured parts of the cylinder such as pistons, endcaps, ports etc.
I now want to use featurescript to build cylinders. I assume that the instantiator is the way to go. Is there any documentation or examples on how to use the instantiator - as I haven't used the feature yet?
0
Comments
const instantiator = newInstantiator(id + "inst", {});<br><br><br> //Instantiate Port<br> addInstance(instantiator, port::build, { "configuration" : { "Name" : "RP092A" }, "transform" : transform(vector(-capPortPos, 0, portVertPos) * millimeter) });<br> addInstance(instantiator, port::build, { "configuration" : { "Name" : "RP092A" }, "transform" : transform(vector(rodPortPos, 0, portVertPos) * millimeter) });<br> <br> //Instantiate Cap<br> addInstance(instantiator, endPlug::build, { "configuration" : { "Name" : endPlugConfig }, "transform" : transform(vector(-capPos, 0, 0) * millimeter) });<br><br><br><br> // repeat the above as necessary<br> instantiate(context, instantiator);<br> // This call actually brings in the bodiesaddInstance(instantiator, customBoss::build, { "configurationOverride" : {"Bore" : 12.1*millimeter, "OD": 50*millimeter, "Length" : 25*millimeter}, "transform" : transform(vector((pinBossPos+50), 0, 0) * millimeter)});