Hello
Here's a program that seems to be working:
Dim invApp As Inventor.Application
Set invApp = ThisApplication
'invApp.SilentOperation = True
Dim iptDoc As Inventor.PartDocument
Set iptDoc = invApp.ActiveDocument
Dim iptFile As String
LaserDir = "c:\temp\Macro\"
iptFile = LaserDir + "Temp.ipt"
With invApp.CommandManager
Call. PostPrivateEvent(kFileNameEvent, iptFile)
Call. StartCommand(kFileSaveCopyAsCommand)
End With
Set iptDoc = Nothing
'invApp.SilentOperation = False
Set invApp = Nothing
' Criar um novo documento baseando-se no Template padrão / Create a new document based on the standard template
Dim oDrawnDoc As DrawingDocument
Set oDrawnDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, _
ThisApplication.FileManager.GetTemplateFile(kDrawingDocumentObject))
'************Plotar a peça salva em um arquivo do IDW / Use the temporary part on the IDW
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
'Set a reference to the active sheet.
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
' Create a new NameValueMap object
Dim oBaseViewOptions As NameValueMap
Set oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Open the model document (corresponding to the "MyLODRep" representation).
Dim Abc As String
Abc = ThisApplication.FileManager.GetFullDocumentName("C:\Temp\Macro\Temp.ipt")
Dim oModel As Document
Set oModel = ThisApplication.Documents.Open(Abc, False)
' Create the placement point object.
Dim oPoint As Point2D
Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(10, 25)
' Create a base view.
Dim oBaseView As DrawingView
Set oBaseView = oSheet.DrawingViews.AddBaseView(oModel, oPoint, 0.5, kFrontViewOrientation, kHiddenLineRemovedDrawingViewStyle, , , oBaseViewOptions)
Spring:
http://forums.autodesk.com/t5/Inventor-Customization/use-the-loaded-IPT-on-IDW-Through-VBA/m-p/3757811#M41961