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 .ipt to dwg

7 REPLIES 7
Reply
Message 1 of 8
felix.bouchard
176 Views, 7 Replies

Ilogic .ipt to dwg

Hi, 

 

I need an Ilogic code that creates a flat patttern in dwg from an ipt file. It also needs to have the same .ini settings that i have. Also, it would be cool to have this dwg file to have a ,RevX at the end of the file name. 

X being the revision number associated with the Drawing file. so the revision of the idw file associated with the idw. 

 

Thanks

7 REPLIES 7
Message 2 of 8
WCrihfield
in reply to: felix.bouchard

Hi @felix.bouchard.  What you said there is a little confusing.  You mentioned 3 different file types, and two of them are generally for drawings.  It sounds like the code you want would be working with a sheet metal type of part file directly, then try to export its flat pattern to a DWG file.  What is not clear at this point is...are you talking about exporting just its profile directly 'as' a DWG file on disk, or are you talking about creating a DWG type drawing file, then creating a drawing view within that drawing that is showing that sheet metal flat pattern in it?  And if so, where does the IDW file type come into play here?  So far, there has not been any IDW file in this process.  Or does the part file itself have a revision level that you would want to use in the file name, when exporting, instead of a revision level from a drawing?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 8

I don't know if it works with dwg by changing dxf to dwg:

DWG supported, https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-9F5075D3-00C5-47B3-8BF9-F97E8680B39E

 

 

 

Public Sub Main()
Dim oDoc As PartDocument
Dim oCompDef As ComponentDefinition
Dim oDataIO As DataIO
Dim sOut As String
Dim PartNumber As String
Dim Rev As String

oDoc = ThisApplication.ActiveDocument
Logger.Info("FlatOut " & oDoc.DisplayName)
oCompDef = oDoc.ComponentDefinition
' Get the DataIO object
oDataIO= oCompDef.DataIO

' Build the string that defines the format of the DWG file
sOut = "FLAT PATTERN DWG?AcadVersion=2000&InvisibleLayers=IV_TANGENT;IV_BEND;IV_BEND_DOWN;IV_ROLL;IV_ROLL_TANGENT;IV_FEATURE_PROFILES_DOWN;IV_ARC_CENTERS;IV_TOOLS_CENTERS&RebaseGeometry=True"

oCompDef.FlatPattern.Edit
PartNumber = iProperties.Value("Project", "Part Number")
Rev = iProperties.Value("Project", "Revision Number")
Logger.Info(PartNumber & "-" & Rev)
oDataIO.WriteDataToFile(sOut, PartNumber + "-" + Rev + ".dwg")
oCompDef.FlatPattern.ExitEdit
End Sub

 

 

 

Message 4 of 8

Hi, 

 

It does not work on my end... It says i have a error on line 22. 

 

It needs to take the revision on the idw file associated with the ipt file. 

 

Thanks.

Message 5 of 8
WCrihfield
in reply to: felix.bouchard

There is the clue I asked about.  So, there is an IDW file for that IPT file, and you want to get the Revision Number value from that IDW file, instead of from the IPT file.  Since there is no link on the part side that would indicate that it has a drawing, we would need you to tell us how to find that IDW file.  Is it the same exact file path, and same exact file name as the IPT file, but just with the ".idw" file extension?  If so, that will make it easy for us to find that IDW file by code from that IPT file.  Then we can get that Revision Number iProperty's value from that IDW file, to use within the file name of the DWG file it creates.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 8

So you're running iLogic in drawing?

Message 7 of 8
felix.bouchard
in reply to: WCrihfield

Yes that's exactly it! The idw file is as the same file name and is in the same folder (sometimes it's not, but since they have the same file name, yen i right click and select open drawing, it always works.)

Message 8 of 8

no

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

Post to forums  

Autodesk Customer Advisory Groups


Autodesk Design & Make Report