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.
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
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
This is cool. Can you add something to this code to batch create drawings for each part in an assembly automatically?
Regards
Tracey