Skip to content

Commit

Permalink
See release_notes.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rmcanany committed Apr 5, 2021
1 parent 0e665b2 commit 6e8abfa
Show file tree
Hide file tree
Showing 10 changed files with 648 additions and 302 deletions.
156 changes: 122 additions & 34 deletions AssemblyTasks.vb
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,15 @@ Public Class AssemblyTasks
Dim PartNumber As String = ""
Dim PartNumberPropertyFound As Boolean = False
Dim TF As Boolean
Dim Filename As String
Dim Filename As String = ""

Filename = SEDoc.FullName

If Filename.Contains("!") Then
Filename = Filename.Split("!"c)(0)
End If

'Get the bare file name without directory information
Filename = System.IO.Path.GetFileName(SEDoc.FullName)
Filename = System.IO.Path.GetFileName(Filename)

PropertySets = CType(SEDoc.Properties, SolidEdgeFramework.PropertySets)

Expand Down Expand Up @@ -295,6 +300,7 @@ Public Class AssemblyTasks
End If
End If


ErrorMessage(ExitStatus) = ErrorMessageList
Return ErrorMessage
End Function
Expand Down Expand Up @@ -393,26 +399,35 @@ Public Class AssemblyTasks
Dim ViewStyleAlreadyPresent As Boolean
Dim TemplateSkyboxName(5) As String
Dim msg As String = ""
Dim tf As Boolean = False

' Dim PartBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
'Dim ConstructionBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
'Dim ThreadBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
'Dim WeldbeadBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
'Dim CurveBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
'Dim TemplateConstructionBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
'Dim TemplateThreadBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
'Dim TemplateWeldbeadBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
'Dim TemplateCurveBaseStyle As SolidEdgeFramework.FaceStyle = Nothing

Dim ConstructionBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
Dim ThreadBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
Dim WeldbeadBaseStyle As SolidEdgeFramework.FaceStyle = Nothing
Dim CurveBaseStyle As SolidEdgeFramework.FaceStyle = Nothing

' Import face styles from template
SEDoc.ImportStyles(TemplateFilename, True)

' Find the active ViewStyle in the template file.
SETemplateDoc = CType(SEApp.Documents.Open(TemplateFilename), SolidEdgeAssembly.AssemblyDocument)
SEApp.DoIdle()

'' Get the template base styles
'SETemplateDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyConstructionStyle, ConstructionBaseStyle)
'SETemplateDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyThreadedCylindersStyle, ThreadBaseStyle)
'SETemplateDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyWeldBeadStyle, WeldbeadBaseStyle)
'SETemplateDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyCurveStyle, CurveBaseStyle)
'msg = ConstructionBaseStyle.StyleName
'SETemplateDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyConstructionStyle,
' TemplateConstructionBaseStyle)
'SETemplateDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyThreadedCylindersStyle,
' TemplateThreadBaseStyle)
'SETemplateDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyWeldBeadStyle,
' TemplateWeldbeadBaseStyle)
'SETemplateDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyCurveStyle,
' TemplateCurveBaseStyle)
'MsgBox(TemplateConstructionBaseStyle.StyleName)

Windows = SETemplateDoc.Windows
For Each Window In Windows
Expand All @@ -433,11 +448,18 @@ Public Class AssemblyTasks
SETemplateDoc.Close(False)
SEApp.DoIdle()

'' Set the document base styles
'SEDoc.SetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyConstructionStyle, ConstructionBaseStyle)
'SEDoc.SetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyThreadedCylindersStyle, ThreadBaseStyle)
'SEDoc.SetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyWeldBeadStyle, WeldbeadBaseStyle)
'SEDoc.SetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyCurveStyle, CurveBaseStyle)
'' Get the document base styles
'' Does not work. SetBaseStyle crashes if no base style is assigned.
'msg = ""

'' Copy base styles if not already assigned.
'SEDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyConstructionStyle,
' ConstructionBaseStyle)
'If ConstructionBaseStyle Is Nothing Then
' SEDoc.SetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyConstructionStyle,
' TemplateConstructionBaseStyle)
' msg = String.Format("{0}{1}a{2}", msg, vbCrLf, TemplateConstructionBaseStyle.StyleName)
'End If

' If a style by the same name exists in the target file, delete it.
ViewStyleAlreadyPresent = False
Expand Down Expand Up @@ -485,6 +507,25 @@ Public Class AssemblyTasks
View.Style = TemplateActiveStyleName
Next

SEDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyConstructionStyle,
ConstructionBaseStyle)
SEDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyThreadedCylindersStyle,
ThreadBaseStyle)
SEDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyWeldBeadStyle,
WeldbeadBaseStyle)
SEDoc.GetBaseStyle(SolidEdgeAssembly.AssemblyBaseStylesConstants.seAssemblyCurveStyle,
CurveBaseStyle)

tf = ConstructionBaseStyle Is Nothing
tf = tf Or (ThreadBaseStyle Is Nothing)
tf = tf Or (WeldbeadBaseStyle Is Nothing)
tf = tf Or (CurveBaseStyle Is Nothing)

If tf Then
ExitStatus = 1
ErrorMessageList.Add("Some Color Manager base styles undefined.")
End If

If SEDoc.ReadOnly Then
ExitStatus = 1
ErrorMessageList.Add("Cannot save document marked 'Read Only'")
Expand Down Expand Up @@ -655,31 +696,73 @@ Public Class AssemblyTasks

Dim NewFilename As String = ""
Dim NewExtension As String = ""
Dim AssemblyBaseFilename As String
Dim Filename As String
Dim BaseFilename As String
Dim Dir As String

Dim Members As SolidEdgeAssembly.AssemblyFamilyMembers
Dim Member As SolidEdgeAssembly.AssemblyFamilyMember
Dim msg As String = ""

' ComboBoxSaveAsAssemblyFiletype
' Format: Parasolid (*.xt), IGES (*.igs)
NewExtension = Configuration("ComboBoxSaveAsAssemblyFileType")
NewExtension = Split(NewExtension, Delimiter:="*")(1)
NewExtension = Split(NewExtension, Delimiter:=")")(0)

AssemblyBaseFilename = System.IO.Path.GetFileName(SEDoc.FullName)
Filename = SEDoc.FullName

If Not SEDoc.IsFileFamilyByDocument Then
If Configuration("CheckBoxSaveAsAssemblyOutputDirectory") = "False" Then
Dir = Configuration("TextBoxSaveAsAssemblyOutputDirectory")
BaseFilename = System.IO.Path.GetFileNameWithoutExtension(Filename)
NewFilename = Dir + "\" + System.IO.Path.ChangeExtension(BaseFilename, NewExtension)
Else
NewFilename = System.IO.Path.ChangeExtension(Filename, NewExtension)
End If

Try
SEDoc.SaveAs(NewFilename)
SEApp.DoIdle()
Catch ex As Exception
ExitStatus = 1
ErrorMessageList.Add(String.Format("Error saving {0}", TruncateFullPath(NewFilename, Configuration)))
End Try

' CheckBoxSaveAsAssemblyOutputDirectory
If Configuration("CheckBoxSaveAsAssemblyOutputDirectory") = "False" Then
NewFilename = Configuration("TextBoxSaveAsAssemblyOutputDirectory") + "\" + System.IO.Path.ChangeExtension(AssemblyBaseFilename, NewExtension)
Else
NewFilename = System.IO.Path.ChangeExtension(SEDoc.FullName, NewExtension)
' D:\projects\foa1.asm!Master -> D:\foa1.asm
Filename = Filename.Split("!"c)(0)

Members = SEDoc.AssemblyFamilyMembers
For Each Member In Members
Members.ActivateMember(Member.MemberName)

If Configuration("CheckBoxSaveAsAssemblyOutputDirectory") = "False" Then
Dir = Configuration("TextBoxSaveAsAssemblyOutputDirectory")
' D:\projects\foa1.asm -> foa1
BaseFilename = System.IO.Path.GetFileNameWithoutExtension(Filename)
' foa1 -> foa1-Member1
BaseFilename = String.Format("{0}-{1}", BaseFilename, Member.MemberName)
NewFilename = Dir + "\" + System.IO.Path.ChangeExtension(BaseFilename, NewExtension)
Else
Dir = System.IO.Path.GetDirectoryName(Filename)
BaseFilename = System.IO.Path.GetFileNameWithoutExtension(Filename)
' foa1 -> foa1-Member1
BaseFilename = String.Format("{0}-{1}", BaseFilename, Member.MemberName)
NewFilename = Dir + "\" + System.IO.Path.ChangeExtension(BaseFilename, NewExtension)
End If

Try
SEDoc.SaveAs(NewFilename)
SEApp.DoIdle()
Catch ex As Exception
ExitStatus = 1
ErrorMessageList.Add(String.Format("Error saving {0}", TruncateFullPath(NewFilename, Configuration)))
End Try

Next
End If

'Capturing a fault to update ExitStatus
Try
SEDoc.SaveAs(NewFilename)
SEApp.DoIdle()
Catch ex As Exception
ExitStatus = 1
ErrorMessageList.Add(String.Format("Error saving {0}", TruncateFullPath(NewFilename, Configuration)))
End Try

ErrorMessage(ExitStatus) = ErrorMessageList
Return ErrorMessage
Expand Down Expand Up @@ -868,8 +951,13 @@ Public Class AssemblyTasks
Dim ModelFilename As String
Dim DrawingFilename As String

ModelFilename = System.IO.Path.GetFileName(SEDoc.FullName)
DrawingFilename = System.IO.Path.ChangeExtension(SEDoc.FullName, ".dft")
ModelFilename = SEDoc.FullName

If ModelFilename.Contains("!") Then
ModelFilename = ModelFilename.Split("!"c)(0)
End If

DrawingFilename = System.IO.Path.ChangeExtension(ModelFilename, ".dft")

If Not FileIO.FileSystem.FileExists(DrawingFilename) Then
ExitStatus = 1
Expand Down
8 changes: 6 additions & 2 deletions DraftTasks.vb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Public Class DraftTasks
Dim Sheet As SolidEdgeDraft.Sheet = Nothing
Dim DrawingViews As SolidEdgeDraft.DrawingViews = Nothing
Dim DrawingView As SolidEdgeDraft.DrawingView = Nothing
Dim ParentSheet As SolidEdgeDraft.Sheet = Nothing

Sections = SEDoc.Sections
Section = Sections.WorkingSection
Expand All @@ -210,7 +211,8 @@ Public Class DraftTasks
If Balloon.Leader Then
If Not Balloon.IsTerminatorAttachedToEntity Then
ExitStatus = 1
ErrorMessageList.Add(Balloon.BalloonDisplayedText)
msg = String.Format("Sheet {0}: {1}", Sheet.Name, Balloon.BalloonDisplayedText)
ErrorMessageList.Add(msg)
End If
End If
Catch ex As Exception
Expand Down Expand Up @@ -239,7 +241,9 @@ Public Class DraftTasks

If TF Then
ExitStatus = 1
ErrorMessageList.Add(Dimension.DisplayName)
ParentSheet = CType(Dimension.Parent, SolidEdgeDraft.Sheet)
msg = String.Format("Sheet {0}: {1}", ParentSheet.Name, Dimension.DisplayName)
ErrorMessageList.Add(msg)
End If
End If

Expand Down
15 changes: 14 additions & 1 deletion Form1.Defaults.vb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Partial Class Form1
End If
End If

tf = tb.Name.ToLower.Contains("colwidth")
tf = tb.Name.ToLower.Contains("columnwidth")
If tf Then
If Value = "" Then
tb.Text = "5.5"
Expand All @@ -113,6 +113,19 @@ Partial Class Form1
End If
End If

tf = tb.Name.ToLower.Contains("fontsize")
If tf Then
If Value = "" Then
tb.Text = "8"
Else
Try
tb.Text = CStr(Value)
Catch ex As Exception
tb.Text = "8"
End Try
End If
End If

tf = tb.Name.ToLower.Contains("restartafter")
If tf Then
If Value = "" Then
Expand Down
Loading

0 comments on commit 6e8abfa

Please sign in to comment.