11-26-2020
01:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
11-26-2020
01:33 PM
hi,
You can try the next rule. I did have some problem with getting the qty. but the rest should work.
Sub main() Dim doc As AssemblyDocument = ThisDoc.Document For Each oDoc As Document In doc.AllReferencedDocuments If (oDoc.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}") Then Continue For Dim fileName As String = getFileName(oDoc) Dim oCompDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition If oCompDef.HasFlatPattern = False Then oCompDef.Unfold() Else oCompDef.FlatPattern.Edit() End If Dim sOut As String = "FLAT PATTERN DXF?AcadVersion=2000&BendUpLayerColor=0;0;255&BendDownLayerColor=0;0;255&InvisibleLayers=IV_TANGENT" oCompDef.DataIO.WriteDataToFile(sOut, fileName) oCompDef.FlatPattern.ExitEdit() Next End Sub Private Function getFileName(oDoc As PartDocument) As String Dim fileNameDoc = System.IO.Path.GetFileName(oDoc.FullFileName) Dim partNumber = iProperties.Value(fileNameDoc, "Project", "Part Number") Dim thickness As Double = Parameter("flatpattern.ipt", "Thickness") thickness = Math.Round(thickness * 10) Dim newFileName As String = String.Format("{0}_{1}",partNumber, thickness) Return IO.Path.Combine("c:\temp\", newFileName) End Function
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com