Drawing Sheet - BaseView Creation VB

Drawing Sheet - BaseView Creation VB

NachoShaw
Advisor Advisor
519 Views
7 Replies
Message 1 of 8

Drawing Sheet - BaseView Creation VB

NachoShaw
Advisor
Advisor

Hi

 

Im sure i had this working before but i seem to have forgotten.....

 

Using code, i am adding a drawing sheet to a drawing then adding a baseview. I cant use a SheetFormat because we dont work that way. Instead, we just use the built in Create Sheet button method. This will create a new sheet based on the currently active sheet.

 

How can i do this in code?

 

Basically, our template has 3 standard sheets

  • Front
  • Assy
  • Part

I need to be able to create a sheet using the built in sheets based on the type. I have the type code, i just cannot get the correct drawing sheet. currently, its just a blank sheet with no border or titleblock...

 

Thanks

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
520 Views
7 Replies
Replies (7)
Message 2 of 8

bradeneuropeArthur
Mentor
Mentor

Hi,

 

This Code is working, but need to investigate the titleblock add function.

This seems to be a bug in inventor.

        Dim a As Inventor.Application
        a = _InvApp

        Dim b As DrawingDocument
        b = a.ActiveDocument

        Dim sh As Sheet
        sh = b.ActiveSheet

        Dim shts As Sheets
        shts = b.Sheets

        Dim newsh As Sheet
        newsh = shts.Add

        Dim bo As BorderDefinition
        bo = b.BorderDefinitions.Item(2)' REPLACE WITH THE NAME OF THE BORDER YOU NEED

        Dim He As TitleBlockDefinition
        He = b.TitleBlockDefinitions.Item(1)' REPLACE WITH THE NAME OF THE TITLEBLOC YOU NEED


        newsh.Activate()
        Call newsh.AddBorder(bo)
 
        newsh.Activate()
        Dim titlebl As Inventor.TitleBlock

        titlebl = newsh.AddTitleBlock(He)


    End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 8

woodstylee3
Advocate
Advocate
Does your titleblock have prompted entries?

If this is the case I believe you have to pass in an array of the values for the entries when the titleblock is added. Will check my code and reply, but worth a search on this.
0 Likes
Message 4 of 8

bradeneuropeArthur
Mentor
Mentor
I read thst this is a known issue for Autodesk.
I gave already searched for that.
Do you have a solution for this line of code than?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 8

NachoShaw
Advisor
Advisor

Hi

 

There are not any prompted entries at the moment but i cant rule that out for the future. I wrote some code a while ago that adds the titleblock and border definition and handles prompted entries but i was hoping for a more simple solution like the built in Inventor one. When i click that, it literally adds the sheet with everything on it.

 

I suppose i could just get the definitions from the existing sheets and use the same settings. the sheet positions are always the same

 

i will do some coding tomorrow and see what i can come up with

 

 

 

cheers

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 6 of 8

bradeneuropeArthur
Mentor
Mentor

This code adds the sheet in the current format:

 

Public Sub AddSheet()

Dim oCDef As ControlDefinition
Set oCDef = ThisApplication.CommandManager.ControlDefinitions.Item("DrawingNewSheetCtxCmd")

oCDef.Execute

End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 8

NachoShaw
Advisor
Advisor

Hi

Yes i have tried that before but its not exactly the best method. for one, i cant access the prompted entries by code and another is i still cant access the choice of sheets. but yes, your suggested version will simply add a sheet based on the currently active sheet.

 

Is there not a method of just selecting the sheet number and adding a new version of it?

 

cheers

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 8 of 8

bradeneuropeArthur
Mentor
Mentor

Yes i have tried that before but its not exactly the best method.

 

for one, i cant access the prompted entries by code and another is i still cant access the choice of sheets.

'YOU CAN ACCES THAT AFTERWARDS VIA CODING

but yes, your suggested version will simply add a sheet based on the currently active sheet.

 

Is there not a method of just selecting the sheet number and adding a new version of it?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes