iLogic - Export name determined by parameter value

iLogic - Export name determined by parameter value

Viktor.Lukjanow
Advocate Advocate
297 Views
2 Replies
Message 1 of 3

iLogic - Export name determined by parameter value

Viktor.Lukjanow
Advocate
Advocate

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

ViktorLukjanow_0-1709199284352.png

Does anyone have an idea?

THX



0 Likes
Accepted solutions (1)
298 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @Viktor.Lukjanow.  I do not really use those settings right now, but a couple ideas come to mind about alternate ways to check them.  Once we get a reference to the main Parameters collection, there are 4 methods for 'setting' those settings, then there are several Boolean type properties for getting or setting the status of similar settings.

Parameters 

Parameters.AngularStandardTolerance 

Parameters.ExportStandardTolerances 

Parameters.LinearStandardTolerance 

Parameters.UseStandardTolerances 

That last one sounds like the most 'general' to me, so that may be the way to set them all back to 'normal' if one of the methods has been used to set one of the specific tolerance types before that point.  There are also multiple properties for setting the 'precision' of angular or linear parameters.  Maybe that last setting would be better than checking one specific parameter object's settings.

Edit:  Just to be clear...we get to the Parameters collection object I am talking about above through one of the following code paths:

PartDocument.ComponentDefinition.Parameters

AssemblyDocument.ComponentDefinition.Parameters

DrawingDocument.Parameters

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Viktor.Lukjanow
Advocate
Advocate

I will try. THX WCrihfield

0 Likes