dxf templates

dxf templates

Anonymous
Not applicable
344 Views
2 Replies
Message 1 of 3

dxf templates

Anonymous
Not applicable

hey guys this is my dxf coding but i want to set the dxfs to a template for lines etc how do i reference it please

 

SyntaxEditor Code Snippet

'START QUESTION BOX
Quit=MessageBox.Show("Do you wish to Export DXF'S For Parts?","DXF Export",MessageBoxButtons.YesNo)
If Quit=7 Then
Exit Sub
End If

pat=ThisDoc.Path
MessageBox.Show(pat, "Title")
saleno = Right(pat,8)

ThisDoc.Launch(pat & "\FRM-" & saleno & "-CASE SIDE C&D.ipt")
iLogicVb.RunRule("FRM-" & saleno & "-CASE SIDE C&D.ipt","FLAT")

ThisDoc.Launch(pat & "\FLT-" & saleno & "-CASE SIDE A&B.ipt")
iLogicVb.RunRule("FLT-" & saleno & "-CASE SIDE A&B.ipt","FLAT")

ThisDoc.Launch(pat & "\FRM-" & saleno & "-SPLITTER LINER.ipt")
iLogicVb.RunRule("FRM-" & saleno & "-SPLITTER LINER.ipt","FLAT")

ThisDoc.Launch(pat & "\FRM-" & saleno & "-SPLITTER WALL NOSE.ipt")
iLogicVb.RunRule("FRM-" & saleno & "-SPLITTER WALL NOSE.ipt","FLAT")

ThisDoc.Launch(pat & "\FRM-" & saleno & "-SPLITTER NOSE.ipt")
iLogicVb.RunRule("FRM-" & saleno & "-SPLITTER NOSE.ipt","FLAT")

ThisDoc.Launch(pat & "\FRM-" & saleno & "-PERFORATED LINER.ipt")
iLogicVb.RunRule("FRM-" & saleno & "-PERFORATED LINER.ipt","FLAT")

iLogicVb.UpdateWhenDone=True
0 Likes
345 Views
2 Replies
Replies (2)
Message 2 of 3

bradeneuropeArthur
Mentor
Mentor

with a INI file

 

Public Sub ExportDxf(oInvApp As Inventor.Application, oDocument As Document, strExportRoot As String, strSuffix As String)

        Dim DXFAddIn As TranslatorAddIn
        DXFAddIn = oInvApp.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")

        Dim fi As System.IO.FileInfo
        fi = New System.IO.FileInfo(oDocument.FullFileName)

        Dim strDirPath As String
        strDirPath = fi.DirectoryName

        Dim strDirName As String
        strDirName = fi.Directory.Name

        Dim strFileNameNoExtension As String
        strFileNameNoExtension = System.IO.Path.GetFileNameWithoutExtension(oDocument.FullFileName)

        Dim strFileRootPath As String
        strFileRootPath = System.IO.Path.GetPathRoot(oDocument.FullFileName)
        strNewDirFilepathDxf = Replace(strDirPath, strFileRootPath, strExportRoot & ":\")
        strNewDirFilepathDxf = Replace(strNewDirFilepathDxf, "_Dwg", "_Dxf")

        Dim oContext As TranslationContext
        oContext = oInvApp.TransientObjects.CreateTranslationContext
        oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism ' kFileBrowseIOMechanism

        ' Create a NameValueMap object
        Dim oOptions As NameValueMap
        oOptions = oInvApp.TransientObjects.CreateNameValueMap

        ' Create a DataMedium object
        Dim oDataMedium As DataMedium
        oDataMedium = oInvApp.TransientObjects.CreateDataMedium

        ' Check whether the translator has 'SaveCopyAs' options
        If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then

            Dim strIniFile As String = Nothing
            Select Case My.Settings.DxfModelOnly
                Case True
                    strIniFile = "YOUR INI FILE"
                Case False
                    strIniFile = "YOUR INI FILE"
            End Select

            ' Create the name-value that specifies the ini file to use.
            oOptions.Value("Export_Acad_IniFile") = strIniFile
        End If

        Try
            MkDir(strNewDirFilepathDxf)
        Catch ex As Exception
            
        End Try

        'Set the destination file name
        oDataMedium.FileName = strNewDirFilepathDxf & "\" & strFileNameNoExtension & strSuffix & ".dxf"

        'Publish document.
        Call DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
    End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 3

Anonymous
Not applicable

im new to this i there a shortor way all i need to do is pick the configured template when saving the dxf line off/on etc ?

0 Likes