Inventor General Discussion

Inventor General Discussion

Reply
New Member
MatteoC
Posts: 1
Registered: ‎03-15-2012
Message 1 of 2 (764 Views)

Create flat pattern idws from an assembly

764 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?

Valued Mentor
jcneal
Posts: 340
Registered: ‎04-10-2010
Message 2 of 2 (759 Views)

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.

Autodesk Inventor Professional 2014
Autodesk Product Design Suite Standard 2014
Microsoft Office 2007 & 2013
Windows 7 64bit
Synergis Adept 2014
Visual Studio Express 2010
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.