Evening All,
I would like the code for a button which changes the tangent edges to font, visible and hidden on a selected view.
So far i have the code which changes the tangent edges to the whole page. See below.
Also have the code of a recorded macro which doesnt work. See below.
Can anyone give me the code for a button that changes the tangent edges to font, visible or hidden on a selected view? As with the first code i can then tweak the settings to suit visible, hidden and font. Depending what i require.
Thankyou to all who helped in the last post.
Helpful Blogger Macro - Works for whole page (not just selected view).
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDrawDoc As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim vSheets As Variant
Dim vViews As Variant
Dim lSheetCount As Long
Dim lViewCount As Long
Dim iDisplayIn As Integer
Sub main()
Set swApp = Nothing
Set swModel = Nothing
Set swDrawDoc = Nothing
Set swView = Nothing
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
If swModel Is Nothing Then Exit Sub
If swModel.GetType = swDocumentTypes_e.swDocDRAWING Then
' *** Add / Remove comment mark depending on what settings of tanget edges should be.
'iDisplayIn = swDisplayTangentEdges_e.swTangentEdgesHidden
'iDisplayIn = swDisplayTangentEdges_e.swTangentEdgesVisible
iDisplayIn = swDisplayTangentEdges_e.swTangentEdgesVisibleAndFonted
Set swDrawDoc = swModel
lViewCount = swDrawDoc.GetViewCount
vSheets = swDrawDoc.GetViews
For lSheetCount = LBound(vSheets) To UBound(vSheets)
vViews = vSheets(lSheetCount)
For lViewCount = LBound(vViews) To UBound(vViews)
vViews(lViewCount).SetDisplayTangentEdges2 (iDisplayIn)
Next
Next
End If
End Sub
---------------------------------------------------------------------------------------------------------------------------------
Recorded Macro which doesnt work
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
Dim myView As Object
Set myView = Part.SelectionManager.GetSelectedObject3(True)
myView.SetDisplayTangentEdges2 swDisplayTangentEdges_eswTangentEdgesVisible - DEBUG ERROR
End Sub
SolidworksApi macros