Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Save Copy As dxf flat pattern from idw

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
CADguru21
2466 Views, 7 Replies

iLogic Save Copy As dxf flat pattern from idw

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!

Tags (3)
7 REPLIES 7
Message 2 of 8
Ron_Jones1122
in reply to: CADguru21

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

Message 3 of 8
Owner2229
in reply to: CADguru21

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
Message 4 of 8
CADguru21
in reply to: Owner2229

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!

Message 5 of 8
Owner2229
in reply to: CADguru21

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
Message 6 of 8
Anonymous
in reply to: Owner2229

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?

 

Message 7 of 8
Anonymous
in reply to: Owner2229

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

Message 8 of 8
Anonymous
in reply to: Owner2229

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report