öffentliche sub addipartoccurrence()
Öffnen Sie das Fabrikdokument unsichtbar.
dim ofactorydoc als Teildokumentation
set ofactorydoc = thisapplication.documents.open("w:\commesse\aia\15030_modifica zona lavatrici\assieme2.c02.ipt", falsch)
' einen Verweis auf die Komponentendefinition setzen.
dim ocompdef als Teilkomponentendefinition
ocompdef = vonactorydoc.componentdefinition
Achten Sie darauf, dass wir eine Fabrik haben.
wenn ocompdef.isipartfactory = falsch dann
msgbox "Erwähltes Dokument ist keine Fabrik.", vbexclaming
Ausgang Sub
Ende
' einen Hinweis auf die Fabrik.
dim oipartfactory as ipartfactory
Oipartfactory = ocompdef.ipartfactory
Die Anzahl der Reihen in der Fabrik.
dim inumrows als ganze Zahl
Inumrows = oipartfactory.tablerows.count
' ein neues Montagedokument erstellen
dim odoc als Montagedokument
set odoc = thisapplication.documents.add(kassemblydocumentobject, , true)
dim ooccs als Komponenteoccurrences
ooccs = odoc.componentdefinition.occurrences
dim opos als Matrix
set opos = thisapplication.transientgeometry.creatematrix
dim ostep als Doppel
ostep = 0#
dim irow as long
' Fügen Sie ein Ereignis für jedes Mitglied in der Fabrik hinzu.
für irow = 1 zu Inumrows
ostep = ostep + 10
Fügen Sie eine Übersetzung entlang der x-Achse hinzu
opos.settranslation thisapplication.transientgeometry.createvector(ostep, ostep, 0)
dim oocc als Komponente
oocc = ooccs.addipartmember("w:\commesse\aia\15030_modifica zona lavatrici\assieme2.c02.ipt", opos, irow)
Nächste
odoc.save
dim orefdoc als Dokument
für jedes orefdoc in odoc.referenceddocuments
Call exporttostep(orefdoc)
Nächste
Endteil
Public Sub exporttostep(odoc als Dokument)
dim exportpath als string
exportpath = "c:\stp\"
' Holen Sie den Schritt Übersetzer Add-in.
dim osteptranslator als Übersetzeraddin
set osteptranslator = thisapplication.applicationaddins.itembyid("{90af7f40-0c01-11d5-8e83-0010b541cd80}")
wenn osteptranslator nichts ist
msgbox "Kann nicht auf Schritt Übersetzer zugreifen."
Ausgang Sub
Ende
dim ocontext als Übersetzungskontext
set ocontext = thisapplication.transientobjects.createtranslationcontext
dim ooptions als namevaluemap
set ooptions = thisapplication.transientobjects.createnamevaluemap
wenn osteptranslator.hassavecopyasoptions(thisapplication.activedocument, ocontext, ooptions) dann
' setzen Anwendungsprotokoll.
' 2 = ap 203 - Konfiguration gesteuert
' 3 = ap 214 - Automobildesign
ooptions.value("applicationprotocoltype") = 3
Andere Optionen...
'ooptions.value("autor") = "
'ooptions.value("Autorisierung") = "
'ooptions.value("description") = "
'ooptions.value("Organisation") = "
ocontext.type = kfilebrowseiomechanism
dim odata als Datenmedium
set odata = thisapplication.transientobjects.createdatamedium
'Format Dateiname
dim fnamepos as long
'Post des letzten Rückens
fnamepos = instrrev(odoc.fullfilename, "\", -1)
dim docfname als String
'Dateiname mit Erweiterung
docfname = strings.right(odoc.fullfilename, len(odoc.fullfilename) - fnamepos)
'Dateiname ohne Erweiterung
dim Shortname als String
Kurzname = strings.left(docfname, len(docfname) - 4)
odata.filename = exportpath & shortname & ".stp"
call osteptranslator.savecopyas(odoc, ocontext, ooptions, odata)
Ende
Endteil