Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating a drawing view Two named faces with ilogic

0 REPLIES 0
Reply
Message 1 of 1
ilker_akay
26 Views, 0 Replies

Creating a drawing view Two named faces with ilogic

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

MyResult

ilker_akay_1-1721016241866.png

 

The result I want.

ilker_akay_2-1721016306093.png

 

 

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report