Hallo zusammen,
ich bin kein Programmierer, wollte mich aber mal damit beschäftigen und habe mir folgendes zur Aufgabe gestellt:
- Schriftkopf Detail aus einer anderen Zeichnung kopieren.
- Zeichnung aus Pfad öffnen und Detail auf Sheet.1 im Background einfügen.
- Einfügen jedoch nicht per Indicate sondern per x- und y- Koordinaten
Ich benutze dazu das Beispiel CATScript von Dassault und komme bis zum Switch von Sheet.1 in den Background,
doch wie füge ich nun das Detail 'titleblock' (oDitto) per Koordinaten in den Background ein ?
Option Explicit
' COPYRIGHT DASSAULT SYSTEMES 2003
' ***********************************************************************
' Purpose: This macro allows you to instantiate a ditto in
' a view from a ditto in another document
' Author:
' Languages: VBScript
' Locales: English
' CATIA Level: V5R11
' ***********************************************************************
Sub CATMain()
' Set the CATIA popup file alerts to False
' It prevents to stop the macro at each alert during its execution
CATIA.DisplayFileAlerts = False
' Optional: allows to find the sample wherever it's installed
dim sDocPath As String
sDocPath="C:\dx"
If (Not CATIA.FileSystem.FolderExists(sDocPath)) Then
Err.Raise 9999,,"No Doc Path Defined"
End If
' Öffnet das Dokument daß das zu kopierende Ditto enthält
Dim oDrawingSource As DrawingDocument
Set oDrawingSource = CATIA.Documents.Open("C:\dx\Schriftkoepfe.CATDrawing")
' Ermittelt das Sheet auf dem dem daß zu kopierende Ditto liegt
Dim oSheetSource As DrawingSheet
Set oSheetSource = oDrawingSource.Sheets.Item("Sheet.1")
' View abfragen das das zu kopierendene Ditto enthält
Dim oViewSource As DrawingView
Set oViewSource = oSheetSource.Views.Item("titleblock")
' Ditto abfragen
Dim oDitto As DrawingComponent
Set oDitto = oViewSource.Components.Item(1)
' Create an object of selection for the source document
Dim oSelectionSource As Selection
Set oSelectionSource = oDrawingSource.Selection
' Clear the selection
oSelectionSource.Clear
' Add the ditto to be duplicated in the selection
oSelectionSource.Add oDitto
' Copy the view
oSelectionSource.Copy
' Clear the selection
oSelectionSource.Clear
' Öffnet die Zeichnung wo das Ditto eingefügt wird
Dim oDrawingTarget As DrawingDocument
Set oDrawingTarget = CATIA.Documents.Open("C:\dx\test.CATDrawing")
CATIA.ActiveWindow.ActiveViewer.Reframe
' Sheet abfragen wo das ditto eingefügt wird
Dim oSheetTarget As DrawingSheet
Set oSheetTarget = oDrawingTarget.Sheets.Item("Sheet.1")
oSheetTarget.Activate
' Switch zur Background View
Dim odrwviews As DrawingViews
Set odrwviews = oSheetTarget.Views
odrwviews.Item("Background View" ).Activate
' Instanciate Ditto
???????
oder geht man ganz anders vor?
Vielen Dank für Eure Hilfe im Voraus
Muenchner61
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP