- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good day,
Hoping someone here can help me figure this out. I am using the code below (slapped together from snippets found here and help docs) to place custom stamps (sketched symbols) on drawings. On the drawing template file, I have a muli-value list parameter for each of the stamps we use. The stamps are saved in the drawing template and depending on the user's choice (radio buttons), this stamp is placed on each of the drawing sheets.
This worked well for me and my colleagues until a couple of months ago, when it suddenly stopped working for some of us. The only thing I can think of is something must have changed during one of the updates. This issue is also present in 2025. Whenever I run the code, I get the following error:
"Error on line 22 in rule: Place Stamps, in document: ENFMIL2407001 REV1.idw
The parameter is incorrect. (0x80070057 (E_INVALIDARG))"
Sub Main()
oDrawDoc = ThisApplication.ActiveDocument
DeleteStamps()
PlaceStamp()
oDrawDoc.Update
End Sub
Dim oDrawDoc As DrawingDocument
Dim oStamp As String
Sub PlaceStamp()
'create insertion point, coordinates - are cm
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oInsertionPoint As Point2d
oStamp = "Stamp - " + Parameter("StampsList")
'MessageBox.Show(oStamp + " is selected", "Stamp")
'define the insert point for the symbol
oInsertionPoint = oTG.CreatePoint2d(0,29.7) ' X = 0 cm , Y = 29.7 cm
'define symbol Definition to use
oSymDef = oDrawDoc.SketchedSymbolDefinitions.Item(oStamp)
' Iterate through the sheet
For Each oSheet In oDrawDoc.Sheets
oSheet.Activate
'insert the new symbol
'Nothing is used when teh symbol has no prompted entry
oSym = oSheet.SketchedSymbols.Add(oSymDef,oInsertionPoint,0,1,Nothing)
Next 'next sheet
End Sub
Sub DeleteStamps()
' Iterate through the sheet
For Each oSheet In oDrawDoc.Sheets
oSheet.Activate
'Iterate through each symbol in the active sheet
For Each oSymbol In oSheet.SketchedSymbols
'look for the symbol by name
If oSymbol.Name.Contains ("Stamp") Then
'delete the symbol
oSymbol.Delete
Else
End If
Next 'next symbol
Next 'next sheet
End Sub
Solved! Go to Solution.
