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 Mar 30, 2021
1 parent 047c447 commit 73ace4e
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 10 deletions.
2 changes: 1 addition & 1 deletion AddRemoveCustomProperties/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

This program adds and/or removes Custom file properties. Actually, it only removes them. I didn't get around to the adding part.

You identify which properties to remove in a text file named properties_to_remove.txt. The file must reside in the same directory as the executable.
You identify which properties to remove in a text file named `properties_to_remove.txt`. The file must reside in the same directory as the executable.

4 changes: 3 additions & 1 deletion FitIsoView/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Fit Iso View

Example program for Solid Edge Housekeeper 'Run External Program' task.
Very basic example program for the Solid Edge Housekeeper `Run External Program` task.

Not especially useful as is, since Housekeeper already has a `Fit ISO view` task. That one does a bit more, too, like turning off construction elements, etc.
5 changes: 5 additions & 0 deletions FitIsoView/release_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## v 0.1.1
Update readme

## v 0.1.0
Initial release
6 changes: 3 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Solid Edge Housekeeper External Programs
2021 Robert McAnany

Description and examples for Solid Edge Housekeeper 'Run External Program' task.
Description and examples for Solid Edge Housekeeper `Run External Program` task.

The external program is a Console App that works on a single Solid Edge file. Housekeeper serves up files one at a time for processing.

Expand All @@ -21,7 +21,7 @@ Housekeeper launches the program as follows:
P.WaitForExit()
ExitCode = P.ExitCode

No arguments are passed to the program. If you need to get a value from Housekeeper, such as a template file location, you can parse the defaults.txt file in Housekeeper's installation directory. The file is updated just before processing is launched. It should always reflect the current status of the form.
No arguments are passed to the program. If you need to get a value from Housekeeper, such as a template file location, you can parse the `defaults.txt` file in Housekeeper's installation directory. The file is updated just before processing is launched. It should always reflect the current status of the form.

Housekeeper maintains a reference to the file being processed. If that reference is broken, an exception will occur. To avoid that, do not perform `Close()` or `SaveAs()` on the document.

Expand All @@ -43,4 +43,4 @@ If the `ExitCode` is not `0`, and the file is present, Solid Edge Housekeeper wi

## Releases

Most developers will want the source code, however compiled versions of the example programs are available. See https://github.com/rmcanany/HousekeeperExternalPrograms/releases/
Most developers will want the source code, however compiled versions of the example programs are available. See https://github.com/rmcanany/HousekeeperExternalPrograms/releases/
26 changes: 23 additions & 3 deletions RenameSheets/Module1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Module Module1
Dim seApp As SolidEdgeFramework.Application = Nothing
Dim seDoc As SolidEdgeDraft.DraftDocument = Nothing

Dim Suffix As String

Try
seApp = CType(Runtime.InteropServices.Marshal.GetActiveObject("SolidEdge.Application"), Application)
seDoc = CType(seApp.ActiveDocument, DraftDocument)
Expand All @@ -34,6 +36,8 @@ Module Module1

Dim seViews As DrawingViews = Nothing

Suffix = GetSuffix()

Try
' In case this program has already run this file, first rename sheets to random values
For Each seSheet As Sheet In seSheets
Expand All @@ -47,9 +51,10 @@ Module Module1
For Each seSheet As Sheet In seSheets
seViews = seSheet.DrawingViews
If seViews.Count > 0 Then
Sheetname = Rename(seViews, Sheetnames)
Sheetname = Rename(seViews, Sheetnames, Suffix)
seSheet.Name = Sheetname
Sheetnames.Add(Sheetname)
Console.WriteLine(Sheetname)
End If
Next
Catch ex As Exception
Expand All @@ -70,7 +75,7 @@ Module Module1
End Function


Private Function Rename(seViews As DrawingViews, Sheetnames As List(Of String)) As String
Private Function Rename(seViews As DrawingViews, Sheetnames As List(Of String), Suffix As String) As String
' Sheet names need to be unique. This function handles the case where two sheets have the same first ModelLink
Dim BaseName As String
Dim Name As String
Expand All @@ -86,11 +91,26 @@ Module Module1
Name = BaseName

While Sheetnames.Contains(Name)
Name = String.Format("{0}-Copy({1})", BaseName, count)
Name = String.Format("{0}-{1}({2})", BaseName, Suffix, count)
count += 1
End While

Return Name
End Function

Function GetSuffix() As String
Dim Suffix As String = "Copy"
Dim StartupPath As String = AppDomain.CurrentDomain.BaseDirectory

Dim Filename As String = String.Format("{0}suffix.txt", StartupPath)

Try
Suffix = IO.File.ReadAllLines(Filename)(0)
Catch ex As Exception
Console.WriteLine(String.Format("Problem processing {0}", Filename))
End Try

Return Suffix
End Function

End Module
4 changes: 2 additions & 2 deletions RenameSheets/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Original version by Tushar Suradkar

https://community.sw.siemens.com/s/question/0D54O00006BtAnKSAV/code-rename-sheets-to-the-referenced-model-name

This program renames the sheets in a draft to the model name of the first drawing view on the sheet.
This program renames the sheets in a draft to the model name of the first drawing view on the sheet. If the drawing view is set to match a configuration, the configuration name is appended to the model name.

If multiple sheets have the same first model, it appends `-Copy(X)` to the name. Where `X` is a sequential integer value starting at `1`.
If multiple sheets would otherwise have the same name, the program appends a suffix `-Copy(X)` to the name. Where `X` is a sequential integer value starting at `1`. The suffix text `Copy` is a string read from the file `suffix.txt`. It can be changed to whatever is appropriate for your circumstances.

Sheets with no model drawing views are not renamed.

Expand Down
5 changes: 5 additions & 0 deletions RenameSheets/release_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## v 0.1.1
Added the ability to change the suffix text by editing `suffix.txt`.

## v 0.1.0
Initial release
11 changes: 11 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Release Notes
Companion repo with instructions and program examples for the Solid Edge Housekeeper `Run external program` task.

## v 0.1.2
Modified RenameSheets

## v 0.1.1
Added AddRemoveCustomProperties

## v 0.1.0
Initial release

0 comments on commit 73ace4e

Please sign in to comment.