Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
yvandelafontaine
685 Views, 4 Replies

ilogic Export Sheet metal flat pattern to .SAT

I'm trying to tweak my code (global rule) to export the flat pattern to .sat in format 7.0 (INV2020), it does so but always the folded model. What am I missing???

'On Error GoTo ErrorTrapper:

If iProperties.Value("Project", "Revision Number") = "" Then
iProperties.Value("Project", "Revision Number") = "0"
End If
oRev = iProperties.Value("Project", "Revision Number")


Dim curDoc = ThisApplication.ActiveDocument
If curDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then


    Dim oDoc As PartDocument

    oDoc = ThisApplication.ActiveDocument

				
    Dim oCompDef As SheetMetalComponentDefinition

    oCompDef = oDoc.ComponentDefinition

	'[ Ensure this part has a flat pattern
				
				If oCompDef.FlatPattern Is Nothing Then 
				oCompDef.Unfold
				Else
				End If
				RuleParametersOutput()
				']
				
	oCompDef.FlatPattern.Edit
	
	Dim sOut As String
	
    Dim sPATH As String
	
	oPathSat = ThisDoc.WorkspacePath() & "\SAT\"
	
	
	'[ Ensure this folder exist
	'Check For the SAT folder And create it If it does Not exist
	If Not System.IO.Directory.Exists(oPathSat) Then
	System.IO.Directory.CreateDirectory(oPathSat)
	End If

	
	Version = 7


	Dim sFname As String
	
	sFname = oPathSat & ThisDoc.FileName(False) & "_REV-" & oRev & ".sat"

oDoc.SaveAs(sFname, True)

	'oCompDef.SaveAs(sFname ,False)
       'oCompDef.DataIO.WriteDataToFile( "ACIS SAT", sFname)
	'oCompDef.DataIO.WriteDataToFile( nsOut, nsFname)
	
	oDoc = ThisApplication.ActiveDocument
	
	oCompDef = oDoc.ComponentDefinition
	
	oCompDef.FlatPattern.ExitEdit
	


	
Else
ThisApplication.StatusBarText = ThisDoc.FileName(False) & " Is not in a sheet metal state, convert to sheetmetal and create flat pattern first --- Jumping to next part" 



End If

 

Labels (2)