Forum:CATIA V5 Programmierung
Thema:Ausdruck zentrieren
Möchten Sie sich registrieren?
Wer darf antworten? Registrierte Benutzer können Beiträge verfassen.
Hinweise zur Registrierung Sie müssen registriert sein, um Beiträge oder Antworten auf Beiträge schreiben zu können.
Ihr Benutzername:
Ihr Kennwort:   Kennwort vergessen?
Anhang:    Datei(en) anhängen  <?>   Anhänge verwalten  <?>
Grafik für den Beitrag:                                                
                                                       
Ihre Antwort:

Fachbegriff
URL
Email
Fett
Kursiv
Durchgestr.
Liste
*
Bild
Zitat
Code

*HTML ist AUS
*UBB-Code ist AN
Smilies Legende
Netiquette

10 20 40

Optionen Smilies in diesem Beitrag deaktivieren.
Signatur anfügen: die Sie bei den Voreinstellungen angegeben haben.

Wenn Sie bereits registriert sind, aber Ihr Kennwort vergessen haben, klicken Sie bitte hier.

Bitte drücken Sie nicht mehrfach auf "Antwort speichern".

*Ist HTML- und/oder UBB-Code aktiviert, dann können Sie HTML und/oder UBB Code in Ihrem Beitrag verwenden.

T H E M A     A N S E H E N
CadV5UserR

Beiträge: 78 / 0

Windows 7 x64 Professional SP1
Dell Precision T3500
Intel Xeon CPU W3580 3.33GHz
24Gb Ram
NVIDIA Qudro 4000
Catia V5R20 Sp6
SmarTeam V5R20 SP6

Hallo Stephan,


ist schon eine Weile her, habe mal in meinem alten Script nachgeschaut.
Ist auch mit Hilfe dieses Forums endstanden. Du findest wenn du die Suche benutzt weitere Beispiele.

Ich denke du musst noch

drawingSheet1.PageSetUp.FitToSheetFormat = True

einfügen. Dann sollte es gehen.

Falls dir weitere Optionen fehlen, schau mal in der

V5Automation.chm

rein. Dort findest du einige Infos.

Hier mein Script:


-----------------------------------

Language="VBSCRIPT"

'CATDRAWING nach PDF konvertieren
'--------------------------------------------------------------------------------
' Script um .CATDRAWING Dateien in Originalgröße zu Drucken
'
'
' V0.1 18.03.2008
' V0.2 09.04.2008 - Probleme bei 64bit Rechnern
' V0,3 22.04.2008 - Hochkant Drucken + Mehrseitiges Drucken
' V0,4 27.05.2008      - Zeichnungs - Update
'
'--------------------------------------------------------------------------------

Dim documents1 As Documents
Dim document1 As Document
Dim drawingDocument1 As Document
Dim drawingSheets1 As DrawingSheets
Dim drawingSheet1 As DrawingSheet

Dim selection1 As Selection
Dim selection2 As Selection
Dim specsAndGeomWindow1 As Window


Dim Ordner As Folder
Dim Dateien As Files
Dim Datei As File

Dim aktiverDrucker

'---------------- 3D Referencen setzen--
Dim settingControllers1 As SettingControllers
Set settingControllers1 = CATIA.SettingControllers

Dim generalSessionSettingAtt1 As SettingController
Set generalSessionSettingAtt1 = settingControllers1.Item("CATCafGeneralSessionSettingCtrl")

'------------------------------------

Sub CATMain()

druckanzahl = InputBox ("Tool : DRW_Drucken auf A4/A3" & chr(13) & chr(10) & chr(13) & chr(10) & chr(13) & chr(10) & "Erklärung:" & chr(10) & chr(13) &"Nach dem Öffnen EINER Drafting aus dem Start- / Zielverzeichnis"& chr(13) & chr(10)&"werden nacheinander ALLE Draftings gedruckt." & chr(13) & chr(10) & chr(13) & chr(10)&"Wie oft soll jede Zeichnung gedruckt werden?"& chr(13) & chr(10),"Eingabe","1",500,1000)


' filename =Catia.FileSelectionBox ("Datei Öffnen","*.CATDrawing", CATFileSelectionModeOpen)

Dim Shell
Set Shell = CreateObject("Shell.Application")

Pfad = Shell.BrowseForFolder(0,"Wählen Sie bitte den Ordner mit den Dateien aus", 0).Self.Path


If  Pfad <>"" Then

ausdruck=0

folderinput = Pfad & "\"
folderoutput =folderinput

Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderinput)
Set fc = f.Files

For Each f1 in fc

Set documents1 = CATIA.Documents


PFADEINGABE =  folderinput & f1.name


If (InStr( PFADEINGABE,".CATDrawing")) <> 0  Then

generalSessionSettingAtt1.RefDoc = False
generalSessionSettingAtt1.SaveRepository

Set document1 = documents1.NewFrom(PFADEINGABE)

Set drawingDocument1 = CATIA.ActiveDocument

drawingDocument1.Standard = 1

Set drawingSheets1 = drawingDocument1.Sheets


'----------------------------------------------------------------------------
Counter1 = drawingSheets1.Count

DruckerSuchenZAT

For I=1 to Counter1

Set drawingSheet1 = drawingSheets1.Item( I )
drawingSheet1.Activate
' MsgBox ( I & "        " &  Counter1 )

For NN=1 To druckanzahl
DruckerZAT
ausdruck=ausdruck+1
Next

Next

'*******************************************
Set specsAndGeomWindow1 = CATIA.ActiveWindow

specsAndGeomWindow1.Close

Set drawingDocument1 = CATIA.ActiveDocument

drawingDocument1.Close

generalSessionSettingAtt1.RefDoc = True

generalSessionSettingAtt1.SaveRepository


' s = s & f1.name
If Counter1 > 1 Then
' s=s & "     Bl.anz.= " & Counter1 & vbCrLf & vbCrLf
End If
' s = s & vbCrLf

End If

Next

MsgBox "Fertig !" & vbCrLf & s & vbCrLf & "Gedruckt : " & ausdruck & "  Zeichnungen"

End If

End Sub

'************************************************************************************************************
'** Drucker suchen!!!

Sub DruckerSuchenZAT


For N=1 To CATIA.Printers.Count
' MsgBox CATIA.Printers.Item(N).Name
If ((InStr( CATIA.Printers.Item(N).Name,"5200")) <> 0 AND  (InStr( CATIA.Printers.Item(N).Name,"4")))Then
aktiverDrucker=CATIA.Printers.Item(N).Name
' MsgBox CATIA.Printers.Item(N).Name
End If
Next

End Sub

'************************************************************************************************************
'** Drucker einrichten
'*

Sub DruckerZAT

Dim CATIA As CATIA.Application
Set CATIA = CreateObject("CATIA.Application")
Dim doc As Documents
Set doc = CATIA.Documents


If doc.Count = 0 Then Exit Sub
Dim drawingDocument1 As Document
Set drawingDocument1 = CATIA.ActiveDocument

Dim drawingSheets1 As DrawingSheets
Set drawingSheets1 = drawingDocument1.Sheets


Dim drawingSheet1 As DrawingSheet
Set drawingSheet1 = drawingSheets1.ActiveSheet

BlattFormat = drawingSheet1.PaperSize

' MsgBox " Blatt ist DIN A"&(BlattFormat-2)


'******** Update ***********
drawingSheet1.Update

'******** Error Meldungen********
Err.Clear
On Error Resume Next

'**************************************************************************
If BlattFormat = 6 Then
CATIA.Application.ActivePrinter = CATIA.Printers.Item(aktiverDrucker)

'------------------------------------------
'-  parameters - DIN A4 auf A4
'------------------------------------------

drawingSheet1.PageSetUp.PaperWidth = 210
drawingSheet1.PageSetUp.PaperHeight = 297
drawingSheet1.PageSetup.PaperSize = catPaperA4
drawingSheet1.PageSetup.Rotation = 0
drawingSheet1.PageSetUp.Orientation = 0
drawingSheet1.PageSetUp.LeftMargin = 0
drawingSheet1.PageSetUp.RightMargin = 0
drawingSheet1.PageSetUp.TopMargin = 0
drawingSheet1.PageSetUp.BottomMargin = 0

' drawingSheet1.PageSetUp.FitToSheetFormat = False
' drawingSheet1.PageSetUp.MaximumSize = True
drawingSheet1.PageSetUp.Left = 0
drawingSheet1.PageSetUp.Bottom = 0
drawingSheet1.PageSetUp.Zoom = 100
drawingSheet1.pageSetup.Scaling1To1 = True
drawingSheet1.pageSetup.Color = 2
' drawingSheet1.PageSetUp.Banner = "Gedruckt am $DATE um $TIME"
' drawingSheet1.PageSetUp.BannerPosition = 2

' Dim Document As CATIADocument
Set Document = CATIA.ActiveDocument
Document.CurrentFilter = "Alle sichtbar"

'**************************************************************************

ElseIf BlattFormat = 5 Then
' CATIA.Application.ActivePrinter = CATIA.Printers.Item("Laser_Konstruktion")
' CATIA.Application.ActivePrinter = CATIA.Printers.Item("HP LaserJet 8000 Series PS")
CATIA.Application.ActivePrinter = CATIA.Printers.Item(aktiverDrucker)

'------------------------------------------
'-  parameters - DIN A3 auf A4
'------------------------------------------


drawingSheet1.PageSetUp.PaperWidth = 297
drawingSheet1.PageSetUp.PaperHeight = 210
drawingSheet1.PageSetup.PaperSize = catPaperA4
drawingSheet1.PageSetup.Rotation = 1
drawingSheet1.PageSetUp.Orientation = 0
drawingSheet1.PageSetUp.LeftMargin = 0
drawingSheet1.PageSetUp.RightMargin = 0
drawingSheet1.PageSetUp.TopMargin = 0
drawingSheet1.PageSetUp.BottomMargin = 0

' drawingSheet1.PageSetUp.FitToSheetFormat = False
' drawingSheet1.PageSetUp.MaximumSize = True
drawingSheet1.PageSetUp.Left = 0
drawingSheet1.PageSetUp.Bottom = 0
drawingSheet1.PageSetUp.Zoom = 50
drawingSheet1.pageSetup.Scaling1To1 = False
drawingSheet1.pageSetup.Color = 2
' drawingSheet1.PageSetUp.Banner = "Gedruckt am $DATE um $TIME"
' drawingSheet1.PageSetUp.BannerPosition = 3

' Dim Document As CATIADocument
Set Document = CATIA.ActiveDocument
Document.CurrentFilter = "Alle sichtbar"

'**************************************************************************

ElseIf BlattFormat = 4 Then
' CATIA.Application.ActivePrinter = CATIA.Printers.Item("HP LaserJet 8000 Series PS")
CATIA.Application.ActivePrinter = CATIA.Printers.Item(aktiverDrucker)

'------------------------------------------
'-  parameters - DIN A2 auf A4
'------------------------------------------


drawingSheet1.PageSetUp.PaperWidth = 297
drawingSheet1.PageSetUp.PaperHeight = 210
drawingSheet1.PageSetup.PaperSize = catPaperA4
drawingSheet1.PageSetup.Rotation = 1
drawingSheet1.PageSetUp.Orientation = 0
drawingSheet1.PageSetUp.LeftMargin = 0
drawingSheet1.PageSetUp.RightMargin = 0
drawingSheet1.PageSetUp.TopMargin = 0
drawingSheet1.PageSetUp.BottomMargin = 0

' drawingSheet1.PageSetUp.FitToSheetFormat = False
' drawingSheet1.PageSetUp.MaximumSize = True
drawingSheet1.PageSetUp.Left = 0
drawingSheet1.PageSetUp.Bottom = 0
drawingSheet1.PageSetUp.Zoom = 25
drawingSheet1.pageSetup.Scaling1To1 = False
drawingSheet1.pageSetup.Color = 2
' drawingSheet1.PageSetUp.Banner = "Gedruckt am $DATE um $TIME"
' drawingSheet1.PageSetUp.BannerPosition = 3

' Dim Document As CATIADocument
Set Document = CATIA.ActiveDocument
Document.CurrentFilter = "Alle sichtbar"

'**************************************************************************

ElseIf BlattFormat = 3 Then
' CATIA.Application.ActivePrinter = CATIA.Printers.Item("HP LaserJet 8000 Series PS")
CATIA.Application.ActivePrinter = CATIA.Printers.Item(aktiverDrucker)

'------------------------------------------
'-  parameters - A1 auf A3
'------------------------------------------

drawingSheet1.PageSetUp.PaperWidth = 420
drawingSheet1.PageSetUp.PaperHeight = 297
drawingSheet1.PageSetup.PaperSize = catPaperA3
drawingSheet1.PageSetup.Rotation = 1
drawingSheet1.PageSetUp.Orientation = 0
drawingSheet1.PageSetUp.LeftMargin = 0
drawingSheet1.PageSetUp.RightMargin = 0
drawingSheet1.PageSetUp.TopMargin = 0
drawingSheet1.PageSetUp.BottomMargin = 0

' drawingSheet1.PageSetUp.FitToSheetFormat = False
' drawingSheet1.PageSetUp.MaximumSize = True
drawingSheet1.PageSetUp.Left = 0
drawingSheet1.PageSetUp.Bottom = 0
drawingSheet1.PageSetUp.Zoom = 25
drawingSheet1.pageSetup.Scaling1To1 = False
drawingSheet1.pageSetup.Color = 2
' drawingSheet1.PageSetUp.Banner = "Gedruckt am $DATE um $TIME"
' drawingSheet1.PageSetUp.BannerPosition = 3

' Dim Document As CATIADocument
Set Document = CATIA.ActiveDocument
Document.CurrentFilter = "Alle sichtbar"


'**************************************************************************

ElseIf BlattFormat = 2 Then
' CATIA.Application.ActivePrinter = CATIA.Printers.Item("HP LaserJet 8000 Series PS")
CATIA.Application.ActivePrinter = CATIA.Printers.Item(aktiverDrucker)


'------------------------------------------
'-  parameters - A0 auf A3
'------------------------------------------


drawingSheet1.PageSetUp.PaperWidth = 420
drawingSheet1.PageSetUp.PaperHeight = 297
drawingSheet1.PageSetup.PaperSize = catPaperA3
drawingSheet1.PageSetup.Rotation = 1
drawingSheet1.PageSetUp.Orientation = 0
drawingSheet1.PageSetUp.LeftMargin = 0
drawingSheet1.PageSetUp.RightMargin = 0
drawingSheet1.PageSetUp.TopMargin = 0
drawingSheet1.PageSetUp.BottomMargin = 0

drawingSheet1.PageSetUp.FitToSheetFormat = True
drawingSheet1.PageSetUp.MaximumSize = True
drawingSheet1.PageSetUp.Left = 0
drawingSheet1.PageSetUp.Bottom = 0
drawingSheet1.PageSetUp.Zoom = 12
drawingSheet1.pageSetup.Scaling1To1 = False
drawingSheet1.pageSetup.Color = 2
' drawingSheet1.PageSetUp.Banner = "Gedruckt am $DATE um $TIME"
' drawingSheet1.PageSetUp.BannerPosition = 3

' Dim Document As CATIADocument
Set Document = CATIA.ActiveDocument
Document.CurrentFilter = "Alle sichtbar"


End If
' drawingSheet1.PaperName = " Druck"
drawingSheet1.PrintOut

If Err = 0 Then
' logFile.Write "  Printing done "
Else
' logFile.Write"Fehler beim Drucken - Kein Drucker gefunden"
MsgBox " Fehler beim Drucken - Kein Drucker gefunden - Falscher Drucker-Name im Makro"
Err.Clear
End If

End Sub
-----------------------------------

Ich hoffe, dieses Hilft dir weiter.

Nachtrag: Das Script druckt alle Formate auf A3 und A4 verkleinert aus.


Grüße,
Ralf

[Diese Nachricht wurde von CadV5UserR am 24. Sep. 2014 editiert.]