| |  | Gut zu wissen: Hilfreiche Tipps und Tricks aus der Praxis prägnant, und auf den Punkt gebracht für Autodesk Produkte | | |  | CIDEON Whitepaper: Elektronik und Mechanik redundanzfrei vereinen: Der Weg zur mechatronischen Stückliste, ein Whitepaper
|
Autor
|
Thema: ilogic-alle geöffneten Dateien als Step (1888 / mal gelesen)
|
Bud87 Mitglied
 
 Beiträge: 157 Registriert: 11.09.2008 Catia V5 R17 Autodesk Inventor 2017 Windows Vista 32bit
|
erstellt am: 16. Aug. 2017 07:22 <-- editieren / zitieren --> Unities abgeben:         
|

| |
Ruzy5624 Mitglied Konstruktionsleiter / staatl. gepr. Techniker
 
 Beiträge: 280 Registriert: 01.07.2015 Product Design Suite 2018 Ultimate Visual Studio 2017 Windows 10 Pro Intel Xeon E3-1245 v5 @ 3,5GHz Nvidia Quadro M4000 8GB RAM 32GB 2x 24" Monitore FullHD SpaceMouse Pro
|
erstellt am: 19. Aug. 2017 11:32 <-- editieren / zitieren --> Unities abgeben:          Nur für Bud87
Hallo, der Code könnte in etwa so aussehen: VBA:
Code: Public Sub ExportToSTEP() Dim Doc As Document For Each Doc In ThisApplication.Documents Doc.Activate ' Get the STEP translator Add-In. Dim oSTEPTranslator As TranslatorAddIn Set oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}") If oSTEPTranslator Is Nothing Then MsgBox "Could not access STEP translator." Exit Sub End If Dim oContext As TranslationContext Set oContext = ThisApplication.TransientObjects.CreateTranslationContext Dim oOptions As NameValueMap Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then ' Set application protocol. ' 2 = AP 203 - Configuration Controlled Design ' 3 = AP 214 - Automotive Design oOptions.Value("ApplicationProtocolType") = 3 ' Other options... 'oOptions.Value("Author") = "" 'oOptions.Value("Authorization") = "" 'oOptions.Value("Description") = "" 'oOptions.Value("Organization") = "" oContext.Type = kFileBrowseIOMechanism Dim oDoc As Document Set oDoc = ThisApplication.ActiveDocument Dim strName As String Dim strNumber As String strName = oDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value strNumber = oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value Dim oData As DataMedium Set oData = ThisApplication.TransientObjects.CreateDataMedium oData.FileName = "D:\" & strNumber & " - " & strName & ".stp" Call oSTEPTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData) End If Next End Sub
iLogic:
Code: Dim Doc As DocumentFor Each Doc In ThisApplication.Documents Doc.Activate ' Get the STEP translator Add-In. Dim oSTEPTranslator As TranslatorAddIn oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}") If oSTEPTranslator Is Nothing Then MsgBox ("Could not access STEP translator.") Exit Sub End If Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then ' Set application protocol. ' 2 = AP 203 - Configuration Controlled Design ' 3 = AP 214 - Automotive Design oOptions.Value("ApplicationProtocolType") = 3 ' Other options... 'oOptions.Value("Author") = "" 'oOptions.Value("Authorization") = "" 'oOptions.Value("Description") = "" 'oOptions.Value("Organization") = "" oContext.Type = kFileBrowseIOMechanism Dim oDoc As Document oDoc = ThisApplication.ActiveDocument Dim strName As String Dim strNumber As String strName = oDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value strNumber = oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value Dim oData As DataMedium oData = ThisApplication.TransientObjects.CreateDataMedium oData.FileName = "D:\" & strNumber & " - " & strName & ".stp" Call oSTEPTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData) End If Next
Alle geöffneten Dokumente werden hier auf "D:\" als STEP abgelegt und bekommen einen Namen in der Form: [Bauteilnummer] - [Bauteilbezeichnung] Der Pfad und die Benennung können angepasst werden. Der Code stammt aus dem Inventor API-Handbuch und wurde nur angepasst, damit er alle geöffneten Dokumente durchläuft. Achtung: Es sollten natürlich nur Dokumente geöffnet sein, die sich auch als STEP exportieren lassen. Andernfalls wirft der Code einen Fehler. ------------------ Mit Besten Grüßen Marcel Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
| Anzeige.:
Anzeige: (Infos zum Werbeplatz >>)
 |