I dont want to export hidden sketches(want to export only shown sketches) while exporting to dxf/dwg so i'm using drwing file (NewDocument) and CreateFlatPatternViewFromModelView API. But the shown sketches too are not exported.
When i manually do(please watch the attached video) sketches are exported, but not through API. Please provide me a solution.
The following is the macro i created, but not exporting the sketched as expected.
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
Set Part = swApp.NewDocument("C:\ProgramData\SolidWorks\SolidWorks 2013\templates\Drawing.drwdot", 2, 0.2794, 0.4318)
swApp.ActivateDoc2 "Draw14 - Sheet1", False, longstatus
Set Part = swApp.ActiveDoc
boolstatus = Part.CreateFlatPatternViewFromModelView("C:\Users\MERCURY\Desktop\prob 1\Part14.SLDPRT", "Default", 0.549162197986577, 0.498221946308725, 0)
boolstatus = Part.ActivateView("Drawing View1")
Part.ClearSelection2 True
boolstatus = Part.ActivateSheet("Sheet1")
Part.ViewZoomtofit2
longstatus = Part.SaveAs3("C:\Users\balajik\Desktop\SW sketches\Part14.SLDDRW", 0, 2)
Set Part = Nothing
swApp.CloseDoc "Part14 - Sheet1"
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameLeft = 0
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
swApp.ActivateDoc2 "Part14.SLDPRT", False, longstatus
Set Part = swApp.ActiveDoc
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
End Sub
SolidworksApi macros