Auto Export PDF and DXF with name change

Auto Export PDF and DXF with name change

MuirInvProfessional
Explorer Explorer
209 Views
2 Replies
Message 1 of 3

Auto Export PDF and DXF with name change

MuirInvProfessional
Explorer
Explorer

Hi,

 

I am pretty new to iLogic and still learning a lot by reading in here.

 

We do a lot of parts which are lasercut and we always supply pdf and dxf file to manufaturer/production.

 

So my questions is:

 

Is it possible to create a PDF from sheet 1 with the part number and a DXF from sheet 2 with the addition partnumber-dxf. ?

 

So basically I will always have 2 sheets with the parts I need a pdf+dxf.

 

First sheet will always be the part with dimensions etc. 

Second sheet will always be the part (1 view 1:1 on an empty page)

 

 

Second sheet will always have one drawing view in scale 1:1 and will always be the dxf file.

Also the second page needs to be empty, like no header or anything. could this be included and automatically deleted.

In addition to that,  is it possible to autocheck if the drawing view on sheet 2 (dxf sheet) is in scale 1:1 and if not I would like a promt to change it to do that or to auto set it to 1:1 

 

create a pdf with file name / part numebr as   :    A12345.pdf

create a dxf file with file name / part number :   A12345-DXF.dxf

 

I hope this makes sense and is possible as it would make my life a lot easier.

 

I couldnt find anything helpful in the forum as of yet so if someone can point me in the right direction would be very helpfull.

 

Thanks

0 Likes
210 Views
2 Replies
Replies (2)
Message 2 of 3

C_Haines_ENG
Collaborator
Collaborator

Both are possible, but you should try creating it yourself.

 

Here is how to Create DXFs 

 

Here is how to create PDFs 

 

0 Likes
Message 3 of 3

MuirInvProfessional
Explorer
Explorer
HI, thanks. So I managed to create the dxf.
I just have the problem that the dxf is empty.
I have tried to safe the export dxf.ini from when I do it manually (which works) but without luck.
 
 
 
 
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("This Rule " & iLogicVb.RuleName & " only works on Drawing Documents. Exiting.",vbOKOnly + vbCritical, "WRONG DOCUMENT TYPE")
Return
End If
 
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet = oDDoc.ActiveSheet
 
 
Dim oTempDDoc As DrawingDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject,,False)
Dim oTempSheet As Sheet = oSheet.CopyTo(oTempDDoc)
For Each oTSheet As Sheet In oTempDDoc.Sheets
If oTSheet IsNot oTempSheet Then
oTSheet.Delete
End If
Next
 
Dim oDXF_AddIn As TranslatorAddIn
For Each oAddIn As ApplicationAddIn In ThisApplication.ApplicationAddIns
If oAddIn.DisplayName = "Translator: PDF" Then
oDXF_AddIn = oAddIn
End If
Next
 
Dim oTO As TransientObjects = ThisApplication.TransientObjects
Dim oContext As TranslationContext = oTO.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
Dim oOptions As NameValueMap = oTO.CreateNameValueMap
Dim oDataMedium As DataMedium = oTO.CreateDataMedium
 
 
Dim oPath As String = "H:"
Dim oFName As String = IO.Path.GetFileNameWithoutExtension(oDDoc.FullFileName)
oDataMedium.FileName = oPath & "\" & oFName & "-DXF.dxf"
 
If oDXF_AddIn.HasSaveCopyAsOptions(oTempDDoc, oContext, oOptions) Then
oOptions.Value("Export_Acad_IniFile") = "C:\Users\Public\Documents\Autodesk\Inventor 2021\Design Data\DWG-DXF\exportdxf.ini"
End If
 
'Check to see if the PDF already exists, if it does, ask if you want to over write existing file or not.
If System.IO.File.Exists(oDataMedium.FileName) = True Then
oAnswer = MsgBox("A PDF file with this name already exists." & vbCrLf &
"Do you want to over write it with this new one?",vbYesNo + vbQuestion + vbDefaultButton2, "PDF ALREADY EXISTS")
If oAnswer = vbNo Then Return
End If
 
'Publish DXF
oDXF_AddIn.SaveCopyAs(oTempDDoc, oContext, oOptions, oDataMedium)
 
oTempDDoc.Close(True)

 

 

And this here is the content of the dxf.ini

 

[EXPORT SELECT OPTIONS]
AUTOCAD VERSION=AutoCAD 2007
CREATE AUTOCAD MECHANICAL=No
USE TRANSMITTAL=Yes
USE CUSTOMIZE=No
CUSTOMIZE FILE=Design Data\DWG-DXF\FlatPattern.xml
CREATE LAYER GROUP=No
PARTS ONLY=No
[EXPORT PROPERTIES]
SELECTED PROPERTIES=
[EXPORT DESTINATION]
SPACE=Model
SCALING=Geometry
MAPPING=MapsBest
MODEL GEOMETRY ONLY=No
EXPLODE DIMENSIONS=No
SYMBOLS ARE BLOCKED=Yes
AUTOCAD TEMPLATE=
DESTINATION DXF=Yes
[EXPORT LINE TYPE & LINE SCALE]
LINE TYPE FILE=COMPATIBILITY\Support\invANSI.lin
Continuous=Continuous;0.
Dashed=DASHED;0.
Dashed Space=DASHED_SPACE;0.
Long Dash Dotted=LONG_DASH_DOTTED;0.
Long Dash Double Dot=LONG_DASH_DOUBLE_DOT;0.
Long Dash Triple Dot=LONG_DASH_TRIPLE_DOT;0.
Dotted=DOTTED;0.
Chain=CHAIN;0.
Double Dash Chain=DOUBLE_DASH_CHAIN;0.
Dash Double Dot=DASH_DOUBLE_DOT;0.
Dash Dot=DASH_DOT;0.
Double Dash Dot=DOUBLE_DASH_DOT;0.
Double Dash Double Dot=DOUBLE_DASH_DOUBLE_DOT;0.
Dash Triple Dot=DASH_TRIPLE_DOT;0.
Double Dash Triple Dot=DOUBLE_DASH_TRIPLE_DOT;0.

 

Cheers 

0 Likes