ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
AVAlin Vargatu20/06/2018

UPDATE: Submit your ERs for this new functionality here: . These are not SW ERs, but Artem ERs.   At least for now.

Hello SOLIDWORKS Power-Users and welcome to the 17th SWPUC.

This is the first SWPUC dedicated to SOLIDWORKS Programmers!

Many thanks to ​, , and for their donations in support of this challenge.

This week we endeavor to add missing functionality to SOLIDWORKS. In the past years, SOLIDWORKS has added great functionality for automatically calculating rectangular shaped stock. The new Bounding Box and the Stock functionality in the Costing modules are very good tools.

That being said, users need a streamlined experience for getting stock in the shape of round bar. This Challenge is all about finding the perfect solution for this problem.

For 10,000 points and eternal glory write the best macro possible to generate the Round Bar Stock for Pins, as described in this video (also attached):

https://youtu.be/kCmJr9OUh8I

A special award of 3,000 points will be awarded to the participant who will post the first macro that solves this problem.

More details:

1. Download and unzip the Pins in Parasolid Format.zip file.

2. Use the files as test files for your macro

Expected User Input

3. The macro should ask the user to select a planar face

4. The macro should ask the user to select a cylindrical face

5. The macro will give the user the option to select between 3 options (radio buttons?): 0, 1/16, 1/8.

  • if the user is running the macro for the first time, the default value is 0 (zero)
  • if the user has run the macro before, the default value is the last input value

6. The property manager of the macro will have a checkbox called Stock Visible

  • if the user checks the box, a custom property StockVisible is created with the value 1
  • if the user unchecks the box, a custom property StockVisible is created with the value 0 (zero)
  • if the user is running the macro for the first time, the default value is 0 (zero) = box unchecked
  • if the user has run the macro before, the default value is the last input value

That should be all the user is expected to input.

What the macro does

7. Adds a custom property called StockStep with a value equal to 0, or .0625, or .125, as per the users input at step 5

8. Opens a sketch on the planar face selected

9. Draws a circle that is concentric with the cylindrical face selected at step 4.

10. The diameter of the circle will be the smallest that would completely encompass the projection of the solid body on the sketch plane, rounded up to the closest fractional value defined by the StockStep value.

Suggestion: Use the BoundingBox feature in SW 2018.

Examples:

  • Smallest diameter = 1.033"
  • StockSize = 0 => Diameter = 1.033"
  • StockSize = .0625 => Diameter = 1.0625"
  • StockSize = .125 => Diameter = 1.125"

11. The diameter remains parametrically linked by equation to the bounding box (that is why I suggest using the bounding box feature; to maintain the parametric link), or the projection of the body on the sketch.

12. The user can edit the features before this sketch, or can edit the StockSize custom property value, at any time, and the circle should update as expected.

13. The sketch will be extruded in both directions to ALL, with the Merge option unchecked.

14. The new feature, and the new solid body will be called Stock

15. The new solid body will be hidden if the StockVisible value is 0 (zero)

16. The new solid body will be visible if the StockVisible value is 1

17. A custom property named StockDiameter will be parametric linked to the diameter of the stock cylinder body and expressed in inch.

18. A custom property named StockLength will be parametric linked to the length of the stock cylinder body and expressed in inch.

19. The macro should run in SOLIDWORKS 2018, SP 3.0

Note that the document units are set to mm, but custom properties are to be expressed in inch.

Please submit your macros before 12 pm DET, on Wednesday, the 3rd of July, 2018. Note that any macro submitted to this challenge will be considered donated to the SOLIDWORKS Community.

Judging criteria, in no particular order:

1. Efficiency. Does the macro follow the workflow listed above?

2. Robustness (remember the rebuild expectations)

3. Speed of execution

4. UX (User Experience)

  • Elegant property manager (or other input methods)
  • Minimize mouse travel
  • Minimize user interactions

5. Efficient code

6. Elegant code

7. Fully annotated code

8. Originality

9. Using SOLIDWORKS functions in a new, unexpected way.

10. Speed. Be the first to post a functional macro and get an award.

Good luck to all!

UPDATE: New TEAM Competition

If you can significantly improve code already posted by your competitors, if the finalized code wins, all of you would be declared winners in a new TEAM section.

All members of the team will receive power-user certificates and will decide how to divide 10,000 points between themselves.

So, if you need help with parts of your macros, post them here and ask for members to join your team and help out.