08-22-2017
07:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-22-2017
07:53 AM
Okay, then the issue was when the original code was pulling oDoc.FullFileName, it was pulling the full file path as well, and we didn't put that back and put the Part Number and file type behind that, the code didn't know where to save the file. So we just need to add in a line of code to get the file path and add that to sFname:
SyntaxEditor Code Snippet
Dim oDoc As PartDocument oDoc=ThisApplication.ActiveDocument Dim oCompDef As SheetMetalComponentDefinition oCompDef=oDoc.ComponentDefinition Dim oDataIO As DataIO oDataIO=oDoc.ComponentDefinition.DataIO If oCompDef.HasFlatPattern=False Then oCompDef.Unfold Else oCompDef.FlatPattern.Edit End If Dim sOut As String sOut="FLAT PATTERN DWG?AcadVersion=2000" _ +"&InvisibleLayers=IV_TANGENT;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;IV_ARC_CENTERS;IV_ALTREP_FRONT;IV_ALTREP_BACK;IV_UNCONSUMED_SKETCHES;IV_ROLL_TANGENT;IV_ROLL" _ +"&SimplifySplines=True" _ +"&LINEAR TOLERANCE=0.010" _ +"&MergeProfilesIntoPolyline=True" _ +"&RebaseGeometry=False" _ +"&TrimCenterlines=True" Dim invPropSets As PropertySets invPropSets=oDoc.PropertySets Dim invPropSet As PropertySet invPropSet=invPropSets.Item("Design Tracking Properties") Dim invPartNumiProp As Inventor.Property invPartNumiProp=invPropSet.Item("Part Number") Dim sFname As String sFname=ThisDoc.Path & "\" & invPartNumiProp.Value & ".dwg" oCompDef.DataIO.WriteDataToFile(sOut, sFname) oCompDef.FlatPattern.ExitEdit
Thanks for your help.