iLogic Save Copy As dxf flat pattern from idw

CADguru21
Explorer
Explorer

iLogic Save Copy As dxf flat pattern from idw

CADguru21
Explorer
Explorer

I have already explored some of the previous posts regarding this subject.  They are close but don't quite fit what I need.  

 

My current workflow is as follows:

  1. Create a sheet metal part.
  2. Create a drawing of said part.
  3. After approvals, export a .pdf file of the .idw
  4. Save Copy As... (.dxf format) of the flat pattern.

 

What I'd like is an iLogic code which allows me to run the Save Copy As... command as shown below from within the .idw of the sheet metal part.

Thereby eliminating the need to open the .ipt separately in order to create the flat pattern (.dxf).  Anyone have any ideas?  I feel like the solution is relatively simple to an expert but I'm relatively new to iLogic.  

SaveCopyAs.PNG

 Thanks!

0 Likes
Reply
Accepted solutions (1)
2,474 Views
7 Replies
Replies (7)

Ron_Jones1122
Advocate
Advocate

Please look at my Screen Cast. I believe you can accomplish this workflow by just selecting "Export Face As"



Ron Jones
Engagement Manager
Blog
LinkedIn

0 Likes

Owner2229
Advisor
Advisor
Accepted solution

Try this. It'll go through every part in the currently open drawing and export the flat pattern with the same name as the part.

 

Dim oDoc As Document = ThisApplication.ActiveDocument 'Get active document
If oDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub 'Drawings only
For Each oModel As Document In oDoc.ReferencedDocuments 'Loop through all referenced documents
'Sheet metal parts only If oModel.DocumentSubType.DocumentSubTypeID <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Continue For Dim oSMCD As SheetMetalComponentDefinition = oModel.ComponentDefinition If Not oSMCD.HasFlatPattern Then 'If it doesn't have a flat patter, create one (unfold the model) oSMCD.Unfold() oSMCD.FlatPattern.ExitEdit() End If Dim FName As String = oModel.FullFileName 'Get the document's path and name FName = Microsoft.VisualBasic.Left(FName, Len(FName) - 4) & ".dxf" Dim sOut As String = "FLAT PATTERN DXF?AcadVersion=R12" 'Export settings Try oSMCD.DataIO.WriteDataToFile(sOut, FName) 'Export Catch End Try Next
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods

CADguru21
Explorer
Explorer

Works like a charm!! I'm still learning iLogic and at times I just get stuck.  Thank you for this streamlined solution, it does exactly what I need it to do!

0 Likes

Owner2229
Advisor
Advisor

You're welcomed. Give it some time and you'll be able to code stuff like this from the top of your head.

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes

Anonymous
Not applicable

Hi

I would like to use these code to export flat pattern to dxf. DXF files named as model part number should be saved in individual folders also named as model part number. Could it be done?

 

0 Likes

Anonymous
Not applicable

is it possible to publish to dxf with part number instead of file name?

0 Likes

Anonymous
Not applicable

Hi, is it possible export to dxf with part number instead of file name?

0 Likes