Hide Table of Contents

Convert Extrusion to Sheet Metal Example (C#)

This example shows how to convert a solid body to sheet metal.


//--------------------------------------------------------------------------
// Preconditions:
// 1. Open <SolidWorks_install_dir>\samples\tutorial\api\sweepcutextrude.sldprt.
// 2. Open an Immediate Window.
// 3. Rename the namespace of this macro to match the name of your C# project.
//
// Postconditions:
// 1. Boss-Extrude1 is converted to sheet metal containing two rip edges.
// 2. The FeatureManager design tree now contains:
//    * Sheet-Metal1
//    * Convert-Solid1
//    * Flat-Pattern1

// NOTE: Because the part is used in SolidWorks tutorials,

// do not save any changes to it.
//
//-------------------------------------------------------------------------
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System;
namespace InsertConvertSheetMetal_CSharp.csproj
{
    
partial class SolidWorksMacro
    {

        
public void Main()
        {

            
ModelDoc2 swDoc = null;
            
bool boolstatus = false;

            swDoc = (
ModelDoc2)swApp.ActiveDoc;
            boolstatus = swDoc.Extension.SelectByID2(
"", "FACE", -0.008205131831119, 0.02357994168915, 0.03366815886659, true, 0, null, 0);
            boolstatus = swDoc.Extension.SelectByID2(
"", "EDGE", -0.004077318654993, 0.02376323764372, 0.04987547143355, true, 1, null, 0);
            boolstatus = swDoc.Extension.SelectByID2(
"", "EDGE", 0.02890215593544, 0.02392631827274, 0.03020230805026, true, 1, null, 0);
            boolstatus = swDoc.Extension.SelectByID2(
"", "EDGE", -0.007010951021414, 0.02376186282277, -0.0001235945334201, true, 1, null, 0);


// Convert extrusion to sheet metal of thickness=13mm,

// bend radius=0.5mm, rip gap=2mm, relief type = rectangular,

// relief ratio = 0.5, rip edge overlap type = open butt, and

// rip edge overlap ratio = 0.5, do not keep bodies
            boolstatus = swDoc.FeatureManager.InsertConvertToSheetMetal2(0.013, false, false, 0.0005, 0.002, 0, 0.5, 1, 0.5, false);

            swDoc.ClearSelection2(
true);
        }


        
public SldWorks swApp;


    }
}



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Convert Extrusion to Sheet Metal Example (C#)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2012 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.