AnsweredAssumed Answered

Face select, for converting to metal sheet Macro

Question asked by Tomas Guglielmini on Apr 2, 2020
Latest reply on Apr 2, 2020 by Tomas Guglielmini


I´m modeling an installation made of sheet metal laser cut and CNC bending. For this purpose I made an assembly with repetitions of parts, and made a cut threw all off them. After that I exported the whole assembly to a part, and then I had saved the solids into unique files.

Thirst of all, I wanted to be sure if this is the best way to achieve my goal, which is making Dxf flat patterns for the laser cut machine. I also would need to make the drawings for bending the sheets.

If I am on the right path, I need to make a macro for converting these solids to metal sheets.

I´m having trouble to make any face selection (it´s doesn't matter for this purpose) in the macro, I´ve tried with SelectByID2 (but coordinates aren't good for this, and either have face named). I have also been trying GetFirstFace, but I think my programming skills are too basic. Could somebody help me with this? 

This is the code I made work when you already have a face of the solid selected.


Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

boolstatus = Part.FeatureManager.InsertConvertToSheetMetal2(0.00125, False, True, 0.001, 0.003, 2, 0.5, 0, 0, False)
Part.ClearSelection2 True

End Sub


I´d attached some images for further explanation. There are 61 solids to be converted, that´s why I need them to be done by a Marco ( I´m using Solidworks macro editor, and running them in #TASK )


Thanks in advance