Hide Table of Contents

Get Whether Part Has Frozen Features Example (VB.NET)

This example shows how to get whether a part document has frozen features, and, if so, whether those features need updating.

'------------------------------------------------------------------
' Preconditions:
' 1. Read the SOLIDWORKS Document Manager API Help Getting Started
'    topic and register the required DLLs.
' 2. Copy and paste this module into a VB.NET
'    console application in Microsoft Visual Studio.

' 3. Load the latest SolidWorks.Interop.swdocumentmgr.dll
'    interop assembly by:
'    a. Right-clicking the project name in the Project Explorer.
'    b. Clicking Add Reference.
'    c. Clicking the interop assembly in the .NET
'       tab or browsing for the DLL in install_dir/api/redist.
' 4. Substitute your license key for your_license_key in the code.
' 5. Make sure that the part document opened by this application
'    exists.
' 6. Open the Immediate window.
'
' Postconditions: Whether the part document contains frozen features
' is printed to the Immediate window, and, if so, whether
' those features need updating.
'
' NOTE: This sample application was developed using
' Microsoft Visual Studio 2008. If you use another version of
' Microsoft Visual Studio, you might need to add more references to get
' this application to compile.
'------------------------------------------------------------------

Imports SolidWorks.Interop.swdocumentmgr
Imports System.Diagnostics

Module Module1
    
Sub Main()

        
Dim dmClassFact As SwDMClassFactory = Nothing
        Dim dmDocMgr As ISwDMApplication3 = Nothing
        Dim dmDoc As ISwDMDocument16 = Nothing
        Dim dmError As SwDmDocumentOpenError = Nothing
        Dim namePart As String = ""
        Dim hasFrozenFeatures As Boolean = False
        Dim frozenFeaturesNeedUpdating As Boolean = False

        dmClassFact = New SwDMClassFactory()
        
'Do not distribute license key
        dmDocMgr = DirectCast(dmClassFact.GetApplication("your_license_key"), ISwDMApplication3)
        namePart =
"C:\Users\Public\Documents\SOLIDWORKS\SOLIDWORKS 2018\samples\tutorial\api\FreezeBarNeedsRebuild2.sldprt"

        'Get the SOLIDWORKS part document
        dmDoc = DirectCast(dmDocMgr.GetDocument(namePart, SwDmDocumentType.swDmDocumentPart, False, dmError), ISwDMDocument16)
        Debug.Print(
"Document's full name: " + dmDoc.FullName)
        Debug.Print(
"  Date document last saved: " + dmDoc.LastSavedDate)

        
' Get whether the part document has frozen features and
        ' whether those features need updating
        hasFrozenFeatures = CBool(dmDoc.HasFrozenFeatures(frozenFeaturesNeedUpdating))
        Debug.Print(
"    Does the part document have frozen features? " & hasFrozenFeatures)
        
If hasFrozenFeatures Then
            Debug.Print("    Do any of the frozen features need updating? " & frozenFeaturesNeedUpdating)
        
End If
    End Sub

End
Module



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 Whether Part Has Frozen Features (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) 2022 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.