Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have a rule that creates a dxf from a face in a sheet metal part. When I run the rule, but there is already a dxf from the part it still overwrites the dxf. I want to prevent to overwrite an existing dxf file.
Is there a simple code to stop the action/rule when there is already a dxf file of the part?
This is the rule:
'check that this active document is a part file If ThisApplication.ActiveDocument.DocumentType <> kPartDocumentObject Then MessageBox.Show ("Please open a part document", "iLogic") End If ''Set Variables 'Set a reference to the active document Dim oDoc As PartDocument oDoc = ThisApplication.ActiveDocument oQty = iProperties.Value(docFName, "Project", "Stock Number") oMat = iProperties.Value(docFName, "Summary", "Comments") oFolder = ThisDoc.Path & "\" oFileName = ThisDoc.FileName(False) & oMat & oQty & ".dxf" 'without extension 'add filename to memory for file save dialog Dim Cm As CommandManager Cm = ThisApplication.CommandManager Cm.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, oFolder & oFileName ) Dim oSelectSet As SelectSet oSelectSet = oDoc.SelectSet oDoc.SelectSet.Clear() 'Check for the DXF folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If 'SELECTION CODE Dim oFace As Face oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select a face") If (oFace Is Nothing) Then Return Else Call oDoc.SelectSet.Select(oFace) End If ' EXPORT CODE 1 Dim oCtrlDef As ButtonDefinition oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("GeomToDXFCommand") Call oCtrlDef.Execute 'CLEAR selectset oDoc.SelectSet.Clear()
Thanks for the help,
Luc
Solved! Go to Solution.