Hello all!
I'm currently working on modifying a VBA macro that creates flat-pattern sheet metal DXFs from solidworks part files. It does this by creating a flat pattern drawing, and saving that drawing as a DXF using the SaveAs method.
I've been trying to map specific sketches onto specific layers (i.e. sketches titled "ETCH_*" onto an "ETCH" layer on the DXF), but I cannot find a way to include sketches in the drawing's features so that I can iterate over them, presumably like so:
Set swFeat = swDrawing.FirstFeature
Do While Not swFeat Is Nothing
featName = swFeat.GetTypeName2
If FeatName = "ProfileFeature" or featName = "3DProfileFeature" Then
...(convert all .GetSketchSegments to .Layer = "ETCH")
End If
Set swFeat = swFeat.GetNextFeature
Loop
Currently, I produce the drawing from the part document in this way:
Set objAssemblyComponent = objswApp.OpenDoc(strNameWithPath, swDocPART)
Set objAssemblyComponent = objswApp.ActiveDoc
Set Drawing = objswApp.OpenDoc4("C:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS\\DXF_Transfer\\SLDDXF.SLDDRW", 3, 0, "", longstatus)
Set Drawing = objswApp.activateDoc("SLDDXF - Sheet1")
Drawing.ShowConfiguration "Default"
Drawing.CreateFlatPatternViewFromModelView2 strNameWithPath, "Default", 0, 0, 0, True
Drawing.ViewZoomtofit2
If there is any way to include the sketch entities in the drawing, or "convert" entities from the part document into a specific layer of the drawing, I'd really appreciate the guidance.
