
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How can i get back to folded Sheet Metal Part after export of DXF file made from help API.
Looking that for while because it is depressing clicking so much buttons for save the file.
When you want to save file you have to firstly go to folded sheet metal part. of course one popup is displayed by the time.
Code from API I have already modified to save in the same folder that sheet metal file exist, can be usefull for inventor users. It also get thickness from thickness of sheet metal.
Public Function FilePath(ByVal fullFilename As String) As String
FilePath = Left$(fullFilename, InStrRev(fullFilename, "\"))
End Function
Public Function BaseFilename(ByVal fullFilename As String) As String
Dim temp As String
Dim lentemp As String
Dim count As Long
Dim instrtemp As Long
instrtemp = InStrRev(fullFilename, "\")
lentemp = Len(fullFilename)
count = lentemp - instrtemp
temp = Right$(fullFilename, count)
BaseFilename = Left$(temp, InStrRev(temp, ".") - 1)
End Function
Public Sub WriteSheetMetalDXF()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim fullFilename As String
fullFilename = oDoc.fullFilename()
Dim oSheetMetalCompDef As SheetMetalComponentDefinition
Set oSheetMetalCompDef = oDoc.ComponentDefinition
Dim oDataIO As DataIO
Set oDataIO = oDoc.ComponentDefinition.DataIO
' Build the string that defines the format of the DXF file.
Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=2000&OuterProfileLayer=Outer&InvisibleLayers=IV_Tangent;IV_Bend;IV_Bend_Down;IV_Bend_Up;IV_ARC_CENTERS;IV_FEATURE_PROFILES_DOWN;IV_FEATURE_PROFILES"
Dim oThicknessParam As Parameter
Set oThicknessParam = oSheetMetalCompDef.Thickness
Dim oThicknessString As String
oThicknessString = oThicknessParam.Value * 10
Dim dxffile As String
dxffile = FilePath(fullFilename) & BaseFilename(fullFilename) & " thickness " & oThicknessString & "mm .dxf"
oDataIO.WriteDataToFile sOut, dxffile
MsgBox ("DXF file has been saved to: " & dxffile)
End Sub
Solved! Go to Solution.