iLogic to export each view on individual page

iLogic to export each view on individual page

frederik_vollbrecht
Advocate Advocate
822 Views
6 Replies
Message 1 of 7

iLogic to export each view on individual page

frederik_vollbrecht
Advocate
Advocate

Hello guys,

 

here is a Problem I this time wasn't able to solve by myself.

Our Marketing want's me to give them 2D views of various products for documentation. They need each view (top, left, buttom, right, isometric)

 

As they are coloring the views afterwards in coreldraw, they asked me if it is possible to export each view either to a individual page.

So I created a Master-Sheet and moved all views to new Pages, witch I created.

 

Is it possible to do this with iLogic? In sum:

  1. create views
  2. create new sheet
    • optional rename each page to top;left;right etc
  3. Move each view to the created sheet
  4. center view on sheet
  5. run my script I already have (Export PDF; Export DXF)

Thank you guys for the help.

 

 

0 Likes
Accepted solutions (2)
823 Views
6 Replies
Replies (6)
Message 2 of 7

AlexFielder
Advisor
Advisor

Here's some Pseudo-code (iLogic) but I would do this:

Dim tmpDrawing as DrawingDocument 
For each drawingsheet as sheet in Thisapplication.activedocument 'assumes activedocument is a drawing
tmpDrawing = CreateTemporaryDrawing() 'search on these forums for how to create a new drawing file from scratch
drawingsheet.CopyTo(tmpDrawing)
tmpdrawing.saveas(drawingsheet.name)
next

OR:

 

Perhaps there's an "each sheet as a separate page" option in the PDF Export mechanic - IIRC there's a sample in the iLogic custom snippets window.

 

 

0 Likes
Message 3 of 7

frederik_vollbrecht
Advocate
Advocate

It's ok for me to export the pdf with all sheets in one document. All I need is each view on a separate sheet. Have a look to the pdf how it (nearly) should look like. The views will have to be centered also.

 

 

0 Likes
Message 4 of 7

Anonymous
Not applicable
Accepted solution

this will put a list of assembly views on document.

I am not sure what size your working with , what scale the drawing is .........

anyways you do a little filing to fit, paint to match ...........

 

 

kl

 

SyntaxEditor Code Snippet

Imports Inventor.ViewOrientationTypeEnum
Imports Inventor.DrawingViewStyleEnum
Imports Inventor.PointIntentEnum
Imports Inventor.DimensionTypeEnum
Imports Inventor.DrawingCurveSegmentEnum
Imports Inventor.DrawingCurveEnum
Imports Inventor.CurveTypeEnum

Sub Main
    Dim oAsmDoc as AssemblyDocument = ThisApplication.ActiveDocument
    Dim oAsmCompDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition

    Dim AssemblyDocName As String     
    AssemblyDocName = ThisDoc.FileName(False) 'without extension
    Dim path As String = ThisDoc.Path
    Dim partDir As String = path & "\parts"
    Dim templateFile As String = partdir & "\StandardB.idw"

    Dim oAssem_DrawingDoc As DrawingDocument
    Assem_DrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject,templateFile, True)

    'Get the Sheets collection
    oSheets = ThisApplication.ActiveDocument.Sheets
    'Get the first sheet
    oSheet = oSheets.Item(1)            

    'Set the View Scales
    Dim DrawingViewScale As Double 
    DrawingViewScale = 1/24
    '
    Dim oTG As TransientGeometry
    oTG = ThisApplication.TransientGeometry

    Dim oTextPos As Point2d
    Dim oPointOne As Point2d
    Dim oPointTwo As Point2d
    Dim oViewPos As Point2d
    oPointOne = oTG.CreatePoint2d(25, 13.5)
    
    Dim vws = {kFrontViewOrientation,kBackViewOrientation,kLeftViewOrientation,kRightViewOrientation, _
                kTopViewOrientation,kBottomViewOrientation,kIsoTopRightViewOrientation}
    For Each view As String in vws
        oSheet = oSheets(oSheets.Count)
        Try 
            oBaseView = oSheet.DrawingViews.AddBaseView(oAsmDoc, oPointOne, DrawingViewScale, view, kHiddenLineRemovedDrawingViewStyle, "Default")
        Catch ex As exception
            MessageBox.Show(ex.ToString & view, "BaseView")
        End Try
        oSheets.Add
    Next
End Sub          'main

 

 

Message 5 of 7

frederik_vollbrecht
Advocate
Advocate

@Anonymousschrieb:

this will put a list of assembly views on document.

I am not sure what size your working with , what scale the drawing is .........

anyways you do a little filing to fit, paint to match ...........

 

 

kl

 

SyntaxEditor Code Snippet

Imports Inventor.ViewOrientationTypeEnum
Imports Inventor.DrawingViewStyleEnum
Imports Inventor.PointIntentEnum
Imports Inventor.DimensionTypeEnum
Imports Inventor.DrawingCurveSegmentEnum
Imports Inventor.DrawingCurveEnum
Imports Inventor.CurveTypeEnum

Sub Main
    Dim oAsmDoc as AssemblyDocument = ThisApplication.ActiveDocument
    Dim oAsmCompDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition

    Dim AssemblyDocName As String     
    AssemblyDocName = ThisDoc.FileName(False) 'without extension
    Dim path As String = ThisDoc.Path
    Dim partDir As String = path & "\parts"
    Dim templateFile As String = partdir & "\StandardB.idw"

    Dim oAssem_DrawingDoc As DrawingDocument
    Assem_DrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject,templateFile, True)

    'Get the Sheets collection
    oSheets = ThisApplication.ActiveDocument.Sheets
    'Get the first sheet
    oSheet = oSheets.Item(1)            

    'Set the View Scales
    Dim DrawingViewScale As Double 
    DrawingViewScale = 1/24
    '
    Dim oTG As TransientGeometry
    oTG = ThisApplication.TransientGeometry

    Dim oTextPos As Point2d
    Dim oPointOne As Point2d
    Dim oPointTwo As Point2d
    Dim oViewPos As Point2d
    oPointOne = oTG.CreatePoint2d(25, 13.5)
    
    Dim vws = {kFrontViewOrientation,kBackViewOrientation,kLeftViewOrientation,kRightViewOrientation, _
                kTopViewOrientation,kBottomViewOrientation,kIsoTopRightViewOrientation}
    For Each view As String in vws
        oSheet = oSheets(oSheets.Count)
        Try 
            oBaseView = oSheet.DrawingViews.AddBaseView(oAsmDoc, oPointOne, DrawingViewScale, view, kHiddenLineRemovedDrawingViewStyle, "Default")
        Catch ex As exception
            MessageBox.Show(ex.ToString & view, "BaseView")
        End Try
        oSheets.Add
    Next
End Sub          'main

 

 Works like a charm. Tweaked the code a bit due to my template files and set the scale to 1/1
Great job !


 

0 Likes
Message 6 of 7

frederik_vollbrecht
Advocate
Advocate

I am struggeling a bit with the sheet size of the pages.

The first page is A4 Landscape as defined in my template, but any page created later is in Format C.
The sheet size isn't defined in the code, so ist this maybe a error from my template?

0 Likes
Message 7 of 7

Anonymous
Not applicable
Accepted solution

Try adding the imports at the top of the file and change the out the oSheets.Add call to what is below.

SyntaxEditor Code Snippet

Imports Inventor.DrawingSheetSizeEnum
Imports Inventor.PageOrientationTypeEnum

SyntaxEditor Code Snippet

        oSheets.Add(kA1DrawingSheetSize,kLandscapePageOrientation)

Hope it helps

kl

 

 

0 Likes