Hi @matt_jlt
That piece of code does exactly what you said. My point was just to show how to pause an Ilogic code execution.
Anyway try the code below. I hope it helps solving your problem.
Please first fill out 3 full file names at the top of the code.
After you run it the ilogic waits for you to click somewhere at the drawing space to get the position for the new drawing view. Than it places the view and offers you to edit the view orientation and so on. When you are done it repeats all these steps for other files in the list.
Public Class ThisRule
Public strFilename1 As String = "Add here your assembly or part file path"
Public strFilename2 As String = "Add here our assembly or part file path"
Public strFilename3 As String = "Add here your assembly or part file path"
Public oPosition As Point2d
Public oInteraction As InteractionEvents
Public oMouse As MouseEvents
Private mouseClicked As Boolean
Sub Main
oInteraction = ThisApplication.CommandManager.CreateInteractionEvents
oMouse = oInteraction.MouseEvents
AddHandler oMouse.OnMouseClick ,AddressOf oMouse_OnMouseDown
Dim nameList() As String = {strFilename1,strFilename2,strFilename3}
For i = 0 To nameList.Length - 1
oInteraction.Start
AddDrawingView(nameList(i))
Next
End Sub
Sub AddDrawingView(name As String)
Dim oDoc As Document = ThisApplication.Documents.Open(name, False)
Do While mouseClicked = False
ThisApplication.UserInterfaceManager.DoEvents
Loop
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim Scale As Double = 1/2
Call oDrawDoc.ActiveSheet.DrawingViews.AddBaseView(oDoc, oPosition, Scale, _
ViewOrientationTypeEnum.kDefaultViewOrientation, _
DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle, , , )
oDoc.Close
Dim oCommandMgr As CommandManager = ThisApplication.CommandManager
Dim oControlDef As ControlDefinition
Dim lastViewIndex As Integer = oDrawDoc.ActiveSheet.DrawingViews.Count
oDrawDoc.SelectSet.Select(oDrawDoc.ActiveSheet.DrawingViews(lastViewIndex))
oControlDef = oCommandMgr.ControlDefinitions.Item("DrawingViewEditCtxCmd")
oControlDef.Execute2(True)
Dim oView As DrawingView = oDrawDoc.ActiveSheet.DrawingViews(oDrawDoc.ActiveSheet.DrawingViews.Count)
Do While oView.IsUpdateComplete = False
Call ThisApplication.UserInterfaceManager.DoEvents
Loop
Call AddCenterLines(oView)
mouseClicked = False
End Sub
Sub AddCenterLines(oView As DrawingView)
Dim oCenterline As AutomatedCenterlineSettings = Nothing
Call oView.GetAutomatedCenterlineSettings(oCenterline)
oCenterline.ApplyToHoles = True
oCenterline.ProjectionParallelAxis = True
Call oView.SetAutomatedCenterlineSettings(oCenterline)
End Sub
Sub oMouse_OnMouseDown(Button As MouseButtonEnum, ShiftKeys As ShiftStateEnum, _
ModelPosition As Point, ViewPosition As Point2d, View As Inventor.View)
oPosition = ThisApplication.TransientGeometry.CreatePoint2d(ModelPosition.X, ModelPosition.Y)
mouseClicked = True
End Sub
End Class