Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: parts list with image #2241

    polo
    Participant

    Thanks for the help,
    Here is my end (working) macro:

    Sub CATMain()
    ‘Cette macro permet de créer une part liste dans excel avec des images associé

    Dim doc As Documents
    Set doc = CATIA.Documents

    Set oexcel = CreateObject(“excel.application”)
    oexcel.Visible = True
    oexcel.Application.Workbooks.Add
    Set oexcelsheet = oexcel.Workbooks(oexcel.ActiveWorkbook.Name).Sheets(1)
    oexcelsheet.Range(“A” & 1).ColumnWidth = 50
    oexcelsheet.Range(“B” & 1).ColumnWidth = 15

    For D = 1 To doc.Count

    If TypeName(doc.Item(D)) Like “PartDocument” Then

    Dim partDocument1 As PartDocument
    Set partDocument1 = doc.Open(doc.Item(D).FullName)

    Dim MyViewer1 As Viewer
    Set MyViewer1 = CATIA.ActiveWindow.ActiveViewer

    Dim specsAndGeomWindow1 As SpecsAndGeomWindow
    Set specsAndGeomWindow1 = CATIA.ActiveWindow

    Dim viewer3D1 As Viewer3D
    Set viewer3D1 = specsAndGeomWindow1.ActiveViewer

    Dim viewpoint3D1 As Viewpoint3D
    Set viewpoint3D1 = viewer3D1.Viewpoint3D

    MyViewer1.Viewpoint3D = CATIA.ActiveDocument.Cameras.Item(1)

    MyViewer1.Reframe

    Dim Chemin As String
    Chemin = “C:\Documents and Settings\co051\Bureau\Nouveau dossier\” & doc.Item(D).Name & “.jpeg”

    Dim MyViewer
    Set MyViewer = CATIA.ActiveWindow.ActiveViewer
    ‘—–Memorise le BackGround d’origine
    Dim color(2)
    Dim MyViewer_deb
    Set MyViewer_deb = MyViewer
    MyViewer_deb.GetBackgroundColor color
    ‘—–Passe en fond blanc
    MyViewer_deb.PutBackgroundColor Array(1, 1, 1)

    CATIA.StartCommand “Boussole”
    CATIA.StartCommand “Arbre de spécifications”
    MyViewer1.CaptureToFile catCaptureFormatJPEG, Chemin
    CATIA.StartCommand “Boussole”
    CATIA.StartCommand “Arbre de spécifications”
    partDocument1.Close

    ‘—–Retour au fond d’écran d’origine
    MyViewer_deb.PutBackgroundColor (color)

    oexcelsheet.Range(“A” & D).Value = doc.Item(D).Name
    oexcelsheet.Range(“A” & D).RowHeight = 100

    Dim ImageName As String
    ImageName = “Image” & D
    oexcelsheet.Range(“B” & D).Select
    oexcelsheet.Pictures.Insert(Chemin).Name = ImageName
    With oexcelsheet.Shapes(ImageName)
    .Left = 100
    .Top = 100
    .Width = 100
    .Height = 100
    End With

    oexcelsheet.Shapes(ImageName).Cut
    oexcelsheet.Range(“B” & D).Select
    oexcelsheet.Pictures.Paste
    End If

    Next

    ‘—–Retour au fond d’écran d’origine
    MyViewer_deb.PutBackgroundColor (color)
    End Sub

    in reply to: parts list with image #2202

    polo
    Participant

    Okay I’m slowly getting there, but I can’t find how to change the view to isometric by macro… can anyone help?

    in reply to: Introduce Yourself #2201

    polo
    Participant

    Hi all,
    This looks like a great site you’ve got going here.
    I’m an aerospace engineer and I thank you for all the macro tips you give.
    Polo

Viewing 3 posts - 1 through 3 (of 3 total)