Hide Table of Contents

Create Surface Knit Feature Example (C#)

This example shows how to create a Surface-Knit feature.

//--------------------------------------------------------------------------

// Preconditions: Part document containing two surfaces is open.

//

// Postconditions:

// A Surface-Knit feature is created using the two selected surfaces.

//--------------------------------------------

using SolidWorks.Interop.sldworks;

using SolidWorks.Interop.swconst;

using System;

using System.Diagnostics;

namespace SurfaceKnitFeatureManager_CSharp.csproj

{

    partial class SolidWorksMacro

    {

        public void Main()

        {

            ModelDoc2 swModel = default(ModelDoc2);

            ModelDocExtension swModelDocExt = default(ModelDocExtension);

            FeatureManager swFeatureMgr = default(FeatureManager);

            Feature swFeature = default(Feature);

            SurfaceKnitFeatureData swSurfaceKnitFeature = default(SurfaceKnitFeatureData);

            bool boolstatus = false;

            int longstatus = 0;

            swApp.ActivateDoc2("prj14414-SurfaceKnit-MacroTest.SLDPRT", false, ref longstatus);

            swModel = (ModelDoc2)swApp.ActiveDoc;

            swModelDocExt = swModel.Extension;

            swFeatureMgr = swModel.FeatureManager;

            boolstatus = swModelDocExt.SelectByID2("Verrundung2", "SURFACEBODY", -0.01350648199224, -0.001914137629626, 0.01055295249466, false, 1, null, 0);

            boolstatus = swModelDocExt.SelectByID2("Verrundung1", "SURFACEBODY", -0.0125503446005, -0.002125678282823, -0.007630408959756, true, 1, null, 0);

            // Create and get the Surface-Knit feature

            swFeature = swFeatureMgr.InsertSewRefSurface(true, false, false, 3.001639406912E-05, 0.0001);

            swSurfaceKnitFeature = (SurfaceKnitFeatureData)swFeature.GetDefinition();

            // List some of the Knit-Surface feature's properties

            // in the Immediate Window

            Debug.Print("Knit-surface feature: ");

            Debug.Print(" Knit tolerance: " + swSurfaceKnitFeature.KnitTolerance * 1000 + " mm");

            Debug.Print(" Maximum value for gap range: " + swSurfaceKnitFeature.MaxValueForGapRange * 1000 + " mm");

            Debug.Print(" Minimum value for gap range: " + swSurfaceKnitFeature.MinValueForGapRange * 1000 + " mm");

            Debug.Print(" Use gap filters? " + swSurfaceKnitFeature.UseGapFilters);

            Debug.Print(" Use merge entities? " + swSurfaceKnitFeature.UseMergeEntities);

            Debug.Print(" Try to form solid? " + swSurfaceKnitFeature.UseTryToFormSolid);

        }

       

        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:   Create Surface Knit Feature 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) 2013 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.