- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, does anyone have any ideas on how I can best implement this?
I have a simple logic where I am exporting an stp.
Now I want to check what model tolerance type is set in that part before exporting.
If it is Nominal (ModelValueTypeEnum.kNominalValue) then string "StepFX" = "" (should not contain anything)
If it is Median (ModelValueTypeEnum.kMedianValue) then
string "StepFX" should be " - Median".
This way I can guarantee that the file will be named differently depending on the model tolerance type when it is exported.
I have managed to write it so that it looks for a particular parameter (d1) and checks whether it is median or nominal. But I have no idea how to rewrite it so that it doesn't just look for a specific parameter, but checks in general what is set.
This is my Rule so far:
Sub Main() If TypeOf ThisApplication.ActiveDocument Is AssemblyDocument Then Stepfilename = iProperties.Value("Custom", "EWS_PARTNUMBER") & " - " & iProperties.Value("Custom", "EWS_PART") sName = "Freigabe PDF\" & Stepfilename & ".stp" 'C:\Workcenter\Inventor\Standard\Freigabe PDF sPath = "C:\Workcenter\Inventor\Standard\" 'Speichern als 'True = speichert eine Kopie dieser Datei unter dem neuen Namen ab 'False = speichert diese Datei unter dem neuen Namen ThisDoc.Document.SaveAs(sPath & sName, True) End If If TypeOf ThisApplication.ActiveDocument Is PartDocument Then ' On Error Resume Next Dim StepFX As String = "" ' Parameter.Param("d1").ModelValueType = ModelValueTypeEnum.kMedianValue param = Parameter.Param("d1") If param.ModelValueType = ModelValueTypeEnum.kMedianValue Then StepFX = " - Median" End If On Error Resume Next Stepfilename = ThisDoc.FileName Stepfilename = iProperties.Value("Custom", "EWS_PARTNUMBER") & " - " & iProperties.Value("Custom", "EWS_PART") sName = "Freigabe PDF\" & Stepfilename & StepFX & ".stp" 'C:\Workcenter\Inventor\Standard\Freigabe PDF sPath = "C:\Workcenter\Inventor\Standard\" 'Speichern als 'True = speichert eine Kopie dieser Datei unter dem neuen Namen ab 'False = speichert diese Datei unter dem neuen Namen ThisDoc.Document.SaveAs(sPath & sName, True) End If 'open folder ThisDoc.Launch("C:\Workcenter\Inventor\Standard\Freigabe PDF") Dim PathDatei As String PathDatei = System.IO.Path.Combine(sPath, sName) System.Windows.Forms.Clipboard.SetDataObject(PathDatei) End Sub
Does anyone have an idea?
THX
Solved! Go to Solution.