- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
multiple sheet idw titleblock and borders
Ok, this should be very easy, even though I'm not able to find an answer:
let's say I have an 1page idw (A3.idw), and I want to add a new sheet, with the same border and titleblock of page 1. Of course I would like to do it with ilogic, running it from an .ipt file.
I simply want to set something like
oSheet2 titlebloc = oSheet1 title block
oSheet2 border = oSheet1 border
Thanks in advance
Dim doc as DrawingDocument Dim oSheet1 As sheet Dim oSheet2 As sheet doc = ThisApplication.Documents.Open("c:\A3.idw" ,False) oSheet1 = doc.Sheets.Item(1) oSheet2 = doc.Sheets.add()
oSheet2.TitleBlock=oSheet1.TitleBlock.Name
SyntaxEditor Code Snippet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It seems that I cannot access to border or text box of an idw when I'm running a rule from an ipt or an iam, is that true?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Yes, I have a template, when I do the sheets.Add() command, a new sheet is generated, but it is completly white. I activate that sheet an try to acceess to titleblock or border (thisdoc.activesheet.border='Default border') to change it, but an error message is shown and says "border is read only".
Really do not know what to do....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
You can try the .AddUsingSheetFormat method if you have a predetermined layout. Can even add symbols and views, so it is by far the simplest way to accomplish adding a sheet.
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thank you - that sounds like what I need. When trying it with some sample code found online, though, I get a "parameter is incorrect" error for the .Add line. Code is below - and I have no idea what I should put into the oName variable, assuming I can get the code to go that far.
Any guidance would be appreciated.
Dim oTemp As String Dim oDrawDoc As DrawingDocument Dim oName As String Dim oSheet As Sheet Dim oModel As Document Dim oFormat As SheetFormat oTemp = "C:\Users\Public\Public Documents\Autodesk\Inventor 2014\Templates\English\Ticket Template.dwg" oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, oTemp, False) oModel = ThisApplication.ActiveDocument oName = "А, 1" oFormat = oDrawDoc.SheetFormats.Item(oName) oSheet = oDrawDoc.Sheets.AddUsingSheetFormat(oFormat, oModel)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For the .Add, why it is failing, it doesn't look like anything with syntax to me, so maybe try starting a new doc with that template and see if there is anything unexpected going on, or check your file location. - Actually, looking now the .dwg seems weird to me (I only work with .idw). Is it an inventor dwg? have you actually tried opening this file directly in inventor before?
As for the name, it just needs to be as it appears in it's node under sheet formats, so the format you have with quotes is correct. You could also use them item # that corresponds to it's position in the list; 1 through whatever you may have.
Also, for add using sheet format, you have to be very careful if the template has a model in or not; writing the line for the opposite case with throw a parameter error.
Other than that, It all looks fine to me.
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Justin,
As for the dwg file - that's one of our standard templates. When we switched to Inventor a year ago, we opted to use dwg drawings instead of idw.
There is no model in the template. Since the rule is only in the template file, that should never be an issue.
I think that I'm giving up on this and just adding a sheet as the original poster did, then formatting it. It turns out that it's less work than I expected. Thanks for all your help.
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good Luck, anyways.
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type