Automate the creation of drawings with Inventor

Hello

 

I'm working on a project to optimize design time in Inventor:

I have programmed under exel (xls) a file that allows you to enter the dimensions of a part (in excel) and generate the part immediately afterwards under Inventor (ipt file), it works well. the user just needs to enter for example Length: width: extrusion ...

 

My difficulty now lies in the production of the automatic drawing.

I want to be able to create either a macro or a piece of program to ask the software to generate the drawing (IDW file) and annotations automatically to save time for the designers.

 

Thank you in advance for your proposals.

Hello

Here's a program that seems to be working:

 

 

Dim invApp As Inventor.Application
Set invApp = ThisApplication
'invApp.SilentOperation = True

Dim iptDoc As Inventor.PartDocument
Set iptDoc = invApp.ActiveDocument

Dim iptFile As String
LaserDir = "c:\temp\Macro\"
iptFile = LaserDir + "Temp.ipt"


With invApp.CommandManager
Call. PostPrivateEvent(kFileNameEvent, iptFile)
Call. StartCommand(kFileSaveCopyAsCommand)
End With

Set iptDoc = Nothing
'invApp.SilentOperation = False
Set invApp = Nothing

 

 

 


' Criar um novo documento baseando-se no Template padrão / Create a new document based on the standard template

    Dim oDrawnDoc As DrawingDocument
    Set oDrawnDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, _
                ThisApplication.FileManager.GetTemplateFile(kDrawingDocumentObject))
               
'************Plotar a peça salva em um arquivo do IDW / Use the temporary part on the IDW


  ' Set a reference to the drawing document.
  ' This assumes a drawing document is active.
  Dim oDrawDoc As DrawingDocument
  Set oDrawDoc = ThisApplication.ActiveDocument

  'Set a reference to the active sheet.
  Dim oSheet As Sheet
  Set oSheet = oDrawDoc.ActiveSheet

  ' Create a new NameValueMap object
  Dim oBaseViewOptions As NameValueMap
  Set oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap

 
  ' Open the model document (corresponding to the "MyLODRep" representation).
  Dim Abc As String
  Abc = ThisApplication.FileManager.GetFullDocumentName("C:\Temp\Macro\Temp.ipt")
 

  Dim oModel As Document
  Set oModel = ThisApplication.Documents.Open(Abc, False)

  ' Create the placement point object.
  Dim oPoint As Point2D
  Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(10, 25)
 
 
   ' Create a base view.
 
  
  Dim oBaseView As DrawingView
  Set oBaseView = oSheet.DrawingViews.AddBaseView(oModel, oPoint, 0.5, kFrontViewOrientation, kHiddenLineRemovedDrawingViewStyle, , , oBaseViewOptions)

 

 

 

Spring:

http://forums.autodesk.com/t5/Inventor-Customization/use-the-loaded-IPT-on-IDW-Through-VBA/m-p/3757811#M41961

 

 

Other avenues:

 

http://forums.autodesk.com/t5/Inventor-Customization/Drawing-Automation-with-VBA/td-p/2983510

 

http://forums.autodesk.com/t5/Inventor-General/VBA-error-while-saving-idw/td-p/4751633

1 Like

Thank you for answering, I would like to know where I have to enter this program so that it is supported by the software.

What programming language is it?

You must use Visual Basic Express or Visual Studio

 

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=17324920

 

Or the Visual Basic Editor:

http://download.autodesk.com/us/community/mfg/Part_1.pdf

excuse me Lucas, but I'm not a pro in computer science, I 'm just a simple student who studies mechanics bac+5 so, as far as the codes are concerned, I have no idea how it works, so I have a good knowledge of Visual Basic, but I don't know where to start to get my way, it is my internship supervisor who asks me to do so.

 

If you can guide me in the procedures to follow I would be very grateful

 

Thank you

The second link probably corresponds to your request:

http://download.autodesk.com/us/community/mfg/Part_1.pdf

it's to start in VBA for Inventor.

 

Good luck.

 

If you have another question in particular, ask a new question about Lynkoa (and try to limit the scope of the question as much as possible).

1 Like

okay,  I see that,

Thank you

Hello

 

I updated myself regarding the software, but I have a beugg at the beginning of the compilation:

 

Undefined user-defined type.

 

The macro name doesn't look good like in the picture

 

 What can it be due to?


2014-03-13_16h39_23.png

Here is the error message


2014-03-13_16h39_39.png