Hallo
Hier is een programma dat lijkt te werken:
Dim invApp als uitvinder.Toepassing
Stel invApp = DezeApplicatie in
'invApp.SilentOperation = Waar
Dim iptDoc als Inventor.PartDocument
Stel iptDoc = invApp.ActiveDocument in
Dim iptFile als tekenreeks
LaserDir = "c:\temp\Macro\"
iptFile = LaserDir + "Temp.ipt"
Met invApp.CommandManager
Roepen. PostPrivateEvent(kFileNameEvent, iptFile)
Roepen. StartCommand(kFileSaveCopyAsCommand)
Eindigen met
Stel iptDoc in = Niets
'invApp.SilentOperation = Onwaar
InvApp instellen = Niets
' Criar um novo documento baseando-se no Template padrão / Create a new document based on the standard template
Dim oDrawnDoc als tekeningDocument
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
' Stel een verwijzing naar het tekendocument in.
' Hierbij wordt ervan uitgegaan dat er een tekendocument actief is.
Dim oDrawDoc als tekeningDocument
Stel oDrawDoc = DezeToepassing.ActiveDocument in
'Stel een verwijzing in naar het actieve blad.
Dim oSheet als blad
Stel oSheet in = oDrawDoc.ActiveSheet
' Maak een nieuw NameValueMap-object aan
Dim oBaseViewOptions als NameValueMap
Set oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Open het modeldocument (dat overeenkomt met de weergave "MyLODRep").
Dim Abc als snaar
Abc = ThisApplication.FileManager.GetFullDocumentName("C:\Temp\Macro\Temp.ipt")
Dim oModel als document
Set oModel = ThisApplication.Documents.Open(Abc, False)
' Maak het plaatsingspuntobject.
Dim oPoint als Point2D
Stel oPoint in = DezeToepassing.TransientGeometry.CreatePoint2d(10, 25)
' Creëer een basisaanzicht.
Dim oBaseView als tekeningView
Stel oBaseView in = oSheet.DrawingViews.AddBaseView(oModel, oPoint, 0.5, kFrontViewOrientation, kHiddenLineRemovedDrawingViewStyle, , , oBaseViewOptions)
Lente:
http://forums.autodesk.com/t5/Inventor-Customization/use-the-loaded-IPT-on-IDW-Through-VBA/m-p/3757811#M41961