Hi Norman,
Thanks for the response that didn't work but I'm trying to make an offset command that displays an offset curve. The world draw is used to display the proposed offset curve to the user. I'm not too sure what the best time to do the highlight is but the List of Curves that I'm displaying are generated using the "GetOffsetCurves" command. Does my curve need to be in the database in order to be highlighted? I don't add the object during the world draw.
Here's the code I use to build the offset curve.
Private Sub objOffset(ByVal offset As Double)
Dim oDoc As Document = Core.Application.DocumentManager.MdiActiveDocument
Try
Dim oDbObjectCollection As DBObjectCollection = Nothing
Try
oDbObjectCollection = _SelectedCurve.GetOffsetCurves(offset)
Catch ex As Exception
End Try
If oDbObjectCollection IsNot Nothing AndAlso oDbObjectCollection.Count > 0 Then
Using oTr As Transaction = oDoc.Database.TransactionManager.StartTransaction
Dim LayerId As ObjectId
If _LayerUsage = OffsetLayerUsage.UserDefined AndAlso _LayerName.Length > 0 Then
Dim layerDir As New LayerDirector
With layerDir
.ModType = ModEnum.Assert
.ModOptionsBuilder.HDatabase = oDoc.Database
.ModOptionsBuilder.HDocument = oDoc
.ModOptionsBuilder.HTransaction = oTr
.ModOptionsBuilder.LayerString = _LayerName
.ApplyMod()
End With
LayerId = layerDir.ProductObjectId
End If
For Each oEnt As Entity In oDbObjectCollection
Dim oCurve As Curve = TryCast(oEnt, Curve)
oCurve.Highlight()
If oCurve IsNot Nothing Then _OffsetCurveList.Add(TryCast(oCurve.Clone, Curve))
Select Case _LayerUsage
Case OffsetLayerUsage.Current
oEnt.LayerId = oDoc.Database.Clayer
Case OffsetLayerUsage.Source
oEnt.LayerId = _SelectedCurve.LayerId
Case OffsetLayerUsage.UserDefined
If LayerId.IsValid Then oEnt.LayerId = LayerId
End Select
Next
oTr.Commit()
End Using
oDbObjectCollection.Dispose()
End If
Catch ex As Exception
ReportError(ex)
End Try
End Sub