Hello, we have many parts during the design phase and it takes a lot of time to prepare technical drawings. To speed up the process, I discovered ilogic and API in Inventor. There are many sample codes on the forum, I understand the logic a little. What I want to do now is;
1- I can do this with the code I shared as an example. There is a scale problem, I could not figure out the reason.
2. The starting plane or axis of each part may be different. To overcome this, I made 2 definitions in the piece. "Front face" and "Top face". I want to show the piece accordingly in the view. How can I do this with ilogic or c# api?
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim templatePathAndName As String = ThisApplication.DesignProjectManager.ActiveDesignProject.TemplatesPath & "Metric\Ansi (mm).idw"
Dim oDDoc As DrawingDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, templatePathAndName, True)
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oX As Double = 0
Dim oY As Double = 0
Dim oSheet As Sheet = oDDoc.ActiveSheet
oSheet.Size = DrawingSheetSizeEnum.kA3DrawingSheetSize
Dim oView As DrawingView = oSheet.DrawingViews.AddBaseView(oPDoc, oTG.CreatePoint2d(oX, oY), 1/1 , ViewOrientationTypeEnum.kDefaultViewOrientation, DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle,)
Dim oView2 As DrawingView = oSheet.DrawingViews.AddProjectedView(oView, oTG.CreatePoint2d(50, 0), DrawingViewStyleEnum.kFromBaseDrawingViewStyle)
Dim oView3 As DrawingView = oSheet.DrawingViews.AddProjectedView(oView, oTG.CreatePoint2d(0, -50), DrawingViewStyleEnum.kFromBaseDrawingViewStyle)
Dim owBw As Double
Dim owBh As Double
Dim scale1 As Double
Dim scale2 As Double
Dim scale As Double
Dim space As Double = 3 '30mm
owBw = space + oView.Width + space + oView2.Width + space
owBh = space + oView.Height + space + oView3.Height + space
scale1 = oSheet.Width / owBw
scale2 = oSheet.Height / owBh
scale = 1/ Round( 1/Min(scale1, scale2), 0, MidpointRounding.ToPositiveInfinity)
oView.Scale = scale
space = (space * scale)*10
oView.Position = oTG.CreatePoint2d(space + (oView.Width / 2), oSheet.Height + (-space - (oView.Height / 2)))
oView2.Position = oTG.CreatePoint2d(oView.Position.X + (space + (oView2.Width / 2)), oView.Position.Y)
oView3.Position = oTG.CreatePoint2d(oView.Position.X, oView.Position.Y - (space + (oView3.Height / 2)))
Named Enities
![ilker_akay_0-1721016116728.png ilker_akay_0-1721016116728.png](https://forums.autodesk.com/t5/image/serverpage/image-id/1386617i466159402477ECBB/image-size/medium?v=v2&px=400)
MyResult
![ilker_akay_1-1721016241866.png ilker_akay_1-1721016241866.png](https://forums.autodesk.com/t5/image/serverpage/image-id/1386618i9B8F977563322746/image-size/medium?v=v2&px=400)
The result I want.
![ilker_akay_2-1721016306093.png ilker_akay_2-1721016306093.png](https://forums.autodesk.com/t5/image/serverpage/image-id/1386619i32C50A9CABA81530/image-size/medium?v=v2&px=400)