Hide Table of Contents

Insert Extruded Reference Surface Example (C#)

This example shows how to insert an extruded surface into a model.

//---------------------------------------------------------------------------
// Preconditions:
// 1. Verify that the specified Part template exists.

// 2. Rename the namespace of this macro to match the name of your C# projecct.
//
// Postconditions: Boss-Extrude1, Surface-Extrude1,

// and 6 Solid Bodies are in the FeatureManager design tree.
//------------------------------------
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System;
namespace InsertSurfaceExtrude_CSharp.csproj
{
    
partial class SolidWorksMacro
    {

        
ModelDoc2 Part;
        
bool boolstatus;
        
int longstatus;

        
void Main()
        {

            Part = (
ModelDoc2)swApp.NewDocument("C:\\ProgramData\\SolidWorks\\SolidWorks 2011\\templates\\Part.prtdot", 0, 0, 0);
            swApp.ActivateDoc2(
"Part1", false, ref longstatus);
            Part = (
ModelDoc2)swApp.ActiveDoc;
            
ModelView myModelView;
            myModelView = (
ModelView)Part.ActiveView;
            myModelView.FrameState = (
int)swWindowState_e.swWindowMaximized;
            Part.SketchManager.InsertSketch(
true);
            boolstatus = Part.Extension.SelectByID2(
"Front Plane", "PLANE", -0.03891024234798, 0.02968528649877, 0.0003646590412283, false, 0, null, 0);
            Part.ClearSelection2(
true);
            
object vSkLines;
            vSkLines = Part.SketchManager.CreateCornerRectangle(-0.05517876768764, 0.008130204900836, 0, -0.02399076855985, -0.0155939995639, 0);
            Part.ClearSelection2(
true);
            vSkLines = Part.SketchManager.CreateCornerRectangle(-0.003731897331531, 0.008130204900836, 0, 0.0285223581767, -0.02998846069981, 0);
            Part.ClearSelection2(
true);
            
SketchSegment skSegment;
            skSegment = Part.SketchManager.CreateCircle(0.053579, 0.013995, 0.0, 0.06819, 0.018462, 0.0);
            Part.ClearSelection2(
true);
            Part.SketchManager.InsertSketch(
true);
            Part.ShowNamedView2(
"*Trimetric", 8);
            Part.ClearSelection2(
true);
            boolstatus = Part.Extension.SelectByID2(
"Sketch1", "SKETCH", 0, 0, 0, false, 0, null, 0);

            
Feature myFeature;
            
FeatureManager myFeatMr;
            myFeatMr = Part.FeatureManager;
            myFeature = myFeatMr.FeatureExtrusion2(
true, false, false, 0, 0, 0.05, 0.01, false, false, false,
            
false, 0.01745329251994, 0.01745329251994, false, false, false, false, false, false, false,
            0, 0,
false);

            boolstatus = Part.Extension.SelectByID2(
"", "FACE", -0.03303425584835, -0.002425135081921, 0.04999999999995, false, 0, null, 0);
            boolstatus = Part.Extension.SelectByID2(
"", "FACE", 0.01139270278031, -0.006451084779542, 0.05000000000001, true, 256, null, 0);
            boolstatus = Part.Extension.SelectByID2(
"", "FACE", 0.05275573322768, 0.01530932615179, 0.05000000000001, true, 256, null, 0);

            myFeatMr.FeatureExtruRefSurface(
false, false, false, 0, 0, 0.01, 0.01, false, false, false,
            
false, 0.01745329251994, 0.01745329251994, false, false, false, false, true, true, false,
            
false);

        }


        
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 Extruded Reference Surface 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) 2011 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.