Message 1 of 1
Help I'm stuck with a rule code

Not applicable
06-25-2016
02:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a rule for create a drawing automatic from a part. that works well
But now I want to make a loop that ilogic make a idw for each part in my assembly... two options are acceptable either all in one sheet or for each part a sheet...
What's wrong?
First the code without loop
Imports Inventor.ViewOrientationTypeEnum Imports Inventor.DrawingViewStyleEnum Dim oDrawingDoc as DrawingDocument Dim oPartDoc as Document Dim oSheet As sheet Dim oTG As TransientGeometry ViewScale = 1/1 'vraag? Vraag1=MsgBox("wil je starten met 2d's maken?", vbYesNo,"Laserwerk") If Vraag1 = vbYes Then oPartDoc = ThisDoc.Document 'locatie van de template oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "C:\00-LIBRARY\99-Templates\standaard.idw", True) ' oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "", True) oSheet = oDrawingDoc.Sheets.Item(1) 'plaats op sheet bepalen oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(10, 10) ' top oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint1, ViewScale,kTopViewOrientation, kHiddenLineDrawingViewStyle, "Default") End If
my trial
Imports Inventor.ViewOrientationTypeEnum Imports Inventor.DrawingViewStyleEnum Dim oDrawingDoc as DrawingDocument Dim oPartDoc as Document Dim oSheet As sheet Dim oTG As TransientGeometry ViewScale = 1/20 'vraag? vraag1=MsgBox("wil je starten met 2d's maken?", vbYesNo,"Laserwerk") If vraag1 = vbYes Then oPartDoc = ThisDoc.Document 'locatie van de template oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "C:\00-CONSTRUX LIBRARY\99-Templates\Poductietekening standaard.idw", True) ' oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "", True) oSheet = oDrawingDoc.Sheets.Item(1) 'plaats op sheet bepalen oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(20, 20) ' top oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint1, ViewScale,kTopViewOrientation, kHiddenLineDrawingViewStyle, "Default") End If '------- start of ilogic ------ 'vraag? vraag1=MsgBox("wil je starten met 2d's maken?", vbYesNo,"Laserwerk") If vraag1 = vbYes Then oPartDoc = ThisDoc.Document 'locatie van de template oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "C:\00- LIBRARY\99-Templates\ standaard.idw", True) ' oDrawingDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "", True) oSheet = oDrawingDoc.Sheets.Item(1) 'plaats op sheet bepalen oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(20, 20) ' top oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint1, ViewScale,kTopViewOrientation, kHiddenLineDrawingViewStyle, "Default") End If 'Define the open document Dim openDoc As Document openDoc = ThisDoc.Document 'Look at all of the files referenced in the open document Dim docFile As Document For Each docFile In openDoc.AllReferencedDocuments 'look at only part files If docFile.DocumentType = kPartDocumentObject Then 'format file name Dim FNamePos As Long FNamePos = InStrRev(docFile.FullFileName, "\", -1) Dim docFName As String oSheet = oDrawingDoc.Sheets.Item(1) 'plaats op sheet bepalen oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(20, 20) ' top oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint1, ViewScale,kTopViewOrientation, kHiddenLineDrawingViewStyle, "Default") End If Next iLogicVb.UpdateWhenDone = True '------- end of ilogic ------
thanks al lot