Hide Table of Contents

Insert Sheet Metal Base Flange Example (C#)

This example shows how to insert a sheet metal base flange.

//---------------------------------------------------------------------------------
// Preconditions: Verify that the specified part template exists.
//
// Postconditions:
// 1. Creates two boss extrudes and converts them to sheet metal parts.
// 2. Inserts a sheet metal base flange that connects the two sheet metal parts.
// 3. Examine the graphics area and FeatureManager design tree.
//---------------------------------------------------------------------------------
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System;
 
namespace Macro1CSharp.csproj
{
    partial class SolidWorksMacro
    {
        ModelDoc2 Part;
        bool boolstatus;
        long longstatus;
        int status;
 
        public void Main()
        {
            longstatus = (long)swApp.ResetUntitledCount(0, 0, 0);
            Part = (ModelDoc2)swApp.NewDocument("C:\\ProgramData\\SOLIDWORKS\\SOLIDWORKS 2016\\templates\\Part.prtdot", 0, 0, 0);
            swApp.ActivateDoc2("Part1"falseref status);
            Part = (ModelDoc2)swApp.ActiveDoc;
 
            Part.SketchManager.InsertSketch(true);
            boolstatus = Part.Extension.SelectByID2("Front Plane""PLANE", -0.07320616684915, 0.04378582530511, 0.008882453015985, false, 0, null, 0);
            Part.ClearSelection2(true);
            object vSkLines = null;
            vSkLines = Part.SketchManager.CreateCornerRectangle(-0.09520523544121, 0.05740695090967, 0, -0.03844330645187, -0.0429584598942, 0);
            Part.ShowNamedView2("*Trimetric", 8);
            Part.ClearSelection2(true);
            object myFeature = null;
            myFeature = Part.FeatureManager.FeatureExtrusion2(truefalsetrue, 0, 0, 0.01, 0.01, falsefalsefalsefalse, 0.01745329251994, 0.01745329251994, falsefalsefalsefalsetruetruetrue, 0, 0, false);
            boolstatus = Part.Extension.SelectByID2("""FACE", -0.0785775433435, 0.01894373057962, 0, true, 0, null, 0);
            boolstatus = Part.FeatureManager.InsertConvertToSheetMetal(0.002, falsefalse, 0.004, 0.002, 0, 0.5);
            Part.ClearSelection2(true);
 
            boolstatus = Part.Extension.SelectByID2("Front Plane""PLANE", 0, 0, 0, false, 0, null, 0);
            Part.SketchManager.InsertSketch(true);
            Part.ClearSelection2(true);
            vSkLines = Part.SketchManager.CreateCornerRectangle(-0.02256810687936, 0.06039039042219, 0, 0.02390260459754, -0.04039198125838, 0);
            Part.ClearSelection2(true);
            myFeature = Part.FeatureManager.FeatureExtrusion2(truefalsetrue, 0, 0, 0.01, 0.01, falsefalsefalsefalse, 0.01745329251994, 0.01745329251994, falsefalsefalsefalsetruetruetrue, 0, 0, false);
            boolstatus = Part.Extension.SelectByID2("""FACE", 0.0009118315510932, 0.02609254832731, 0, true, 0, null, 0);
            boolstatus = Part.FeatureManager.InsertConvertToSheetMetal(0.002, falsefalse, 0.004, 0.002, 0, 0.5);
            Part.ClearSelection2(true);
 
            Part.SketchManager.InsertSketch(true);
            boolstatus = Part.Extension.SelectByID2("Front Plane""PLANE", 0, 0, 0, false, 0, null, 0);
            Part.ClearSelection2(true);
            vSkLines = Part.SketchManager.CreateCornerRectangle(-0.05411927414525, 0.01318437124604, 0, -0.007403979976402, -0.001979918613586, 0);
            CustomBendAllowance customBendAllowanceData = null;
            customBendAllowanceData = null;
            myFeature = Part.FeatureManager.InsertSheetMetalBaseFlange2(0.002, false, 0.004, 0.02, 0.01, false, 0, 0, 1, customBendAllowanceData, false, 2, 0.0001, 0.0001, 0.5, truefalsetruetrue);
            Part.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:   Insert Sheet Metal Base Flange 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) 2017 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.