Flat pattern to dxf with bend line

Flat pattern to dxf with bend line

kresh.bell
Collaborator Collaborator
2,224 Views
1 Reply
Message 1 of 2

Flat pattern to dxf with bend line

kresh.bell
Collaborator
Collaborator

I have ilogic for export flat pattern in dxf which is great for me, could anyone help me and edit it in such a way that it does not generate a tangent line but just a band line (ideally if only the band line were blue in color but that not necessary)

 

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
RUsure = MessageBox.Show ( _
"This will create a DXF file for all of the asembly components that are sheet metal." _
& vbLf & "This rule expects that the part file is saved." _
& vbLf & " " _
& vbLf & "Are you sure you want to create DXF for all of the assembly components?" _
& vbLf & "This could take a while.", "iLogic  - Batch Output DXFs ",MessageBoxButtons.YesNo)

If RUsure = vbNo Then

	Return
	
	Else
	
End If

oPath = ThisDoc.Path

oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

oContext = ThisApplication.TransientObjects.CreateTranslationContext

oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism

oOptions = ThisApplication.TransientObjects.CreateNameValueMap

'get DXF target folder path
oFolder = oPath & "\" & oAsmName & " DXF Files"

'Check for the DXF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then

    System.IO.Directory.CreateDirectory(oFolder)
	
End If
'- - - - - - - - - - - - -

'- - - - - - - - - - - - -Component  - - - - - - - - - - - -
'look at the files referenced by the assembly
Dim oRefDocs As DocumentsEnumerator

oRefDocs = oAsmDoc.AllReferencedDocuments

Dim oRefDoc As Document


'work the the drawing files for the referenced models
'this expects that the model has been saved
		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
                	oDataMedium.FileName = oFolder & "\" & oFileName & ".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
0 Likes
Accepted solutions (1)
2,225 Views
1 Reply
Reply (1)
Message 2 of 2

alewer
Advocate
Advocate
Accepted solution

Is it OK for you to still have the tangent lines, but have them on an invisible layer? From the API helpfiles, I see no way (using DataIO.WriteDataToFile) to omit tangent lines from the .dxf, but you make the tangent layer (and tangent roll layer) invisible:

 

ArgumentTypeDefault ValueNote
TangentLayerStringIV_TANGENT 
OuterProfileLayerStringIV_OUTER_PROFILE 
ArcCentersLayerStringIV_ARC_CENTERS 
InteriorProfilesLayerStringIV_INTERIOR_PROFILES 
BendLayerStringIV_BENDBendUpLayer + BendDownLayer (legacy support)
BendUpLayerStringIV_BEND 
BendDownLayerStringIV_BEND_DOWN 
ToolCenterLayerStringIV_TOOL_CENTERToolCenterUpLayer + ToolCenterDownLayer (legacy support)
ToolCenterUpLayerStringIV_TOOL_CENTER 
ToolCenterDownLayerStringIV_TOOL_CENTER_DOWN 
FeatureProfilesLayerStringIV_FEATURE_PROFILESFeatureProfilesUpLayer + FeatureProfilesDownLayer (legacy support)
FeatureProfilesUpLayerStringIV_FEATURE_PROFILES 
FeatureProfilesDownLayerStringIV_FEATURE_PROFILES_DOWN 
AltRepFrontLayerStringIV_ALTREP_FRONT 
AltRepBackLayerStringIV_ALTREP_BACK 
UnconsumedSketchesLayerStringIV_UNCONSUMED_SKETCHES 
TangentRollLinesLayerStringIV_ROLL_TANGENT 
RollLinesLayerStringIV_ROLL 
***ColorString *** indicates name of layer from the argument column. RGB values separated by ;. Example: TangentLayerColor=255;0;0
***LineTypeLong *** indicates name of layer from the argument column. Long value from LineTypeEnum. Example: TangentLayerLineType=37644
***LineWeightDouble *** indicates name of layer from the argument column. Value in centimeters. Example: TangentLayerLineWeight=.1016
CustomizeFilenameString  
AcadVersionString 2018, 2013, 2010, 2007, 2004, 2000, or R12 (for DXF only)
SimplifySplinesBooleanTrueEnable spline replacement by linear segments
SplineToleranceDouble0.01Chord tolerance for spline replacement
AdvancedLegacyExportBooleanTrue 
MergeProfilesIntoPolylineBooleanFalseBuild a polyline of the exterior profiles
RebaseGeometryBooleanFalseMove geometry to 1st quadrant
InvisibleLayersString List of layer names to make invisible, separated by ;

 

If moving tangent lines to an invisible layer is acceptable, replace this existing line of code:

sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_OUTER_PROFILE"

With this:

sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_OUTER_PROFILE&InvisibleLayers=IV_TANGENT;IV_ROLL_TANGENT"

 

If an invisible layer is not an acceptable solution, I recommend that you look into exporting flat pattern geometry to .dxf using the dxf TranslatorAddin. This allows you to control layers by .ini files, much like a "manual" (GUI) export to .dxf.

0 Likes