Hello, I need some help to find the right commands for the following (I hope there are some...)
Attached is an assembly "demo.sldasm" (all parts included) and a drawing template "Spannskizze.drwdot".
The drawing template has (currently) 3 sheets and each sheet has one predefined view. If I create a drawing with this template from my assembly only the view on the first sheet is filled. See read arrows. This is a SW issue and a SPR is already running.
a) How can I set the reference model in a view same as in the first view?
And my assembly has a visible 3D sktech named "Nullpunkt", but inside the view(s) the sketch is always hidden. See blue arrow.
b) How can I make it visible?
As this is a basic setup for a SolidCAM scenario, I really need it often in the future. Therefore I want to automate this task.
Below is all the code I have so far.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swSheet As SldWorks.Sheet
Dim swView As SldWorks.View
Dim vSheetName, vModelName
Dim i As Long
Set swApp = Application.SldWorks
Set swDraw = swApp.ActiveDoc
vSheetName = swDraw.GetSheetNames
For i = 0 To UBound(vSheetName)
Set swSheet = swDraw.Sheet(vSheetName(i))
If swSheet.IsLoaded Then
Set swView = swDraw.GetFirstView
While Not swView Is Nothing
Debug.Print " " & swView.GetName2 & " [" & swView.Type & "]"
Select Case swView.Type
If IsEmpty(vModelName) Then
'Get the model loaded in this view
vModelName = swView.GetReferencedModelName
'a) Set the model in this view
'b) Find the Sketch named "Nullpunkt" inside the view and make it visible
'boolstatus = Part.Extension.SelectByID2("Nullpunkt@Demo-1@Zeichenansicht1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Set swView = swView.GetNextView
'Back to first view
Demo2.zip 1.2 MB