Hide Table of Contents

Render Annotations to Separate Image File Example (VB.NET)

This example shows how to render annotations and dimensions visible in a model to a separate image file.

'--------------------------------------------------------------
' Preconditions:
' 1. Open a model document.
' 2. Add a note to the model.
' 3. Right-click Annotations in the FeatureManager design tree
'    and click Show Feature Dimensions, if dimensions
'    are not visible in the model.
' 4. Verify that:
'    * PhotoView 360 add-in is loaded.
'    * c:\temp exists.
'
' Preconditions:
' 1. Sets the options to include and render annotations and dimensions  
'    visible in a model to a separate image file.
' 2. If prompted to add camera or perspective, click Continue
'    without Camera or Perspective.
' 3. Renders:
'    * model to c:\temp\annotations.png
'    * note and dimensions to c:\temp\annotations_1.png
' 4. Open both files to verify the previous step.
'--------------------------------------------------------------
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System
 
Partial Class SolidWorksMacro
 
    Public Sub main()
        Dim swModel As ModelDoc2
        Dim swRayTraceRenderer As RayTraceRenderer
        Dim swRayTraceRenderOptions As RayTraceRendererOptions
        Dim status As Boolean
 
        swModel = swApp.ActiveDoc
 
        'Access PhotoView 360
        swRayTraceRenderer = swApp.GetRayTraceRenderer(swRayTraceRenderType_e.swPhotoView)
 
        'Set options to include and render annotations and dimensions  
        'visible in a model to a separate image file
        swRayTraceRenderOptions = swRayTraceRenderer.RayTraceRendererOptions
        swRayTraceRenderOptions.IncludeAnnotationsInRendering = True
        swRayTraceRenderOptions.RenderAnnotationsToSeparateImage = True
        status = swRayTraceRenderer.RenderToFile("c:\temp\annotations.png", 0, 0)
        status = swRayTraceRenderer.CloseFinalRenderWindow
 
 
    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:   Render Annotations to Separate Image File 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) 2018 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.