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: 

Automatic Drawing Creation (General Help Needed)

3 REPLIES 3
Reply
Message 1 of 4
GavoGarmo
2837 Views, 3 Replies

Automatic Drawing Creation (General Help Needed)

Hi,

 

I've been making iLogic assemblies with hints of VB for about 6 months now. My Boss has asked me if I can write code that will affectively create drawings automatically.

 

What we would like to create is a rule, which when run, creates a new drawing file, places the active assembly in a base view, then place a Left, Right and Top veiw of the assembly and place a parts list in the top corner. Dimensions are not really important at the moment, as the sizes of the parts are in the description field and the drawings are used for assembling the product only.

 

I realise an explination of how to do this may be too long for a disscussion group, but firstly, it that possible? and can anyone point me in the direction of useful information?

 

Thanks in advance.

3 REPLIES 3
Message 2 of 4
xiaodong_liang
in reply to: GavoGarmo

Hi,

 

All are possible to me. But not all are available with the wrapped iLogic rule. You may need Inventor API. You can also use Inventor API within iLogic. e.g. the following code create a drawing, place an assembly as a base view and place a partslist

 

  Dim oFileManager As FileManager

     oFileManager = ThisApplication.FileManager

  

    'create drawing document

    Dim oNewDoc As DrawingDocument

      oNewDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, oFileManager.GetTemplateFile(kDrawingDocumentObject), True)

   

'    'add new sheet if you need

'    Dim oSheet As Sheet

'    Set oSheet = oNewDoc.Sheets.Add

'

'    Call oSheet.AddTitleBlock(oNewDoc.TitleBlockDefinitions(1))

'    Call oSheet.AddBorder(oNewDoc.BorderDefinitions(1))

    

    Dim oActiveSheet As Sheet

      oActiveSheet = oNewDoc.ActiveSheet

   

    ' Open the sheet metal document invisibly

    Dim oModel As Document

      oModel = ThisApplication.Documents.Open("C:\temp\myAss.iam", False)

 

    ' Create the placement point object.

    Dim oPoint As Point2d

      oPoint = ThisApplication.TransientGeometry.CreatePoint2d(25, 25)

 

    ' Create a base view.

    Dim oBaseView As DrawingView

      oBaseView = oActiveSheet.DrawingViews.AddBaseView(oModel, oPoint, 1, ViewOrientationTypeEnum.kDefaultViewOrientation, DrawingViewStyleEnum .kHiddenLineRemovedDrawingViewStyle)

 

    Dim oPlacementPoint As Point2d

      oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(oActiveSheet.Width, oActiveSheet.Height)

 

   Dim oPartsList As PartsList

      oPartsList = oActiveSheet.PartsLists.Add(oBaseView, oPlacementPoint)

 

 

So, the first I’d recommend is: you could get started with Inventor API with

http://download.autodesk.com/media/adn/Autodesk_Inventor_API_Module1_Basic_concepts_04March10.zip

http://download.autodesk.com/media/adn/Autodesk_Inventor_API_Module2_Common_Document_Functionality_1...

 

 

Message 3 of 4
GavoGarmo
in reply to: xiaodong_liang

Sorry for the very late reply. The thread had gone off the bottom of my thread table and I didn't see anyone had replied.

 

Thanks for the pointers! 🙂

 

GavoGarmo

Message 4 of 4
tracey
in reply to: xiaodong_liang

This is cool.  Can you add something to this code to batch create drawings for each part in an assembly automatically?

 

Regards

 

Tracey

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

Post to forums  

Autodesk Design & Make Report