Hide Table of Contents

Get Data for Surface-flatten Feature Example (C#)

This example shows how to create a surface-flatten feature and get its data.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Open install_dir\samples\tutorial\api\toaster.sldprt.
// 2. Open an Immediate window.
//
// Postconditions:
// 1. Creates Surface-Flatten1 in the FeatureManager design tree.
// 2. Inspect the Immediate window.
//
// NOTE: Because this part document is used elsewhere, do not save changes
// when closing it.

//---------------------------------------------------------------------------
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System.Runtime.InteropServices;
namespace InsertSurfFlatten_CSharp.csproj
{
    partial class SolidWorksMacro
    {
 
        public void Main()
        {
            ModelDoc2 Part = default(ModelDoc2);
            Feature swFeat = default(Feature);
            SurfaceFlattenFeatureData swSurfFlatten = default(SurfaceFlattenFeatureData);
            bool boolstatus = false;
 
            Part = (ModelDoc2)swApp.ActiveDoc;
 
            boolstatus = Part.Extension.SelectByID2("""FACE", 0.0343791439121333, 0.113529021755539, 0.0978513589013232, true, 1, null, 0);
            boolstatus = Part.Extension.SelectByID2("""VERTEX", 0.0665960136495036, 0.141573958827054, 0.1016, true, 16, null, 0);
            boolstatus = Part.Extension.SelectByID2("""EDGE", 0.054235249930457, 0.105966292673031, 0.102108078588174, true, 2, null, 0);
            boolstatus = Part.Extension.SelectByID2("""EDGE", 0.0222348071149554, 0.0620036139007993, 0.0963411782521462, true, 2, null, 0);
 
            swFeat = Part.FeatureManager.InsertFlattenSurface(5);
 
            //boolstatus = Part.Extension.SelectByID2("Surface-Flatten1", "REFSURFACE", 0, 0, 0, False, 0, Nothing, 0)
            //Set swFeat = Part.SelectionManager.GetSelectedObject6(1, -1)
 
            swSurfFlatten = (SurfaceFlattenFeatureData)swFeat.GetDefinition();
            swSurfFlatten.AccessSelections(Part, null);
 
            Debug.Print("File = " + Part.GetPathName());
            Debug.Print("Feature = " + swFeat.Name);
            Debug.Print("   Accuracy of flattened triangle mesh =  " + swSurfFlatten.AccuracyFactor);
           
Debug.Print("   Keep internal control curves = " + swSurfFlatten.KeepInternalControlCurves);
 
            swSurfFlatten.ReleaseSelectionAccess();
 
        }
 
        /// <summary>
        /// The SldWorks swApp variable is pre-assigned for you.
        /// </summary>
 
        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:   Get Data for Surface-flatten 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) 2015 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.