- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear Team,
I'm having the problem when I was coding. I would like to add the border and title block but can not.
Please help me to fix this problem.
Here is my code:
Imports Inventor
Public Class Form1
Dim invApp As Inventor.Application
Dim oDrawDoc As DrawingDocument
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
'Attach to the Existing Runnin Inventor Application
invApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
Catch ex As Exception
System.Windows.Forms.MessageBox.Show("Error: Inventor must be running...")
Exit Sub
End Try
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
oDrawDoc = invApp.Documents.Open("D:\OneDrive\OneCAD\ATC\Training Documents\Excercise File\Template\Template.idw", True)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
'Active bản vẽ hiện tại
oDrawDoc = invApp.ActiveDocument
'Open template sẵn có
Dim oSheet As Sheet
oSheet = oDrawDoc.Sheets.Add(DrawingSheetSizeEnum.kBDrawingSheetSize)
Dim oSheetActive As Sheet
oSheetActive = oDrawDoc.ActiveSheet
'Thêm một khung bản vẽ Custom DIN EN ISO 5457
Dim oBorderDef As Inventor.Border
oBorderDef = oSheetActive.AddBorder(oDrawDoc.BorderDefinitions.Item("DIN EN ISO 5457"))
'Thêm một khung tên custom DIN EN ISO 5457
Dim oTitleBlock As Inventor.TitleBlock
oTitleBlock = oSheetActive.AddTitleBlock(oDrawDoc.TitleBlockDefinitions.Item("DIN EN ISO 5457"))
End Sub
End Class
Autodesk User
Solved! Go to Solution.