
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I hava a client that requires our drawings to be supplied in autocad dwg format with the fields having specific names. I have been sucessfull in doing this for 99% by creating a title block with the prompted entries named to match the clients names.
We use an ilogic form to populate all of our title blocks. When I run the code to read the form entries and update the prompted I get an error message:
"The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"
I have identfied the line of code that causes the issue and highlighted it in the attached code.
Any help would be gratefully appreciated.
Dim oDrawDoc As DrawingDocument
Dim oSheet As Sheet
Dim tb As Inventor.TextBox
'Dim oBorder As Border
Dim borderDef As BorderDefinition
Dim oTB1'oTB1 references to Titleblocks
Dim sValue As String
Dim oDrwNo As String
Dim oShtRevNo As String
Dim oPromptEnt As String
oDrawDoc = ThisApplication.ActiveDocument
oSheet = oDrawDoc.ActiveSheet
'oBorder = oSheet.Border
'borderDef = oBorder.Definition
oTB1 = oSheet.TitleBlock
For Each tb In oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes
If tb.Text = "TYPE" Then
sValue = oTB1.GetResultText(tb)
oDrwNo = TYPE
'MessageBox.Show("Property Field: " & tb.Text & vbCrLf & "Value: " & sValue & vbCrLf & "Prompted Entry: " & tb.FormattedText, "Prompted entry")
'MessageBox.Show("Param drw no " & oDrwNo, "Title")
Call oDrawDoc.ActiveSheet.TitleBlock.SetPromptResultText(tb, oDrwNo)
oPromptEnt = oTB1.GetResultText(tb)
'MessageBox.Show("Prompted value " & oPromptEnt, "Title")
End If
Next
For Each tb In oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes
If tb.Text = "BMA_DRAWING_NUMBER" Then
sValue = oTB1.GetResultText(tb)
oDrwNo = BMA_DRAWING_NUMBER
'MessageBox.Show("Property Field: " & tb.Text & vbCrLf & "Value: " & sValue & vbCrLf & "Prompted Entry: " & tb.FormattedText, "Prompted entry")
'MessageBox.Show("Param drw no " & oDrwNo, "Title")
Call oDrawDoc.ActiveSheet.TitleBlock.SetPromptResultText(tb, oDrwNo)
oPromptEnt = oTB1.GetResultText(tb)
'MessageBox.Show("Prompted value " & oPromptEnt, "Title")
End If
Next
For Each tb In oDrawDoc.ActiveSheet.TitleBlock.Definition.Sketch.TextBoxes
If tb.Text = "REV" Then
sValue = oTB1.GetResultText(tb)
oShtRevNo = REV
'MessageBox.Show("Property Field: " & tb.Text & vbCrLf & "Value: " & sValue & vbCrLf & "Prompted Entry: " & tb.FormattedText, "Prompted entry")
MessageBox.Show("Param drw no " & oShtRevNo, "Title")
oPromptEnt = oTB1.GetResultText(tb)
'MessageBox.Show("Prompted value " & oPromptEnt, "Title")
End If
Next
Solved! Go to Solution.