help export step file to iam

help export step file to iam

leoa.87
Contributor Contributor
2,890 Views
33 Replies
Message 1 of 34

help export step file to iam

leoa.87
Contributor
Contributor
hello, I need some help ...
i have an assembly file with ilogic rules and part and subassemblies.
according to certain ilogic rules I need to export only the visible elements and not all the parts present in the assembly to file step.
I found a rule already made and it works but not as I would like.

the problem is this rule exports the visible files but also the derivatives which, however, are not visible in the assembly.

how could I do not to make it exhibit a derivative part.

the derived part is used for a mirrored part so in my assembly it is not visually present.

I can't delete the link with the derived part because it's all parametric and I need the parameters

the rule I am using is this:

Sub Main()
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
oAsmName = Left(oAsmDoc.DisplayName, Len(oAsmDoc.DisplayName) -4)

'check that the active document is an assembly file
If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then
MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
Exit Sub
End If

'get user input
' If MessageBox.Show ( _
' "This will create a STP file for all of the asembly components that have drawings files." _
' & vbLf & "This rule expects that the drawing file shares the same name and location as the component." _
' & vbLf & " " _
' & vbLf & "Are you sure you want to create STP Drawings for all of the assembly components?" _
' & vbLf & "This could take a while.", "iLogic - Batch Output STPs ",MessageBoxButtons.YesNo) = vbNo Then
'
' Exit Sub
' End If

Dim STEPTranslator As TranslatorAddIn
Dim oContext As TranslationContext
Dim oOptions As NameValueMap
Dim oDataMedium As DataMedium

Call ConfigureSTEPTranslatorSettings(STEPTranslator, oContext, oOptions, oDataMedium)

'oPath = ThisDoc.Path
oFolder = "C:\Users\STEFANIA\Desktop\Nuova cartella (3)" & "\" & oAsmName & " STEP Files"

If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If

'- - - - - - - - - - - - -Component Drawings - - - - - - - - - - - -'
'look at the files referenced by the assembly
Dim oRefDoc As Document

For Each oRefDoc In oAsmDoc.AllReferencedDocuments
idwPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) - 3) & "idw"

' If(System.IO.File.Exists(idwPathName)) Then
Dim oSTEPDoc As Document
oSTEPDoc = ThisApplication.Documents.Open(oRefDoc.FullFileName, True)
oFileName = Left(oRefDoc.DisplayName, Len(oRefDoc.DisplayName) -4)
' oRevNum = oDrawDoc.PropertySets.Item("Inventor Summary Information").Item("Revision Number").Value
'oDesc = oRefDoc.iProperties.Value("Project", "Description")
oDesc = oSTEPDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
'********************For Each oRefDoc In oRefDocs

iptPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) - 3) & "ipt"

'check that model is saved
If(System.IO.File.Exists(iptPathName)) Then

Dim oDrawDoc As PartDocument

oDrawDoc = ThisApplication.Documents.Open(iptPathName, True)

oFileName = Left(oRefDoc.DisplayName, Len(oRefDoc.DisplayName))
End If

'**********************
'
On Error Resume Next
' 'Set the STP target file name
' If oRevNum = Nothing Then
' oDataMedium.FileName = oFolder & "\" & oFileName & ".STP"
oSTEPDoc.SaveAs(oFolder & "\" & oFileName &"_"& Parameter ("sospensione") & oDesc & (".stp") , True)
'
' Else
' oDataMedium.FileName = oFolder & "\" & oFileName & ".STP"
' End If

Call STEPTranslator.SaveCopyAs(oSTEPDoc, oContext, oOptions, oDataMedium)
oRefDoc.Close
On Error Goto 0
' End If
Next
'- - - - - - - - - - - - -

'- - - - - - - - - - - - -Top Level Drawing - - - - - - - - - - - -
' Dim oAsmDrawingDoc As DrawingDocument
' oAsmDrawingDoc = ThisApplication.Documents.Open(ThisDoc.ChangeExtension(".idw"), True)
' oAsmDrawingName = Left(oAsmDrawingDoc.DisplayName, Len(oAsmDrawingDoc.DisplayName) -4)
' oAsmDrawingRev = oAsmDrawingDoc.PropertySets.Item("Inventor Summary Information").Item("Revision Number").Value
'
' On Error Resume Next
' 'Set the PDF target file name
' If oAsmDrawingRev = Nothing Then
' oDataMedium.FileName = oFolder & "\" & oAsmDrawingName & ".pdf"
'
' Else
' oDataMedium.FileName = oFolder & "\" & oAsmDrawingName & " Rev." & oRevNum & ".pdf"
'
' End If
'
' Call PDFAddIn.SaveCopyAs(oAsmDrawingDoc, oContext, oOptions, oDataMedium)
' oAsmDrawingDoc.Close

MessageBox.Show("New Files Created in: " & vbLf & oFolder, "iLogic")
Shell("explorer.exe " & oFolder,vbNormalFocus)
End Sub

Sub ConfigureSTEPTranslatorSettings(ByRef STEPTranslator As TranslatorAddIn, ByRef oContext As TranslationContext, ByRef oOptions As NameValueMap, ByRef oDataMedium As DataMedium)

oPath = ThisDoc.Path
oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap

If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
' Set application protocol.
' 2 = AP 203 - Configuration Controlled Design
' 3 = AP 214 - Automotive Design
oOptions.Value("ApplicationProtocolType") = 3
' Other options...
'oOptions.Value("Author") = ""
'oOptions.Value("Authorization") = ""
'oOptions.Value("Description") = ""
'oOptions.Value("Organization") = ""
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
' Dim oData As DataMedium
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
oDataMedium.FileName = ThisDoc.PathAndFileName(False) & ".stp"
oSTEPTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oDataMedium)
End If

oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
End Sub

 

 

0 Likes
Accepted solutions (3)
2,891 Views
33 Replies
Replies (33)
Message 21 of 34

leoa.87
Contributor
Contributor

Hello,
I need to provide the flat model in dwg format for laser cutting.
currently i can supply single step files from an assembly but i need dwg as flat models

0 Likes
Message 22 of 34

leoa.87
Contributor
Contributor


hi, I tried to insert the export of flat models in dxf format in the existing rule.

only, however, I also export the deleted files.
how can I align the export of only the components visible in the assembly as it happens for the export of step files?

 

Sub Main()

'check that the active document is an assembly file
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
	MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
	Exit Sub
End If

Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
Dim sAsmName As String = System.IO.Path.GetFileNameWithoutExtension(oAsmDoc.FullFileName )
Dim sFolder As String = "C:\Users\l.azzariti\Desktop\Output" & "\" & sAsmName & "_" & Parameter("RIF_CMA") & "_" & Parameter("RIF_ID") & "_" & "Step Files"

Dim STEPTranslator As TranslatorAddIn
Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
Dim oDataMedium As DataMedium  = ThisApplication.TransientObjects.CreateDataMedium
Call ConfigureSTEPTranslatorSettings(STEPTranslator, oContext, oOptions, oDataMedium)

If Not System.IO.Directory.Exists(sFolder) Then
	System.IO.Directory.CreateDirectory(sFolder)
End If

'look at the files referenced by the assembly
Dim oRefDocs As DocumentsEnumerator
oRefDocs = oAsmDoc.AllReferencedDocuments
Dim oRefDoc As Document
For Each oRefDoc In oAsmDoc.AllReferencedDocuments
	If Not oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Continue For
	'get all occurrences of the referenced file, if one on them is visible - export that file to STEP, otherwise skip
	Dim oOccs As ComponentOccurrencesEnumerator = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc)
	Dim oOcc As ComponentOccurrence
	Dim bVis As Boolean = False
	For Each oOcc In oOccs
		If oOcc.Visible 
			bVis = True
			Exit For
		End If
	Next
	
	If bVis = False Then
		Continue For 'Next For
	End If
	
	'check that model is saved
	If(System.IO.File.Exists(oRefDoc.FullDocumentName)) Then
		Dim sFilename As String = System.IO.Path.GetFileNameWithoutExtension(oRefDoc.FullDocumentName)
		Dim sDesc As String = oRefDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
		Parameter.Quiet = True
		Dim sRIF_CMA As String = Parameter("RIF_CMA")
		Dim sRIF_ID As String = Parameter("RIF_ID")
		oDataMedium.FileName = sFolder & "\" & sFilename & "_" & sRIF_CMA & "_" & sRIF_ID & sDesc & ".stp"
		
		Try
			Call STEPTranslator.SaveCopyAs(oRefDoc, oContext, oOptions, oDataMedium)
		Catch
			MsgBox("Export of " & oRefDoc.DisplayName & " failed. Continue next one", MsgBoxStyle.Critical)
		End Try
	End If
Next

For Each oRefDoc In oRefDocs
iptPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) - 3) & "ipt"
'check that model is saved
If(System.IO.File.Exists(iptPathName)) Then
Dim oDrawDoc As PartDocument
oDrawDoc = ThisApplication.Documents.Open(iptPathName, True)
oFileName = Left(oRefDoc.DisplayName, Len(oRefDoc.DisplayName))
Try
'Set the DXF target file name

Try
CustomName =iProperties.Value(oFileName, "Custom", "PF_PRT_ZNR")
Catch
CustomName ="XXX" 'Wert, wenn iPropertie PF_PRT_ZNR nicht existiert
End Try

'check that model is saved
	
		Dim sFilename As String = System.IO.Path.GetFileNameWithoutExtension(oRefDoc.FullDocumentName)
		Dim sDesc As String = oRefDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
		Parameter.Quiet = True
		Dim sRIF_CMA As String = Parameter("RIF_CMA")
		Dim sRIF_ID As String = Parameter("RIF_ID")
		oDataMedium.FileName = sFolder & "\" & sFilename & "_" & sRIF_CMA & "_" & sRIF_ID & sDesc & ".dxf"

Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDrawDoc.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
oCompDef.Unfold
Else
oCompDef.FlatPattern.Edit
End If
Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_OUTER_PROFILE"
oCompDef.DataIO.WriteDataToFile( sOut, oDataMedium.FileName)
'just for check its works coretcly
'i=MessageBox.Show(oDataMedium.FileName, "Title",MessageBoxButtons.OKCancel)
'MessageBox.Show(i,"title",MessageBoxButtons.OK)
'If i=2 Then
'Exit Sub
'End If
oCompDef.FlatPattern.ExitEdit
Catch
End Try
oDrawDoc.Close
Else
End If
Next



MessageBox.Show("File Step creati nella cartella: " & vbLf & sFolder, "iLogic")
Shell("explorer.exe " & sFolder,vbNormalFocus)
End Sub


Sub ConfigureSTEPTranslatorSettings(ByRef oSTEPTranslator As TranslatorAddIn, ByRef oContext As TranslationContext, ByRef oOptions As NameValueMap, ByRef oDataMedium As DataMedium)
	oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")

	If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
		' Set application protocol.
		' 2 = AP 203 - Configuration Controlled Design
		' 3 = AP 214 - Automotive Design
		oOptions.Value("ApplicationProtocolType") = 3
		' Other options...
		'oOptions.Value("Author") = ""
		'oOptions.Value("Authorization") = ""
		'oOptions.Value("Description") = ""
		'oOptions.Value("Organization") = ""
		oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
		oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
		'oDataMedium.FileName = ThisDoc.PathAndFileName(False) & ".stp"
	End If
End Sub
0 Likes
Message 23 of 34

Ralf_Krieg
Advisor
Advisor

Hello

 

First, try to use the correct nomenclatur. I assume flat file means flat pattern of a sheet metal part. Or is a flat file the drawing (IDW)? And did deleted files means invisible or suppressed files? A deleted file in an assembly is deleted and also no longer exist in API structure. It can't be exported, cause it isn't there anymore.

Second, don't try to integrate all code in one sub. You'll get lost in codelines without structure. A minimum structured rule would be like

Sub Main

    Call of PDF export sub

    Call of DXF export sub

End Sub

 

Sub PDF Export

   code to export PDF

End sub

 

Sub DXF Export

   code to exportDXF

End Sub

 

You'll see, for example, that you are able to expand and collapse the complete code of a sub with one mouse click.This will make your code much more easier to read, reproduce and understand. For yourself and all others.

 

In your Sub Main you traverse through the AllReferencedFiles collection and get all Parts. For every Part you get all Occurrences. If one of the occurrences is visible, you export it to STEP. At this point you have the part you want to export the drawing "in your hands". Start right here to check for an existing drawing file and if it exists, open and export it as DXF. It is not necessary to repeat the search for part files.

 

Your code seems to be a sum a more than one copy and paste action. For instance, a DrawingDocument.ComponentDefinition did not exist. This will never work. If you please answer my introducing questions, we can modify your code to a working version.


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 24 of 34

leoa.87
Contributor
Contributor

hello and thanks for your reply.
..you have highlighted my errors which are mainly the result of the translation and also that up to 6 months ago I did not know ilogic.


to clarify I'm working on an assembly iam file.
this contains other sub-assemblies which on the basis of rules are suppressed so as to export in step files only the visible elements (not suppressed) obviously in the customized level of detail.

now I would like to add also the export of flat patterns in dxf of the single ipt files present in my assembly.

therefore the logic of the rule must always be the same so do not expose the suppressed models but only those active and visible at that moment.

for example my problem was also related to the mirror files, it must not export a source ipt file which in the assembly has been deleted but only the active mirror file.

 

hope you can help me

0 Likes
Message 25 of 34

Ralf_Krieg
Advisor
Advisor

Hello

 

Thanks for your explanations. Helped me to understand what you want to do. I've added dxf export of flat pattern. Could not test it now. If errors occur, post it here. 🙂

 

Sub Main()

	'check that the active document is an assembly file
	If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
		MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
		Exit Sub
	End If
	
	Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
	Dim sAsmName As String = System.IO.Path.GetFileNameWithoutExtension(oAsmDoc.FullFileName )
	Dim sFolder As String = "C:\Users\l.azzariti\Desktop\Output" & "\" & sAsmName & "_" & Parameter("RIF_CMA") & "_" & Parameter("RIF_ID") & "_" & "Step Files"
	
	Dim STEPTranslator As TranslatorAddIn
	Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
	Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
	Dim oDataMedium As DataMedium  = ThisApplication.TransientObjects.CreateDataMedium
	Call ConfigureSTEPTranslatorSettings(STEPTranslator, oContext, oOptions, oDataMedium)
	
	If Not System.IO.Directory.Exists(sFolder) Then
		System.IO.Directory.CreateDirectory(sFolder)
	End If
	
	'look at the files referenced by the assembly
	Dim oRefDocs As DocumentsEnumerator
	oRefDocs = oAsmDoc.AllReferencedDocuments
	Dim oRefDoc As Document
	For Each oRefDoc In oAsmDoc.AllReferencedDocuments
		If Not oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Continue For
		'get all occurrences of the referenced file, if one on them is visible - export that file to STEP, otherwise skip
		Dim oOccs As ComponentOccurrencesEnumerator = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc)
		Dim oOcc As ComponentOccurrence
		Dim bVis As Boolean = False
		For Each oOcc In oOccs
			If oOcc.Visible 
				bVis = True
				Exit For
			End If
		Next
		
		If bVis = False Then
			Continue For 'Next For
		End If
		
		'check that model is saved
		If(System.IO.File.Exists(oRefDoc.FullDocumentName)) Then
			Dim sFilename As String = System.IO.Path.GetFileNameWithoutExtension(oRefDoc.FullDocumentName)
			Dim sDesc As String = oRefDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
			Parameter.Quiet = True
			Dim sRIF_CMA As String = Parameter("RIF_CMA")
			Dim sRIF_ID As String = Parameter("RIF_ID")
			oDataMedium.FileName = sFolder & "\" & sFilename & "_" & sRIF_CMA & "_" & sRIF_ID & sDesc & ".stp"
			
			Try
				Call STEPTranslator.SaveCopyAs(oRefDoc, oContext, oOptions, oDataMedium)
			Catch
				MsgBox("Export of " & oRefDoc.DisplayName & " failed. Continue next one", MsgBoxStyle.Critical)
			End Try
			
			Try
				Call ExportDXF(oRefDoc, sFolder, sFilename, sRIF_CMA, sRIF_ID, sDesc)
			Catch
				MsgBox("Export of " & oRefDoc.DisplayName & " failed. Continue next one", MsgBoxStyle.Critical)
			End Try
		End If
	Next
	
	MessageBox.Show("File Step creati nella cartella: " & vbLf & sFolder, "iLogic")
	Shell("explorer.exe " & sFolder,vbNormalFocus)
End Sub

Sub ExportDXF(ByVal oDoc As PartDocument, ByVal sFolder As String, ByVal sFilename As String, ByVal sRIF_CMA As String, ByVal sRIF_ID As String, ByVal sDesc As String)
	' Exit if not a sheet metal document
	If Not oDoc.DocumentSubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Exit Sub
	
	Try
		CustomName =iProperties.Value(oFileName, "Custom", "PF_PRT_ZNR")
	Catch
		CustomName ="XXX" 'Wert, wenn iPropertie PF_PRT_ZNR nicht existiert
	End Try
	 
	Dim sFullFilename As String = sFolder & "\" & sFilename & "_" & sRIF_CMA & "_" & sRIF_ID & sDesc & ".dxf"
	
	Dim oCompDef As SheetMetalComponentDefinition
	oCompDef = oDoc.ComponentDefinition
	If oCompDef.HasFlatPattern = False Then
		oCompDef.Unfold
	Else
		oCompDef.FlatPattern.Edit
	End If
	Dim sOut As String = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_OUTER_PROFILE"
	oCompDef.DataIO.WriteDataToFile( sOut, sFullFilename)

	oCompDef.FlatPattern.ExitEdit
End Sub

Sub ConfigureSTEPTranslatorSettings(ByRef oSTEPTranslator As TranslatorAddIn, ByRef oContext As TranslationContext, ByRef oOptions As NameValueMap, ByRef oDataMedium As DataMedium)
	oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")

	If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
		' Set application protocol.
		' 2 = AP 203 - Configuration Controlled Design
		' 3 = AP 214 - Automotive Design
		oOptions.Value("ApplicationProtocolType") = 3
		' Other options...
		'oOptions.Value("Author") = ""
		'oOptions.Value("Authorization") = ""
		'oOptions.Value("Description") = ""
		'oOptions.Value("Organization") = ""
		oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
		oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
		'oDataMedium.FileName = ThisDoc.PathAndFileName(False) & ".stp"
	End If
End Sub

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 26 of 34

leoa.87
Contributor
Contributor

 


hi i tried the code.
however it generates an error in dxf export.

"failed. Continue next one"

in the end it exports only the step files but fails to export the dxf.

it does not generate error codes but only this message.

0 Likes
Message 27 of 34

Ralf_Krieg
Advisor
Advisor

Hello

 

There is a little mistake I made. Can you please edit the line

If Not oDoc.DocumentSubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Exit Sub

into

If Not oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Exit Sub

R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 28 of 34

leoa.87
Contributor
Contributor


I entered the change but it gives me the same error.
I tried to insert a msgbox before the ExportDXF call and the message "test" appears but the same message after the ExportDXF call does not appear.
it seems to me that it cannot call Export DXF

 

0 Likes
Message 29 of 34

Ralf_Krieg
Advisor
Advisor

Hello

 

I tried it with a little assembly with one sheetmetal part. This runs fine. Can you upload a demo assembly with one part where the error occurs?

You can also edit the catch part to get the exception message

Try
    Call ExportDXF(oRefDoc, sFolder, sFilename, sRIF_CMA, sRIF_ID, sDesc)
Catch ex As Exception
    'MsgBox("Export of " & oRefDoc.DisplayName & " failed. Continue next one", MsgBoxStyle.Critical)
    MsgBox(ex.message)
End Try

.


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 30 of 34

leoa.87
Contributor
Contributor

I understand the problem ...
it appears that the assembly ipt files must be opened in order to be exported.

starting from the assembly, if the ipt files are not opened, the export of the dxf files is blocked.

it would be necessary to insert in the code the possibility to open the ipt files and then maybe close them automatically once the export is done.

 

0 Likes
Message 31 of 34

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Yes and No. The part file is already opened. Otherwise you could not see it in your assembly. My mistake (sorry) was, to enter the flat pattern environment for export, the part must be the active edit document. This can either be done in line edit in assembly or open the part in an separate view. Let's try the separate view. In addition we deactivate the updating of screen, so you want so anything of creating new view and clos again.

Replace the lines:

Try
    Call ExportDXF(oRefDoc, sFolder, sFilename, sRIF_CMA, sRIF_ID, sDesc)
Catch ex As Exception
    'MsgBox("Export of " & oRefDoc.DisplayName & " failed. Continue next one", MsgBoxStyle.Critical)
    MsgBox(ex.message)
End Try

 with:

ThisApplication.ScreenUpdating = False
			Dim oView As Inventor.View = oRefDoc.Views.Add()
			Try
				Call ExportDXF(oRefDoc, sFolder, sFilename, sRIF_CMA, sRIF_ID, sDesc)
			Catch ex As Exception
				'MsgBox("Export of " & oRefDoc.DisplayName & " failed. Continue next one", MsgBoxStyle.Critical)
				MsgBox(ex.Message)
			Finally
				oView.Close
				ThisApplication.ScreenUpdating = True
			End Try

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 32 of 34

leoa.87
Contributor
Contributor


...almost...
the export of the dxf is performed but the dxf is not flat patterns but a kind of projection of the folded model

0 Likes
Message 33 of 34

Ralf_Krieg
Advisor
Advisor

Hello

 

Is there a flat pattern in the the part document and is it correct or is it not unfolded due to any error? I can not reproduce this with my testfile.


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 34 of 34

leoa.87
Contributor
Contributor

 


you are right...
it had lost its sheet thickness.
I corrected the sheet metal parameters and everything works.

Thanks 1000: D

0 Likes