Error in Rule

Error in Rule

Anonymous
Not applicable
543 Views
3 Replies
Message 1 of 4

Error in Rule

Anonymous
Not applicable

I am trying to change the position of some boxes within a drawing border depending on whether the text inside them is blank or populated, however I am getting an error below.

 

Error in rule: Revision Table, in document: APPTEST4.idw

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

 

here is my code, can anyone help please??

SyntaxEditor Code Snippet

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

Dim oTitleBlockDef As TitleBlockDefinition
oTitleBlockDef = oDrawDoc.TitleBlockDefinitions.Item("A-B")

Dim oSketch As DrawingSketch
oTitleBlockDef.Edit(oSketch)

Dim oDim As DimensionConstraint

'find d0
For Each oDim In oSketch.DimensionConstraints
	If oDim.Parameter.Name = "d171" Then
		Exit For
	End If
Next
If iProperties.Value("Custom", "NEF3-2 ECO") = "" And
iProperties.Value("Custom", "ECO") = "" Then
oDim.Parameter.Value = 7.125 And
ThisDrawing.Document.StylesManager.Layers("NEF3 1").Visible = False 


Else If iProperties.Value("Custom", "NEF3-2 ECO") IsNot "" And
iProperties.Value("Custom", "ECO") IsNot "" Then
oDim.Parameter.Value = 11.875 And
ThisDrawing.Document.StylesManager.Layers("NEF3 1").Visible = False

End If

 

0 Likes
544 Views
3 Replies
Replies (3)
Message 2 of 4

ThatWorksForMe
Advocate
Advocate

Hi,

do you have a titleblock called "A-B"?

Thi part creates the error.

 

PDM/CAD Administrator
Using Inventor/Vault 2024.3
0 Likes
Message 3 of 4

Anonymous
Not applicable
@ThatWorksForMe wrote:

Hi,

do you have a titleblock called "A-B"?

Thi part creates the error.

 


Thanks, I have changed "A-B" to the correct Title block, however, now the rule just opens that title block and stops. The feature I am trying to alter is within a Borders definition. 

0 Likes
Message 4 of 4

ThatWorksForMe
Advocate
Advocate

I tried this code and it works for me.

 

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

Dim oTitleBlockDef As TitleBlockDefinition
oTitleBlockDef = oDrawDoc.TitleBlockDefinitions.Item("A-B")

Dim oSketch As DrawingSketch
oTitleBlockDef.Edit(oSketch)

Dim oDim As DimensionConstraint

'find d0
For Each oDim In oSketch.DimensionConstraints
	If oDim.Parameter.Name = "d0" Then
		Exit For
	End If
Next
If iProperties.Value("Custom", "NEF3-2 ECO") = "" And iProperties.Value("Custom", "ECO") = "" Then
  oDim.Parameter.Value = 7.125
  ThisDrawing.Document.StylesManager.Layers("NEF3 1").Visible = False 
Else If iProperties.Value("Custom", "NEF3-2 ECO") IsNot "" And iProperties.Value("Custom", "ECO") IsNot "" Then
  oDim.Parameter.Value = 11.875
  ThisDrawing.Document.StylesManager.Layers("NEF3 1").Visible = False
End If
oTitleBlockDef.ExitEdit

 

PDM/CAD Administrator
Using Inventor/Vault 2024.3
0 Likes