Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hi Everyone,
I tried the below code to delete a particular group of symbols from my drawing but i am getting some error while executing the step. Error is attached with this discussion.
i tried many different loops but i am not able get hold of the symbol instances. I am not able to understand where exactly i am making the mistake.
Please suggest me a method to solve this issue.
Public Sub DeleteSymbolInstance(ByRef session As IpfcSession,
ByVal symbolname As String, ByVal instancename As String)
Dim model As IpfcModel
Dim drawing As IpfcModel2D
Dim symInstructions As IpfcDetailSymbolInstItem
Dim symItem As IpfcDetailSymbolInstItem
Try
model = session.CurrentModel
If model Is Nothing Then
Throw New Exception("Model not present")
End If
If Not model.Type = EpfcModelType.EpfcMDL_DRAWING Then
Throw New Exception("Model is not drawing")
End If
drawing = CType(model, IpfcDrawing)
Dim symbol As IpfcDetailSymbolDefItem = drawing.RetrieveSymbolDefinition(symbolname, Nothing, Nothing, False)
symInstructions = symbol.ListDetailItems(EpfcDetailType.EpfcDETAIL_SYM_INSTANCE)
symInstructions = symbol.GetInstructions()
symInstructions.TextValues = instancename
symItem = drawing.GetDetailItem(symInstructions)
symItem.Remove()
Catch ex As Exception
MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
End Try
End Sub
With Regards
Aghil.M