• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    New Member
    Posts: 1
    Registered: ‎03-15-2012

    Create flat pattern idws from an assembly

    361 Views, 1 Replies
    03-15-2012 08:08 AM

    To increase the speed of production, I like to generate idws of flat patterns from assembly. The following iLogic rule work fine inside a metal sheet (I had to create flat pattern before run this rule).

    Imports Inventor.ViewOrientationTypeEnum
    Imports Inventor.DrawingViewStyleEnum
    
    Dim oDrawingDoc As DrawingDocument	
    Dim oPartDoc As Document
    Dim oSheet As sheet
    Dim oTG As TransientGeometry
    Dim oView1 As DrawingView
    Dim oOptions As NameValueMap
    
    	oPartDoc = ThisApplication.ActiveDocument
    	oDrawingDoc = ThisApplication.documents.Add(kDrawingDocumentObject, "C:\Users\Public\Documents\Autodesk\Inventor 2011\Templates\Standard.IDW", True)
    	oSheet = oDrawingDoc.Sheets.Item(1)
    	oOptions = ThisApplication.TransientObjects.CreateNameValueMap
    	oOptions.Add("SheetMetalFoldedModel", False)
    	oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(15#, 15#)
    	oView1 = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint1, 1/5#, kDefaultViewOrientation, kHiddenLineDrawingViewStyle, , , oOptions)

     But from an assembly there are some problem ( firstable I'm not an expert of vba and ilogic)

    

    Imports Inventor.ViewOrientationTypeEnum
    Imports Inventor.DrawingViewStyleEnum
    fmgr = ThisApplication.Filemanager
    For Each file In fmgr.files
    doc = ThisApplication.Documents.ItemByName (file.fullfileName)
    compdef = doc.ComponentDefinition
    
    ' For each assembly or subassembly
    'If (doc.documenttype = 12291) Then 
     For Each occ In compdef.Occurrences
    ' For sheet metal or part
        If (occ.definition.type =83886592) Then 
    '	If (occ.definition.Subtype ="{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}") Then
    		
    		Dim oDrawingDoc As DrawingDocument	
    		Dim oPartDoc As Document
    		Dim oSheet As sheet
    		Dim oTG As TransientGeometry
    		Dim oView1 As DrawingView
    		Dim oOptions As NameValueMap
    		
    			oPartDoc = ThisApplication.ActiveDocument
    			oDrawingDoc = ThisApplication.documents.Add(kDrawingDocumentObject, "C:\Users\Public\Documents\Autodesk\Inventor 2011\Templates\Standard.IDW", True)
    			oSheet = oDrawingDoc.Sheets.Item(1)
    			oOptions = ThisApplication.TransientObjects.CreateNameValueMap
    			oOptions.Add("SheetMetalFoldedModel", False)
    			oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(15#, 15#)
    			oView1 = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint1, 1/5#, kDefaultViewOrientation, kHiddenLineDrawingViewStyle, , , oOptions)
    '		MessageBox.Show("test1")
    '		Else
    '		MessageBox.Show("test2")
        End If
     Next occ
    'End If
    Next file
    
    

     Can someone help me?

    Please use plain text.
    Valued Mentor
    jcneal
    Posts: 273
    Registered: ‎04-10-2010

    Re: Create flat pattern idws from an assembly

    03-15-2012 08:51 AM in reply to: MatteoC

    i guess you have to open sheet metal part before create its drawing document.

    Please use plain text.