- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
I am using this code to put scale on block and use before save document as trigger, however if I have more than one page on my idw file, everytime i save, I always go back to the last page.
Is this anyway to keep same page ?
For Each Osheet In ThisApplication.activedocument.sheets ActiveSheet=ThisDrawing.Sheet(osheet.Name) If osheet.TitleBlock Is Nothing Or osheet.drawingviews.count=0 Then Exit Sub otitleblock=osheet.TitleBlock otextboxes=otitleblock.definition.sketch.textboxes For Each otextbox In otextboxes If otextbox.text= "<ÉCHELLE>" Then drawingviewname =ThisApplication.activedocument.ActiveSheet.drawingviews.item(1).Name otitleblock.setpromptresulttext(otextbox, ActiveSheet.View(drawingviewname).ScaleString) End If Next Next ThisApplication.activedocument.sheets.item(1).activate InventorVb.DocumentUpdate()
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
--------------------------------------
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For Each Osheet In ThisApplication.activedocument.sheets
If osheet.TitleBlock Is Nothing Or osheet.drawingviews.count=0 Then Exit Sub
otitleblock=osheet.TitleBlock
otextboxes=otitleblock.definition.sketch.textboxes
For Each otextbox In otextboxes
If otextbox.text= "<ÉCHELLE>" Then
drawingviewname =ThisApplication.activedocument.ActiveSheet.drawingviews.item(1).Name
otitleblock.setpromptresulttext(otextbox, ActiveSheet.View(drawingviewname).ScaleString)
End If
Next
Next
InventorVb.DocumentUpdate()
Hope this will work for you...
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks a lot it's working pretty good now !!!
However I had a mistake when using the code, at this line :
drawingviewname =ThisApplication.activedocument.ActiveSheet.drawin?gviews.item(1).Name
So i copy and paste the line from my previous code. which exactly the same as yours and it worked ??!!.
drawingviewname =ThisApplication.activedocument.ActiveSheet.drawingviews.item(1).Name
And i see now writing this email the line I copy and paste from you has a ? on it which is not here on my inventor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I use the same rule to write 'View Scale'
I have a problem when I save the documents.
My rule:
For Each osheet In ThisApplication.activedocument.sheets
ActiveSheet=ThisDrawing.Sheet(osheet.Name)
If oSheet.TitleBlock Is Nothing Or osheet.drawingviews.count=0 Then Exit Sub
otitleblock=osheet.TitleBlock
otextboxes=otitleblock.definition.sketch.textboxes
For Each otextbox In otextboxes
If otextbox.text="<View Scale>" Then
drawingviewname=ThisApplication.activedocument.ActiveSheet.drawingviews.item(1).Name
otitleblock.setpromptresulttext(otextbox, ActiveSheet.View(drawingviewname).ScaleString)
End If
Next
Next
ThisApplication.ActiveDocument.Sheets.Item(ActiveSheet).Activate
InventorVb.DocumentUpdate()
I would like to ask some help. I can't understand how work this rule.
Thank the help.