Hide Table of Contents

Get Rib Feature Data Example (VB.NET)

This example shows how to get rib feature data.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Verify that the specified model document exists.
' 2. Open an Immediate window.
'
' Postconditions:
' 1. Opens the part document.
' 2. Creates Shell1Plane1, and Rib1.
' 3. Inspect the FeatureManager design tree, the graphics area, and the
'    Immediate window.
'
' NOTE: Because the model is used elsewhere, do not save changes.

'---------------------------------------------------------------------------
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System
Imports System.Diagnostics
 
Partial Class SolidWorksMacro
 
    Dim Part As ModelDoc2
    Dim myRefPlane As RefPlane
    Dim skSegment As SketchSegment
    Dim swSelMgr As SelectionMgr
    Dim swFeat As Feature
    Dim swRibFeat As RibFeatureData2
    Dim boolstatus As Boolean
    Dim longstatus As Integer, longwarnings As Integer
 
    Sub main()
 
        Part = swApp.OpenDoc6("C:\Users\Public\Documents\SOLIDWORKS\SOLIDWORKS 2018\samples\tutorial\api\block20.sldprt", 1, 0, "", longstatus, longwarnings)
        swApp.ActivateDoc2("block20"False, longstatus)
        Part = swApp.ActiveDoc
 
        boolstatus = Part.Extension.SelectByID2("""FACE", -0.00878816842651986, 0.0396239999998897, -0.0292468281514857, False, 1, Nothing, 0)
        Part.InsertFeatureShell(0.00254, False)
 
        boolstatus = Part.Extension.SelectByID2("""FACE", 0.00264031138414111, 0.028407059059532, -0.0613970439424634, True, 0, Nothing, 0)
        boolstatus = Part.Extension.SelectByID2("""FACE", -0.059937899786064, 0.0277866864457792, -0.00877977980189826, True, 1, Nothing, 0)
 
        myRefPlane = Part.FeatureManager.InsertRefPlane(128, 0, 128, 0, 0, 0)
        Part.ClearSelection2(True)
 
        boolstatus = Part.Extension.SelectByID2("Plane1""PLANE", 0.00664896553058725, 0.109417877974863, 0.0524178648701081, False, 0, Nothing, 0)
        Part.SketchManager.InsertSketch(True)
 
        skSegment = Part.SketchManager.CreateLine(-0.085797, 0.021082, 0.0#, -0.03423, 0.035134, 0.0#)
        skSegment = Part.SketchManager.CreateLine(-0.03423, 0.035134, 0.0#, 0.007726, 0.025357, 0.0#)
        skSegment = Part.SketchManager.CreateLine(0.007726, 0.025357, 0.0#, 0.111514, 0.039624, 0.0#)
        Part.ClearSelection2(True)
 
        Part.SketchManager.InsertSketch(True)
        Part.ClearSelection2(True)
        boolstatus = Part.Extension.SelectByID2("Sketch2""SKETCH", 0, 0, 0, False, 0, Nothing, 0)
        Part.FeatureManager.InsertRib(TrueFalse, 0.00254, 0, FalseFalseTrue, 0.0174532925199433, FalseFalse)
 
        swSelMgr = Part.SelectionManager
        swFeat = swSelMgr.GetSelectedObject6(1, -1)
        swRibFeat = swFeat.GetDefinition
 
        Debug.Print("Rib feature type as defined in swRibType_e: " & swRibFeat.Type)
        Debug.Print("Thickness: " & swRibFeat.Thickness)
        Debug.Print("Extrusion direction as defined in swRibExtrusionDirection_e: " & swRibFeat.ExtrusionDirection)
        Debug.Print("Rib has a draft? " & swRibFeat.EnableDraft)
        If swRibFeat.EnableDraft Then
            Debug.Print("    Draft angle: " & swRibFeat.DraftAngle)
            Debug.Print("    Draft outward? " & swRibFeat.DraftOutward)
        End If
        Debug.Print("Add material to reverse side of the rib? " & swRibFeat.FlipSide)
        Debug.Print("Rib is extruded on two sides of the midplane? " & swRibFeat.IsTwoSided)
        If Not swRibFeat.IsTwoSided Then
            Debug.Print("Single-sided rib is extruded on the reverse side? " & swRibFeat.ReverseThicknessDir)
        End If
 
    End Sub
 
 
    ''' <summary>
    ''' The SldWorks swApp variable is pre-assigned for you.
    ''' </summary>
    Public swApp As SldWorks
 
 
End Class
 

 

 



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 Rib Feature Data Example (VB.NET)
*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) 2019 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.