Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Save Copy As configuration settings for 1 of 3 sheets

2 REPLIES 2
Reply
Message 1 of 3
DonHostetlerWMF
333 Views, 2 Replies

Save Copy As configuration settings for 1 of 3 sheets

Is there any way to save the configuration of a "Save Copy As" (to dxf) so that it only saves out the 2nd of a 3-sheet idw?  We can click off the "all sheets" and manually choose the 2nd sheet, but that only works for the immediate process.  The configuration will not hold the 2nd sheet only choice, defaulting back to the 1st or top sheet only when we do go to 'save out' on subsequent documents.

 

Thanks in advance,

Don - Inventor 2014

2 REPLIES 2
Message 2 of 3
noontz
in reply to: DonHostetlerWMF

Using the Sheet.DataIO.WriteDataToFile() on the individual sheet might be the way to go for dxf.

Message 3 of 3
GosponZ
in reply to: DonHostetlerWMF

Try this one it will let you choose which sheet you want to save as dxf

oPath = ThisDoc.Path

 

        oFileName = ThisDoc.FileName(False) 'without extension

 

        oDXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")

 

        oDocument = ThisApplication.ActiveDocument

 

        oContext = ThisApplication.TransientObjects.CreateTranslationContext

 

        oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism

 

        oOptions = ThisApplication.TransientObjects.CreateNameValueMap

 

        oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

 

 

 

 

 

        'Define the drawing

 

        Dim oDrawing As DrawingDocument

 

        oDrawing = ThisDoc.Document

 

 

 

        Dim oSheet As Sheet

 

        Dim lPos As Long

 

        Dim rPos As Long

 

        Dim sLen As Long

 

        Dim sSheetName As String

 

        Dim sSheetNumber As Integer

 

 

 

        'step through each drawing sheet

 

Dim Response As MsgboxResult

 

        For Each oSheet In oDrawing.Sheets

 

            Response = MsgBox("Yes = Save or No = Continue to next Sheet?", MsgBoxStyle.YesNo, "Question")

            If Response = MsgBoxResult.Yes Then

 

                'find the seperator in the sheet name:number

 

                lPos = InStr(oSheet.Name, ":")

 

 

 

                'find the number of characters in the sheet name

 

                sLen = Len(oSheet.Name)

 

 

 

                'find the sheet name

 

                sSheetName = Left(oSheet.Name, lPos - 1)

 

 

 

                'find the sheet number

 

                sSheetNumber = Right(oSheet.Name, sLen - lPos)

 

ActiveSheet = ThisDrawing.Sheet(oSheet.Name)

 

 

                'get DXF target folder path

 

                oFolder = "C:\INVENTOR DXF FILES"

 

 

 

                'Set the DXF target file name

 

                oDataMedium.FileName = oFolder & "\" &  sSheetName &  sSheetNumber & ".dxf"

 

 

                MessageBox.Show("DXF SAVED TO: " & oDataMedium.FileName, "DXF Saved", MessageBoxButtons.OK)

 

                'Publish document

 

                oDXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

 

            End If

        Next

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report