HI!
I made an iLogic to select sheet sizes and change the border accordingly.
This works well, except when I chose A0, it changes well, but then I can't change anymore to other sizes, it became stuck in the A0 size.
If I delete manually the border, it starts to work well again, until I select again A0 size.
The file is attached, can you help with some ideas?
tip: the rule can be started with the trigger button.
Solved! Go to Solution.
Solved by JelteDeJong. Go to Solution.
Solved by JelteDeJong. Go to Solution.
@CCarreiras your using 2023 Inventor Version so may not be abled to be opened by all forum users. Is it possible to attach the rules controlling the templates? Likely it just failing to add an object because there is one there. It may need to be deleted first like you doing manually then replicate by code. This post here as some logic checking the titleblock and border then deleting before adding.
I noticed that when I change the size manually, there is also an error.
I don't think the problem is in your code but I expect a problem in the border. Anyway, there is a workaround/hack. you could delete the border before you change anything. something like this:
trigger=iTrigger0 SheetSZ = InputListBox("Sheets", MultiValue.List("SheetSZ"), SheetSZ, Title :="SHEETS", ListName := "Select sheet size") ActiveSheet.Sheet.Border.Delete() break If SheetSZ = "A3 Horizontal" Then ActiveSheet.ChangeSize("A3") ActiveSheet.Border = "A3_H" ThisApplication.ActiveDocument.ActiveSheet.Orientation = kLandscapePageOrientation Else If SheetSZ = "A3 Vertical" Then ActiveSheet.ChangeSize("A3") ActiveSheet.Border = "A3_V" ThisApplication.ActiveDocument.ActiveSheet.Orientation = kPortraitPageOrientation Else If SheetSZ = "A2 Horizontal" Then ActiveSheet.ChangeSize("A2") ActiveSheet.Border = "A2_H" ThisApplication.ActiveDocument.ActiveSheet.Orientation = kLandscapePageOrientation Else If SheetSZ = "A1 Horizontal" Then ThisApplication.ActiveDocument.ActiveSheet.Orientation = kLandscapePageOrientation ActiveSheet.ChangeSize("A1") ActiveSheet.Border = "A1_H" Else If SheetSZ = "A0 Horizontal" Then ThisApplication.ActiveDocument.ActiveSheet.Orientation = kLandscapePageOrientation ActiveSheet.ChangeSize("A0") ActiveSheet.Border = "A0_H" End If ThisApplication.ActiveView.Fit
Jelte de Jong
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.
Blog: hjalte.nl - github.com
The code is very simple... a guess is not a problem with the code, will be something else...
Anyway, the code:
trigger=iTrigger0 SheetSZ = InputListBox("Sheets", MultiValue.List("SheetSZ"), SheetSZ, Title :="SHEETS", ListName := "Select sheet size") If SheetSZ = "A3 Horizontal" Then ActiveSheet.ChangeSize("A3") ActiveSheet.Border = "A3_H" ThisApplication.ActiveDocument.ActiveSheet.Orientation = kLandscapePageOrientation Else If SheetSZ = "A3 Vertical" Then ActiveSheet.ChangeSize("A3") ActiveSheet.Border = "A3_V" ThisApplication.ActiveDocument.ActiveSheet.Orientation = kPortraitPageOrientation Else If SheetSZ = "A2 Horizontal" Then ActiveSheet.ChangeSize("A2") ActiveSheet.Border = "A2_H" ThisApplication.ActiveDocument.ActiveSheet.Orientation = kLandscapePageOrientation Else If SheetSZ = "A1 Horizontal" Then ThisApplication.ActiveDocument.ActiveSheet.Orientation = kLandscapePageOrientation ActiveSheet.ChangeSize("A1") ActiveSheet.Border = "A1_H" Else If SheetSZ = "A0 Horizontal" Then ThisApplication.ActiveDocument.ActiveSheet.Orientation = kLandscapePageOrientation ActiveSheet.ChangeSize("A0") ActiveSheet.Border = "A0_H" End If ThisApplication.ActiveView.Fit
I did have another look at your border and found the problem. if you delete the following dimension in the upper right corner of your border definition. Then it all works again.
Jelte de Jong
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.
Blog: hjalte.nl - github.com
@JelteDeJong, deleting the border at the beginning solved part of the problem.
I add the standard Border at the beginning to avoid the other issues and started to work well with no additional problems:
ActiveSheet.Border = "Default Border" ActiveSheet.Sheet.Border.Delete() break
Noobie Q: what is the purpose of using the BREAK? (Since the code works with and without it)
@JelteDeJong, well you found the problem, deleting that dimension solved the problem, which is weird because it's a copy of the original system border...
The question is... how did you find that needle in the haystack 😅
Thank you!
the "break" should not have been there but I forgot to clean up my code. I use visual studio to debug iLogic rules. The break command makes visual studio stop/break at that point. Anyway it's not a problem to remove the line (or if you like to keep it). For more information check this:
https://modthemachine.typepad.com/my_weblog/2019/12/using-visual-studio-to-debug-ilogic-rules.html
Jelte de Jong
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.
Blog: hjalte.nl - github.com
I found it by repeatedly deleting portions of the border and testing if solved the problem. This way I could zoom in to the problem. It takes some time but it is effective. 😉
Jelte de Jong
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.
Blog: hjalte.nl - github.com
oooh man, thank you for your time!!
FYI... i deleted the dimension, and then i recreated it, and works nice.... well ... software...
Can't find what you're looking for? Ask the community or share your knowledge.