Hi!
I saw on some posts that is possible with ilogic to create automated drawing for an part to dwg. But the code is to complex for me at the moment.
Can anyone give me some help with this simple piece attached? I want to create an automated dwg from this simple metal sheet.
Any ideas on the code? any help would be great in order for me to start create some coding of my own for more complex parts.
Thanks a lot for any help.
Hi,
Kindly find the code in the attached part, it has some bugs in dimension creation....do check out....i am too, in the process of learning....
The below code will create
1) Default View, and two Projected View by using "Standard.idw" Template
2) Save the drawing with part file name.
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
ViewScale = 3/16
'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
modelFullFileName = ThisDoc.ModelDocument.FullFileName
modelFileNamewithoutextentionsion = IO.Path.GetFileNameWithoutExtension(modelFullFileName)
'MsgBox(modelFileNamewithoutextentionsion)
'Define IDW Template File Location
oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, "C:\Users\Public\Documents\Autodesk\Inventor 2012\Templates\Standard.idw", True)
oSheet = oDrawDoc.Sheets.Item(1)
'Define 2d view bottom left corner points for four views
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(5, 5)
oPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(5, 30)
oPoint3 = ThisApplication.TransientGeometry.CreatePoint2d(30, 5)
oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc,oPoint1, 3/16,kFrontViewOrientation, kHiddenLineDrawingViewStyle, "Default")
oView2 = oSheet.DrawingViews.AddProjectedView(oBaseView,oPoint2, kHiddenLineDrawingViewStyle, 3/16)
oView3 = oSheet.DrawingViews.AddProjectedView(oBaseView,oPoint3, kHiddenLineDrawingViewStyle, 3/16)
oDrawDoc.SaveAs(ThisDoc.Path &"\" &modelFileNamewithoutextentionsion &".idw", False)
oDrawDoc.Close(False)
DrawingDoc = ThisApplication.Documents.Open(ThisDoc.Path &"\" &modelFileNamewithoutextentionsion &".idw" , 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)
End If
Can't find what you're looking for? Ask the community or share your knowledge.