Hide Table of Contents

Show Hidden Edges Example (VBA)

This example shows how to show the hidden edges.

 

'---------------------------------------------------

'

' Preconditions:

'           (1) Drawing document is open that has

'                contains a model with hidden edges.

'           (2) The programmatically selected face contains

'               one or more hidden edges.
'           

' Postconditions: All hidden edges on the selected face are now visible.

'

' NOTE: This macro will work even if the selected face

'       does not have any hidden edges.

'

'----------------------------------------------------

Option Explicit

 

Dim swApp As SldWorks.SldWorks

Dim swDrawingDoc As SldWorks.DrawingDoc

Dim swModel As SldWorks.ModelDoc2

Dim swSelMgr As SldWorks.SelectionMgr

Dim swModelDocExt As SldWorks.ModelDocExtension

Dim swFace As SldWorks.Face2

Dim swSelData As SldWorks.SelectData

Dim vEdges As Variant

Dim NbrOfEdges As Long

Dim boolstatus As Boolean

Dim i As Long

 

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swDrawingDoc = swModel

Set swSelMgr = swModel.SelectionManager

Set swModelDocExt = swModel.Extension

Set swSelData = swSelMgr.CreateSelectData

 

' Activate a drawing view

boolstatus = swDrawingDoc.ActivateView("Drawing View2")

 

' Select a face in the activated view that has hidden edges

boolstatus = swModelDocExt.SelectByID2("", "FACE", 0.2262086319035, 0.109004199964, -499.8803646186, False, 1, Nothing, 0)

Set swFace = swSelMgr.GetSelectedObject6(1, 1)

 

' Get the number of edges on the selected face

NbrOfEdges = swFace.GetEdgeCount

Debug.Print "Number of edges on this face: " & NbrOfEdges

' Get the edges on the selected face

vEdges = swFace.GetEdges

 

' Show each edge on the face

For i = 0 To (NbrOfEdges - 1)

    boolstatus = vEdges(i).Select4(True, swSelData)

    'Show the edge

    swDrawingDoc.ShowEdge

Next i

    

End Sub



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:   Show Hidden Edges Example (VBA)
*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.