ilogic rule change sheetsize error

ilogic rule change sheetsize error

Geveke
Enthusiast Enthusiast
1,442 Views
6 Replies
Message 1 of 7

ilogic rule change sheetsize error

Geveke
Enthusiast
Enthusiast

Hello,

 

I have a rule to change the sheetsize of an idw and to place the right border and titleblock in it.

But when i rebuild this rule (which works fine in the original file) for another client, the rule suddenly gives me an error (see attachment).

Here is the rule:

 

trigger = iTrigger0

Formaat_selectie = InputListBox("Kies gewenste papierformaat", MultiValue.List("Formaat_selectie"), Formaat_selectie, Title := "Formaat selectie venster", ListName := "Kies 1 van de volgende formaten")

'zoom all
ThisApplication.ActiveView.Fit

If Formaat_selectie = "BoKa A0" Then
ActiveSheet.ChangeSize("BoKa_A0", moveBorderItems := True)
ActiveSheet.Border = "Border BoKa A0"
ActiveSheet.TitleBlock = "Boskalis title block A0"
Stand="Landscape"
ElseIf Formaat_selectie = "BoKa A1" Then
ActiveSheet.ChangeSize("BoKa_A1", moveBorderItems := True)
ActiveSheet.Border = "Border BoKa A1"
ActiveSheet.TitleBlock = "Boskalis title block A1"
Stand="Landscape"
ElseIf Formaat_selectie = "BoKa A2" Then
ActiveSheet.ChangeSize("BoKa_A2", moveBorderItems := True)
ActiveSheet.Border = "Border BoKa A2"
ActiveSheet.TitleBlock = "Boskalis title block A2"
Stand="Landscape"
ElseIf Formaat_selectie = "BoKa A3" Then
ActiveSheet.ChangeSize("BoKa_A3", moveBorderItems := True)
ActiveSheet.Border = "Border BoKa A3"
ActiveSheet.TitleBlock = "Boskalis title block A3"
Stand="Landscape"
ElseIf Formaat_selectie = "BoKa A4" Then
Stand="Portrait"
ActiveSheet.ChangeSize("BoKa_A4", moveBorderItems := True)
ActiveSheet.Border = "Border BoKa A4"
ActiveSheet.TitleBlock = "Boskalis title block A4"
End If

'Stand = InputListBox("selecteer papier stand", MultiValue.List("Stand"), Stand, Title := "Stand", ListName := "Stand")

'PageOrientationTypeEnum Enumeration
kLandscapePageOrientation = 10242
kPortraitPageOrientation = 10243

'set orientation based on user input
If Stand = "Landscape" Then
ThisApplication.ActiveDocument.ActiveSheet.Orientation  = kLandscapePageOrientation
Else 
ThisApplication.ActiveDocument.ActiveSheet.Orientation  = kPortraitPageOrientation
End If
InventorVb.DocumentUpdate()

 Anyone having an idea what goes wrong?

Accepted solutions (1)
1,443 Views
6 Replies
Replies (6)
Message 2 of 7

Sergio.D.Suárez
Mentor
Mentor

Hi, just to clear some doubts, go to edit sheet -> size and expand.
Verify if you have the sheet formats you request in your rule in the template files where the rule works and in the client template file.
In case of being absent, I think you should create them or transfer them if possible. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 7

Geveke
Enthusiast
Enthusiast

@Sergio.D.Suárez wrote:

Hi, just to clear some doubts, go to edit sheet -> size and expand.
Verify if you have the sheet formats you request in your rule in the template files where the rule works and in the client template file.
In case of being absent, I think you should create them or transfer them if possible. regards


The sheets are available and if i choose them through edit, they show up, no problems.

So, still need to find out what goes wrong.

0 Likes
Message 4 of 7

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

I guess this simple line will return error in the template of your client

 

ActiveSheet.ChangeSize("BoKa_A3", moveBorderItems := True)

 Keep in mind that you can also change the code in the following way, if you do not find the root of the problem

ThisDoc.Document.ActiveSheet.Size = DrawingSheetSizeEnum.kCustomDrawingSheetSize
'requires the input width/height in 'cm'
ThisDoc.Document.ActiveSheet.Height =29.7
ThisDoc.Document.ActiveSheet.Width =21

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 5 of 7

Geveke
Enthusiast
Enthusiast

@Sergio.D.Suárez wrote:

I guess this simple line will return error in the template of your client

 

ActiveSheet.ChangeSize("BoKa_A3", moveBorderItems := True)

 Keep in mind that you can also change the code in the following way, if you do not find the root of the problem

ThisDoc.Document.ActiveSheet.Size = DrawingSheetSizeEnum.kCustomDrawingSheetSize
'requires the input width/height in 'cm'
ThisDoc.Document.ActiveSheet.Height =29.7
ThisDoc.Document.ActiveSheet.Width =21

 


Changed the rule with your piece of code, seems to work better, but get a new error message now.
Think i am going to strip the rule to just 1 shet and see if the problem occurs then too.
Typos are a b**ch in ilogic programming (think its a typo).
Message 6 of 7

Geveke
Enthusiast
Enthusiast

Disabling the lines with the titleblock selection, makes the rule working again (without titleblock on the dwg). Need to investigate the Titleblocks to see what goes wrong there.

 

Following message appears when running the rule with just 1 line with titleblock selection active:

 

System.ArgumentException: De parameter is onjuist. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Inventor.Sheet.AddTitleBlock(Object TitleBlockDefinition, Object TitleBlockLocation, Object PromptStrings)
at Autodesk.iLogic.Runtime.TitleBlockAndBorder.SetTitleBlock(String name, String[] promptedEntries)
at ThisRule.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

 (Note that the text in blue says: the parameter is incorrect)

 

0 Likes
Message 7 of 7

Geveke
Enthusiast
Enthusiast

I think i found the cause of the problems; the Titleblock contains prompted entries; repleced them with iproperty values and it works!