Automatically create drawing from a model

Automatically create drawing from a model

Anonymous
Not applicable
666 Views
3 Replies
Message 1 of 4

Automatically create drawing from a model

Anonymous
Not applicable

So I found a post about this but i could not get the code to work for me, and I am not a programmer or pretend to be. I need to take a model and create a dwg with ilogic. It only needs to be one flat pattern view and one isometric view.

I also need it to have center marks for all the holes and I need to add certain dimensions

 

Any help or code would be greatly appreciated!!!!!!!!

0 Likes
667 Views
3 Replies
Replies (3)
Message 2 of 4

jdkriek
Advisor
Advisor

For the most part people here are more than willing to help you with existing code, post sample scripts, or small complete solutions, but it's very rare for someone to hand you a large solution - that's what many people get paid to do. And you have to have some sort of programming background to complete these large solutions anyway - usually because it will require you customizing it.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 3 of 4

Anonymous
Not applicable

I have this so far, but I am getting a error

 

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

 

Any ideas where this is coming from and does anyone know the code for the Flat pattern view is?

0 Likes
Message 4 of 4

Stakin
Collaborator
Collaborator
'Please try the code as this:


Imports Inventor.ViewOrientationTypeEnum Imports Inventor.DrawingViewStyleEnum Dim oDrawDoc as DrawingDocument Dim oPartDoc as Document Dim oSheet As sheet Dim oTG As TransientGeometry Dim oBaseView As DrawingView Dim oView2 as DrawingView Dim oView3 as DrawingView Dim oView4 as DrawingView ExcelFile = "K:\CoOp\STANDARDS\Cover Standards" & ".xlsx" PN = GoExcel.CellValue(ExcelFile, "Sheet1", "C2") ViewScale = 1/8 'Ask To create drawing? dwgQuery=MsgBox("Would you like to Create a drawing for this MODEL?", vbYesNo,"Drawing Selection") If dwgQuery = vbYes Then oPartDoc = ThisDoc.Document 'Define IDW Template File Location oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "L:\TEMP.dwg", True) oSheet = oDrawDoc.Sheets.Item(1) 'Define 2d view bottom Left corner points For four views oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(5, 30) oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint1, 1/8,kTopViewOrientation, kHiddenLineDrawingViewStyle, "Default") oPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(oPoint1.X+oBaseView.Width, oPoint1.Y-oBaseView.Height) oView1 = oSheet.DrawingViews.AddProjectedView(oBaseView,oPoint2, kHiddenLineDrawingViewStyle, 1/8) oPoint3 = ThisApplication.TransientGeometry.CreatePoint2d(oPoint1.X-oBaseView.Width, oPoint1.Y-oBaseView.Height) oView2 = oSheet.DrawingViews.AddProjectedView(oBaseView,oPoint3, kHiddenLineDrawingViewStyle, 1/8) oDrawDoc.SaveAs( "K:\CoOp\STANDARDS\x-204" , False) oDrawDoc.Close(False) DrawingDoc = ThisApplication.Documents.Open("K:\CoOp\STANDARDS\X-204" , True) Dim oCurve As DrawingCurve oCurve = oDrawDoc.SelectSet(1).Parent Dim oIntent1 As GeometryIntent, oIntent2 As GeometryIntent oIntent1 = oDrawDoc.oSheet.CreateGeometryIntent(oCurve, kStartPointIntent) oIntent2 = oDrawDoc.oSheet.CreateGeometryIntent(oCurve, kEndPointIntent) Dim oDim As LinearGeneralDimension Dim oPt As Point2d oPt = ThisApplication.TransientGeometry.CreatePoint2d(12, 12) oDim = oDrawDoc.oSheet.DrawingDimensions.GeneralDimensions.AddLinear(oPt, oIntent1, oIntent2, kLinearDimensionType)

 

0 Likes