Reg : Adding Sheets with Part Desciption

Reg : Adding Sheets with Part Desciption

naresh_kalyan
Advocate Advocate
214 Views
2 Replies
Message 1 of 3

Reg : Adding Sheets with Part Desciption

naresh_kalyan
Advocate
Advocate
Dear all,

My intension is to get a code which can ADD MULTIPLE sheets and correspondingly Prompts the user to enter the PART DESCRIPTION.

Here I have one macro which will give only a INPUT BOX for part Description. But, I dont know where i made wrong.
Its giving only Input Box and later it is not working.

Can anybody help me to make my work so faster and better.

Thanks in advance.

Public Sub AddSheets()
Dim oDoc As Inventor.Document
Set oDoc = ThisApplication.ActiveDocument

' Check the Document type is an assembly or part
If (oDoc.DocumentType <> kDrawingDocumentObject) Then
MsgBox "Error:Document type must be Drawing"
Set oDoc = Nothing
Exit Sub
End If

'Here we will put up a box to ask how many sheets to create
Dim counter, sheet_name, default
default = "PART - 1"
sheet_name = InputBox("Enter Part Description:", "Add Multiple Sheets with Part Description", default)

' user will get a type mismatch error if they enter letters instead of numbers

Call ThisApplication.CommandManager.StartCommand(kCreateNewSheetCommand)

End Sub
0 Likes
215 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
I would think that adding sheets would be faster using the following style
of code:

Dim oSheet As Sheet
'take number the user enters and iterate through a loop
For Index = 1 To NumberDesired
Set oSheet = oDrawDoc.Sheets.Add(kDDrawingSheetSize,
kLandscapePageOrientation, _
InputBox("Enter sheet description", "Sheet
Description"))
'add your border definition
'....
Next Index

wrote in message news:5184865@discussion.autodesk.com...
Dear all,

My intension is to get a code which can ADD MULTIPLE sheets and
correspondingly Prompts the user to enter the PART DESCRIPTION.

Here I have one macro which will give only a INPUT BOX for part Description.
But, I dont know where i made wrong.
Its giving only Input Box and later it is not working.

Can anybody help me to make my work so faster and better.

Thanks in advance.

Public Sub AddSheets()
Dim oDoc As Inventor.Document
Set oDoc = ThisApplication.ActiveDocument

' Check the Document type is an assembly or part
If (oDoc.DocumentType <> kDrawingDocumentObject) Then
MsgBox "Error:Document type must be Drawing"
Set oDoc = Nothing
Exit Sub
End If

'Here we will put up a box to ask how many sheets to create
Dim counter, sheet_name, default
default = "PART - 1"
sheet_name = InputBox("Enter Part Description:", "Add Multiple Sheets with
Part Description", default)

' user will get a type mismatch error if they enter letters instead of
numbers

Call ThisApplication.CommandManager.StartCommand(kCreateNewSheetCommand)

End Sub
0 Likes
Message 3 of 3

naresh_kalyan
Advocate
Advocate
Thank u Joe for ur response.
Earlier, I got one code which add Sheets as we enter the Number of Sheets.
But, I need to Add Multiple Sheets with their DESCRIPTION.
I am sending the previous code.

Thank you again.


Public Sub AddSheets()
Dim oDoc As Inventor.Document
Set oDoc = ThisApplication.ActiveDocument

' Check the Document type is an assembly or part
If (oDoc.DocumentType <> kDrawingDocumentObject) Then
MsgBox "Error:Document type must be Drawing"
Set oDoc = Nothing
Exit Sub
End If

'Here we will put up a box to ask how many sheets to create
Dim counter, num_sheets, default
default = "10"
num_sheets = InputBox("Create how many Sheets:", "Add Multiple Sheets", default)

' user will get a type mismatch error if they enter letters instead of numbers
For counter = 1 To num_sheets
Call ThisApplication.CommandManager.StartCommand(kCreateNewSheetCommand)
Next counter

End Sub
0 Likes