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.

Get rid of an AutoCAD VBA program by using Onshape

EricGauthierEricGauthier Member Posts: 73 ✭✭✭

We have an AutoCAD VBA tool which we would like to get rid of by developping an Onshape tool.

The tool processes for laser cutting dwg files named like:
_XX-XXXXX-XX_material_thickness.dwg

Here is what the tool does:

1) Once the file is opened in AutoCAD, we run the program and it starts by reading the material and thickness indicated in the filename.
2) It finds in a hard coded list what is the smallest hole diameter the laser will be able to cut in regard of the material and thickness.
3) It identifies all the circles too small for laser cutting on the drawing.
4) It draws a 1/2" yellow cross at the center of all the too small circles.
5) It deletes all the too small circles from the drawing.
6) It saves the drawing while removing the underscore at the beginning of the filename.

Note that we need to manually erase all counterbore and countersink circles before we run the program.

We thought a little bit how we could do that using Featurescript but there are many things we can't achieve only using Featurescript. We think the API could help us but we don't know a lot about it.

Anybody can help?

Comments

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @EricGauthier

    I think this could be easily achieved in FeatureScript.

    Mapping your steps to things a Custom Feature could do:

    1) enter the material and thickness as parameters to the feature, store it previously in a variable, or in some other way provide it to the feature
    2) program the hard coded list into the custom feature so that it can use the inputs to look up the smallest hole possible
    3) Identify all the cylindrical faces whose radius is smaller than smallest possible hole
    4) create a cross-shaped sheet body at the top of the error cylinders and color them yellow
    5) call delete face on all of the identified cylinders
    6) -- (this might have to become a manual step, but one option that FeatureScript can do is set a new part name) 

    Bonus: you could also probably identify the counter-sink and counter bore and delete them along with the cylinders automatically

    Happy to work with you on this if you would like to try it out and need some guidance.
    Jake Rosenfeld - Modeling Team
Sign In or Register to comment.