Convert to sheet metal in a function library or macro

Hello

I'm looking to integrate the volume conversion function into a library function, but it doesn't seem possible in SW2016 anyway. Is there a trick to know or an alternative macro type solution, which would allow in a single click to combine several bodies and convert the resulting body into sheet metal, by doing an automatic search for pre-existing folds?  Thank you in advance.

Hello

Can you make us a screenshot of your play because I'm not too sure what you mean. But try the insert folds feature; With one click this function recognizes folds.

1 Like

Already in order to combine bodies it must be

Of the same material

that intersect

Are your parts multibody or are they manufactured independently?

Your macro must also be able to make coffee?

@+ ;-)

4 Likes

Hello

Here is the instruction to use to convert to sheet metal:

InsertConvertToSheetMetal2

The help page:

http://help.solidworks.com/2015/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IFeatureManager~InsertConvertToSheetMetal2.html

An example: 

http://help.solidworks.com/2013/English/api/sldworksapi/Insert_Convert_to_Sheet_Metal_Example_VB.htm

To combine the bodies in VBA, see here:

InsertCombineFeature

http://help.solidworks.com/2015/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IFeatureManager~InsertCombineFeature.html

http://help.solidworks.com/2016/English/api/sldworksapi/Combine_Bodies_Example_VB.htm

wow, 3 answers from the top 3 contributors ...  Sorry, I hadn't seen them, I forgot to subscribe to my own question (it's a shame that as a question poster you are not automatically subscribed, but that's not the debate). So to illustrate, here are the steps of what I try to do with assistance (because I need a lot of it on several projects):

I start with a central body like a pole. I also have two profiles of the same thickener located in somewhat random places in space. The objective is to connect them to each other and then to the pole, to finally take out the unfolded sheet metal that meets all these conditions.

So, through function libraries, I link all the bodies properly. All that remains is to combine them (because if I merge during the links, SW merges the pole too), then convert it into sheet metal.

After that, I still have some work to do, I have to rename the body in sheet metal in order to extract it automatically and make it a flat in dxf. So my initial question is not yet at the level of making coffee, but it is still far from the final goal. ;-)

That is the full explanation. To go faster (I have about twenty bodies like that to create and lay flat on each file), I opted for the function library that makes the connections for me. Now, I pretty much master that. But once the body is merged, it cannot be converted to sheet metal in the same function library. And since I still have a lot of actions to perform behind it, if the function library doesn't allow it, why not go through a macro. The disadvantage of macros is that I don't see in the code how it can handle the flattening without me indicating the edges unitedly, which I absolutely want to avoid (too long). I do not find in its coding the automatic search for pre-existing folds.

I hope I have enlightened you on the objective and the problems, now I subscribe to my subject to respond more quickly to your many enlightened advices ;-)).


2016-04-08_13h38_27.png
1 Like

A link that can help you for the esport of flattening:

http://gupta9665.com/export-sheet-metal-part-configurations-as-dwg/

Otherwise, you'll have to know where exactly you're stuck in the macro.

If you merge during the bindings, SW fuses the pole too. Then you create a config without the post  and then you convert it into sheet metal. Doesn't it work?

The idea is to be tested, but since I have "library function impossible to apply" errors 1 time out of 2 when I merge, I abandoned the idea. It must be said that depending on the profiles, as my fittings are tangent to the pole, I have very delicate and random fusions.

1 Like

And if you leave a little play between your future sheet metal part and the post, like 0.01 (making a plan so that you can say up to and select it instead of the surface) so that it can't merge.

I can't make an offset plane, the sketch of my function hangs on the meeting point between the sketch plane and the edges of the column. Knowing that this pole is a construction welded on a 3D sketch, so it is difficult to shift...  And I would of course like to limit as much as possible the number of references to click for my library of functions.

The "combine" part seems less problematic to me than the conversion to sheet metal that I can't set up:

Is there a trick to replace the references used in the conversion function with references that I designate, limiting myself if possible to the basic plan of the sheet metal function, and that the search for pre-existing folds is automatically activated? I tried using the body selection macro combined with the conversion function, but I'm a little too slow in terms of programming to get there. This macro assumes that the body or a face is selected before applying the macro, I would rather that the macro asks me to select the plane before applying the conversion and if necessary, select the face and edges to do this conversion. And at the top, that she asks me to select beforehand all the bodies to be merged to make everything except the coffee ;-).

I find good tutorials to fill feature parameters with userform, but not to make selections of bodies, faces, edges or other necessary for functions such as conversion to sheet metal or combine.

Thank you again for your advice.

In fact you are looking for a quick way to convert to sheet metal without selecting the folds but just the face. Try to see the inserted function of the folds, this function recognizes the sharp edges and converts them to sheet metal just by selecting the face. To create this macro you have a new macro recorded and you do all the operations manually and you finish recording it. Then you'll see what happens.

1 Like

Interesting, this last proposal, I had always used (wrongly) the "convert to sheet metal" function instead of "insert folds". The good news is that it worked that way. The first bad thing is that by applying the method twice in a row with exactly the same parameters, the first time it worked, the second time, SW told me that the folds could not be created. Maybe in SP3... I read that another user complained about the sheet metal under SW2016 in SP1 and to a lesser extent in SP2. The second bad news for me is that "insert folds"  still can't fit in library function. Grrrr. So forced to go through a macro.

Here's what it would look like:


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.Extension.SelectByID2("", "FACE", 1.71659798004902, 0.3562399999999957, -0.21627010114517, False, 0, Nothing, 0)
boolstatus = Part.InsertBends2(0.001, "", 0.5, -1, True, 0.5, True)
Part.ClearSelection2 True
End Sub
 

It remains to be found how to replace the "face" and all its positioning arguments with a "select face" interaction .

To be continued... Thank you Manu for this first idea, it remains for SW to make the function stable (I'll take the time to make a video and send it to support in the weekend), it will already be a step forward.

OK it works, I hope you'll succeed and happy to have been able to help yourself a little in the process. ;-)