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.
center path finder feature
yarin_amiras
Member Posts: 1 ✭✭
Hi I have a problem with my script.
I wrote a script that finds and adds the center path of a given body. So its the center between two given edge paths on the body as well.
However I encountered an error and it didn't work, would appreciate any help! thanks.
The blue body was created using a wiring feature.
Wiring feature:
My script:
Tagged:
0
Comments
I know this doesn't help fix your problem, but if you need centrelines, you can use this:
https://cad.onshape.com/documents/cec835eb44a6b55666a42a85
I looked at your code shallowly and noticed a few things:
you have two same for loops after each other. perhaps you could combine those actions into one. You won't even need the first arrays of points because you can just use the poinst to create the center point and store only that in an array. may provide better performance.
you're making a sketch plane based on edge one. did you use a debug feature to show that sketch? because I'm not sure how it will be oriented.
more fundamentally, your center points are not necessarily on a plane, so the sketch spline wouldn't be the best way to go. perhaps a 3d spline is a better option, disregarding the sketch (and plane) all together.
I believe there's something about using variables in a for loop that requires them to be boxed. can't find the documentation quickly. must have been in the self-guided course on featurescript. https://cad.onshape.com/FsDoc/variables.html