Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swDraw As SldWorks.DrawingDoc Dim swSelMgr As SldWorks.SelectionMgr Dim swModelDocExt As SldWorks.ModelDocExtension Dim swView As SldWorks.View Dim swRootDrawComp As SldWorks.DrawingComponent Dim vDrawChildCompArr As Variant Dim vDrawChildComp As Variant Dim swDrawComp As SldWorks.DrawingComponent Dim swComp As SldWorks.Component2 Dim swCompModel As SldWorks.ModelDoc2 Dim assemblyDrawing As String Dim status As Boolean Dim errors As Long Dim warnings As Long Dim lineWeight As Long Dim lineThickness As Double 'aus aufzeichnung - mal als reserve lassen Dim swObject As Object Dim longstatus As Long, longwarnings As Long Sub main() Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc If swModel Is Nothing Then res = swApp.SendMsgToUser2("kein aktives Dokument ...", 1, 1) Else If swModel.GetType() <> swDocDRAWING Then res = swApp.SendMsgToUser2("aktives Dokument ist keine Zeichnung" & Chr(10) & _ "bitte Zeichnung aktivieren .", 1, 1) Exit Sub Else Set swDraw = swModel Set swModelDocExt = swModel.Extension Set swSelMgr = swModel.SelectionManager Set swView = swDraw.GetFirstView Debug.Print "view: " & swView.GetName2 Set swRootDrawComp = swView.RootDrawingComponent If Not swRootDrawComp Is Nothing Then Debug.Print "compname: " & swRootDrawComp.Name Debug.Print "Default component line = " & swRootDrawComp.UseDocumentDefaults swRootDrawComp.UseDocumentDefaults = True Debug.Print "Default component line = " & swRootDrawComp.UseDocumentDefaults Debug.Print "linestyle = " & swRootDrawComp.GetLineStyle(0) ' swRootDrawComp.Style End If ' Debug.Print "Linestyle: " & swRootDrawComp.GetLineStyle Set swView = swView.GetNextView While Not swView Is Nothing Debug.Print "view: " & swView.GetName2 Set swRootDrawComp = swView.RootDrawingComponent If Not swRootDrawComp Is Nothing Then swRootDrawComp.UseDocumentDefaults = True Debug.Print "compname: " & swRootDrawComp.Name Debug.Print "Default component line = " & swRootDrawComp.UseDocumentDefaults swRootDrawComp.UseDocumentDefaults = True Debug.Print "Default component line = " & swRootDrawComp.UseDocumentDefaults Debug.Print "linestyle = " & swRootDrawComp.GetLineStyle(0) vDrawChildCompArr = swRootDrawComp.GetChildren For Each vDrawChildComp In vDrawChildCompArr Set swDrawComp = vDrawChildComp ' Returns NULL if underlying model is open in a different configuration Set swComp = swDrawComp.Component ' Returns NULL if drawing is lightweight If Not swComp Is Nothing Then Debug.Print "- compname: " & swDrawComp.Name Debug.Print "- Default component line = " & swDrawComp.UseDocumentDefaults Debug.Print "linestyle = " & swRootDrawComp.GetLineStyle(0) swDrawComp.UseDocumentDefaults = True Debug.Print "- Default component line = " & swDrawComp.UseDocumentDefaults Debug.Print "linestyle = " & swRootDrawComp.GetLineStyle(0) End If Next End If Set swView = swView.GetNextView Wend End If End If end sub