-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlatOut.iLogicVb
More file actions
51 lines (49 loc) · 2.04 KB
/
FlatOut.iLogicVb
File metadata and controls
51 lines (49 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Public Sub Main()
Dim oDoc As PartDocument
Dim oCompDef As ComponentDefinition
Dim oModelStates As ModelStates
Dim oModelState As ModelState
Dim oDataIO As DataIO
Dim sOut As String
oDoc = ThisApplication.ActiveDocument
Logger.Info("FlatOut" & oDoc.DisplayName)
oCompDef = oDoc.ComponentDefinition
' Get the DataIO object
oDataIO= oCompDef.DataIO
' Build the string that defines the format of the DXF file
sOut = "FLAT PATTERN DXF?AcadVersion=2000&InvisibleLayers=IV_TANGENT;IV_BEND;IV_BEND_DOWN;IV_ROLL;IV_ROLL_TANGENT&RebaseGeometry=True"
If oCompDef.IsModelStateFactory Then
Logger.Info("ModelState in file")
oModelStates = oCompDef.ModelStates
'If active MS is Primary, process all MS
'If not, process active MS
If oModelStates.ActiveModelState.Name = ThisServer.LanguageTools.CurrentPrimaryModelStateString Then
'Create DXF for all MS except Primary
For Each oModelState In oModelStates
oModelState.Activate
' Skip Primary
If oModelState.Name <> ThisServer.LanguageTools.CurrentPrimaryModelStateString
oCompDef.FlatPattern.Edit
Logger.Info(oDoc.DisplayName & " " & oModelState.Name)
Logger.Info(iProperties.Value("Project", "Part Number"))
' Create DXF file
oDataIO.WriteDataToFile(sOut, "\\Rfm-svr2\shared\DXF Programming\" + iProperties.Value("Project", "Part Number") + ".dxf")
End If
oCompDef.FlatPattern.ExitEdit
Next
oModelStates.Item(1).Activate
Else
'Create DXF for active MS only
oCompDef.FlatPattern.Edit
Logger.Info(oDoc.DisplayName & " " & oModelStates.ActiveModelState.Name)
Logger.Info(iProperties.Value("Project", "Part Number"))
oDataIO.WriteDataToFile(sOut, "\\Rfm-svr2\shared\DXF Programming\" + iProperties.Value("Project", "Part Number") + ".dxf")
oCompDef.FlatPattern.ExitEdit
End If
Else
'Create DXF for non-MS file
Logger.Info("Normal file")
Logger.Info(iProperties.Value("Project", "Part Number"))
oDataIO.WriteDataToFile(sOut, "\\Rfm-svr2\shared\DXF Programming\"+iProperties.Value("Project", "Part Number")+".dxf")
End If
End Sub