- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've been tweaking a .dxf export rule, and I've ran into a problem.
I can't create the folder on our server drive. Its a seperate server, and I'm pretty sure,
I have admin access.
The thing is that I can manually create a folder, with the right name, and then the files,
will be able to save to that folder.
The variale aOrdreNr is a userparameter, I have in my assembly. Its put as unitless.
Is there a way to get around this problem?
Mind you, this works if I use the C: drive, as path.
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType <> kAssemblyDocumentObject Then
MessageBox.Show("Denne funktion SKAL køres i Assembly fil", "DABO")
Exit Sub
End If
RUsure = MessageBox.Show ( _
"Denne funktion vil lave DXF Filer af alle dele i samlingen." _
& vbLf & " " _
& vbLf & "Sørg for at funktionen GEM ALLE SOM KOPI har kørt inden denne funktion." _
& vbLf & "Denne funktion kan tage tid. Din mappe bliver vist tilsidst.", "DABO Export DXF ",MessageBoxButtons.YesNo)
If RUsure = vbNo Then
Return
Else
End If
oPath = ("C:\Gulvsug\" & aOrdreNr & "\")
Dim oRefDocs As DocumentsEnumerator
Dim oRefDoc As Document
oRefDocs = oDoc.AllReferencedDocuments
For Each oRefDoc In oRefDocs
Dim oCurFile As Document 'current file
Try
oCurFile = ThisApplication.Documents.Open(oRefDoc.FullFileName, False)
Catch
GoTo NextIteration
End Try
If oCurFile.DocumentSubType.DocumentSubTypeID <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
oCurFile.Close(True)
Else
oCurFileName = oCurFile.FullFileName
FNamePos = InStrRev(oCurFileName, "\", -1)
FName = Right(oCurFileName, Len(oCurFileName) - FNamePos)
FName = Left(FName, Len(FName) - 4)
DxfName = oPath & aOrdreNr & "-" & aOrdrePre & " " & FName & ".dxf"
Dim oSMCD As SheetMetalComponentDefinition = oCurFile.ComponentDefinition
If Not oSMCD.HasFlatPattern Then
oSMCD.Unfold()
oSMCD.FlatPattern.ExitEdit()
End If
Dim sOut As String = "FLAT PATTERN DXF?AcadVersion=2004" _
+ "&OuterProfileLayer=IV_INTERIOR_PROFILES" _
+ "&InvisibleLayers=IV_TANGENT;IV_FEATURE_PROFILES_DOWN;IV_BEND;IV_BEND_DOWN;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;IV_ARC_CENTERS;IV_FEATURE_PROFILES;IV_FEATURE_PROFILES_DOWN;IV_ALTREP_FRONT;IV_ALTREP_BACK;IV_ROLL_TANGENT;IV_ROLL" _
+ "&SimplifySplines=True" _
+ "&BendLayerColor=255;255;0"
Try
oSMCD.DataIO.WriteDataToFile(sOut, DxfName)
Catch
End Try
oCurFile.Close(True)
End If
NextIteration:
Next
MessageBox.Show("Alle DXF Filer exporteret til: " & vbLf & oPath & vbLf & vbLf & "Tjek venligst filerne, inden brug.", "DABO")
Shell("explorer.exe " & oPath,vbNormalFocus)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
I can't see any line where you create the directory. *???*
You can test if directory exist and create otherwise. If creation fails, you can exit your sub
Dim sPath As String = "C:\Gulvsug\" & aOrdreNr & "\"
Dim oDirInfo As System.IO.DirectoryInfo
If Not System.IO.Directory.Exists(sPath) Then
oDirInfo = System.IO.Directory.CreateDirectory(sPath)
If oDirInfo Is Nothing Then
MsgBox("Error creating Directory " & sPath, , "iLogic DXF-Export")
Exit Sub
End If
End If
R. Krieg
RKW Solutions
www.rkw-solutions.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I got an error, from the line, where it pulls on the directoryInfo,
but insted I tweaked it a little and now it works.
If System.IO.Directory.Exists(oPath) = False Then
System.IO.Directory.CreateDirectory(oPath)
ElseIf System.IO.Directory.Exists(oPath) = True Then
End IfThanks for the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@mhoE3YPJ wrote:I got an error, from the line, where it pulls on the directoryInfo,
but insted I tweaked it a little and now it works.
If System.IO.Directory.Exists(oPath) = False Then
System.IO.Directory.CreateDirectory(oPath)
ElseIf System.IO.Directory.Exists(oPath) = True Then
End If
Thanks for the help!
You can save yourself some lines with this instead:
If System.IO.Directory.Exists(oPath) = False Then System.IO.Directory.CreateDirectory(oPath)
Also, where are to defining what aOrdreNr is?
Don't you need to have something like this before you define oPath?
aOrdreNr = iProperties.value("Project","Stock Number")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks for the tip!
As I think I stated before, aOrdreNr is a userparameter in my assembly file.
I use a form, as seen below, where I change userparameters, and update my assembly.
After which I'll make the .dxf files.
I get that it doesn't look that pretty, but it's very efficient, as to I usually have an excel document, with linked
parameters, and I usually save my .dxf files manually.
I dont know if there's an easy way to make an input for iProperties in forms?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sorry, I missed that you stated it in your post ![]()
For iProperties input: Is this what you're after?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Somehow I've completly missed that ![]()
I'm somewhat new to the whole iLogic department,
but I think if I use the iProperties, it'll make it look a lot more clean.
Thanks for the nice idea! I'll update when I've added them