Dear All,
I am trying to modify the hatch angle and scale of a cross section view in the drawing.
I am able to modify those using following API.
http://help.solidworks.com/2021/english/api/sldworksapi/Get_Hatching_Data_Example_VB.htm?verRedirect=
In this code, I would like to know component name from Sldworks.Face2
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swView = swSelMgr.GetSelectedObjec6(1, -1)
Set swSketch = swView.GetSketch
Debug.Print "View = " & swView.Name
Debug.Print " Type = " & swView.Type
Debug.Print ""
vFaceHatch = swView.GetFaceHatches
If Not IsEmpty(vFaceHatch) Then
Debug.Print " Face hatches:"
Debug.Print ""
For i = 0 To UBound(vFaceHatch)
Set swFaceHatch = vFaceHatch(i)
**Set swFace = swFaceHatch.Face**
' Cannot select a face because a face is in model
bRet = swFace.Select2(True, 0)
' Get sketch hatch data
' 1 radian = 180º/p = 57.295779513º or approximately 57.3º
Debug.Print " Angle = " & swFaceHatch.Angle * 57.3 & " degrees"
Debug.Print " Color = " & swFaceHatch.Color
Debug.Print " Definition = " + swFaceHatch.Definition
Debug.Print " Layer = " & swFaceHatch.Layer
Debug.Print " Pattern = " + swFaceHatch.Pattern
Debug.Print " Scale = " & swFaceHatch.Scale2
Debug.Print " SolidFill = " & swFaceHatch.SolidFill
Debug.Print " -----------------------"
Next i
End If
I need to know the model name in which this face is associated with?
Set swFace = swFaceHatch.Face
Any Solidworks API available, kindly share it with me