Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create flat pattern idws from an assembly

1 REPLY 1
Reply
Message 1 of 2
MatteoC
1070 Views, 1 Reply

Create flat pattern idws from an assembly

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?

1 REPLY 1
Message 2 of 2
skyngu
in reply to: MatteoC

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

Autodesk Inventor Professional 2019

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

Post to forums  

Autodesk Design & Make Report