Update.
I couldn't find the API to change the layer for the Component Line Font but was able to do it from this example:
https://help.solidworks.com/2016/englis ... ple_vb.htm
Here is what came up with:
*created the drawing templates with predefined views
*macro to take active model part and insert model into all the views of the drawing template
*save the file as DXF and close the drawing
Thanks for the help!
-------------------------------------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Sub main()
Dim boolstatus As Boolean
Dim swDrawing As SldWorks.DrawingDoc
Dim selMan As SldWorks.SelectionMgr
Dim drwView As SldWorks.View
Dim swDrawComp As SldWorks.DrawingComponent
Dim sRevision As String
Dim fileName As String
Dim longstatus As Long
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
'drawing template with predefined views
Set swDrawing = swApp.NewDocument("I:\Solidworks\DXF_LAYERS.drwdot", swDwgPaperSizes_e.swDwgPaperBsize, 0, 0)
'checks if active doc is a part
If (swModel.GetType <> swDocPART) Then GoTo CLEAN_UP
'inserts the current active model into the drawing template
swDrawing.InsertModelInPredefinedView swModel.GetPathName()
Set selMan = swDrawing.SelectionManager
'selects view and change view part layer
boolstatus = swDrawing.Extension.SelectByID2("Drawing View1", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
Set drwView = selMan.GetSelectedObject6(1, 0)
Set swDrawComp = drwView.RootDrawingComponent
swDrawComp.layer = "FRONT"
boolstatus = swDrawing.Extension.SelectByID2("Drawing View2", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
Set drwView = selMan.GetSelectedObject6(1, 0)
Set swDrawComp = drwView.RootDrawingComponent
swDrawComp.layer = "TOP"
boolstatus = swDrawing.Extension.SelectByID2("Drawing View3", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
Set drwView = selMan.GetSelectedObject6(1, 0)
Set swDrawComp = drwView.RootDrawingComponent
swDrawComp.layer = "RIGHT"
boolstatus = swDrawing.Extension.SelectByID2("Drawing View4", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
Set drwView = selMan.GetSelectedObject6(1, 0)
Set swDrawComp = drwView.RootDrawingComponent
swDrawComp.layer = "ISO"
boolstatus = swDrawing.Extension.SelectByID2("Drawing View5", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
Set drwView = selMan.GetSelectedObject6(1, 0)
Set swDrawComp = drwView.RootDrawingComponent
swDrawComp.layer = "LEFT"
boolstatus = swDrawing.Extension.SelectByID2("Drawing View6", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
Set drwView = selMan.GetSelectedObject6(1, 0)
Set swDrawComp = drwView.RootDrawingComponent
swDrawComp.layer = "BOTTOM"
boolstatus = swDrawing.Extension.SelectByID2("Drawing View7", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
Set drwView = selMan.GetSelectedObject6(1, 0)
Set swDrawComp = drwView.RootDrawingComponent
swDrawComp.layer = "BACK"
'clear any selection
swModel.ClearSelection2 True
'fileName for dxf out put
fileName = swModel.GetPathName
fileName = Left(fileName, InStrRev(fileName, ".") - 1) & ".dxf"
' Save to dxf and close drawing
Set swModel = swDrawing
longstatus = swModel.SaveAs3(fileName, 0, 2)
swApp.QuitDoc (swModel.GetTitle)
'Clean up files
CLEAN_UP:
Set drwView = Nothing
Set swDrawing = Nothing
Set swModel = Nothing
End Sub