Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Everyone,
I am trying to make a code to automatize export to DXF Flat Sheet Metal.
When i export a Sheet with thread hole.
This holes have M12, when i export with DN 12mm.
In this case, if hole have thread I would like these holes not to be exported.
For Each oRefDoc In oRefDocs
iptPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) - 3) & "ipt"
If (Not System.IO.File.Exists(iptPathName)) Then Continue For
Dim oDrawDoc As PartDocument
oDrawDoc = ThisApplication.Documents.Open(iptPathName, True)
oFileName = Left(oRefDoc.DisplayName, Len(oRefDoc.DisplayName))
Dim quantidadeDePecas As String = "QTDE: " & oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc).Count
'Set the DXF target file name
Try
Dim CustomName As String
Try
CustomName = iProperties.Value(oFileName, "Project", "Part number")
CustomName = CustomName.replace("/", "-")
Catch
CustomName = oFileName
End Try
oDataMedium.FileName = oFolder & "\" & CustomName & ".dxf"
Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDrawDoc.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
oCompDef.Unfold
Else
oCompDef.FlatPattern.Edit
End If
For Each oFeature As PartFeature In oCompDef.Features
If oFeature.Type = kThreadFeatureObject Then
End If
Next
Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=2004&" & _
"OuterProfileLayer=CONTORNI&OuterProfileLayerColor=255;255;0&" & _
"InteriorProfilesLayer=CONTORNI&InteriorProfilesLayerColor=255;255;0&" & _
"TangentLayer=SOTTILI&TangentLayerColor=255;0;0&" & _
"BendLayer=SOTTILI&BendLayerColor=255;0;0&" & _
"BendUpLayerColor=255;0;0&BendDownLayerColor=255;0;0&" & _
"InvisibleLayers=IV_ARC_CENTERS;IV_FEATURE_PROFILES;IV_FEATURE_PROFILES_DOWN"
oCompDef.DataIO.WriteDataToFile(sOut, oDataMedium.FileName)
AddDXFProperties(oDrawDoc, oDataMedium.FileName, quantidadeDePecas ,False)
oCompDef.FlatPattern.ExitEdit
Catch
End Try
oDrawDoc.Close
Next
Solved! Go to Solution.