ObjectModified not triggered

ObjectModified not triggered

Anonymous
Not applicable
374 Views
6 Replies
Message 1 of 7

ObjectModified not triggered

Anonymous
Not applicable
When I edit block attributes using the "attedit" command the ObjectModified
event fires.
When I edit block attributes using the "eattedit" command the
ObjectModified event does NOT fire.

Is this a bug?
0 Likes
375 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
I discovered what was happening. (or NOT happening)
A couple of guys in another forum were kind enough to verify the behavior.

I say it's a bug.

"Mark Johnston" wrote in message
news:4862007@discussion.autodesk.com...
When I edit block attributes using the "attedit" command the ObjectModified
event fires.
When I edit block attributes using the "eattedit" command the
ObjectModified event does NOT fire.

Is this a bug?
0 Likes
Message 3 of 7

arcticad
Advisor
Advisor
I've never been able to make it work normally.

This is my work around to check an item that has been modified with Eattedit.

Public ModifiedObject As Variant

Private Sub AcadDocument_BeginDoubleClick(ByVal PickPoint As Variant)
Dim objss As AcadSelectionSet
Dim objent As AcadEntity
Dim sObjNme As String
Set objss = ThisDrawing.PickfirstSelectionSet
If Not objss Is Nothing Then
If objss.Count > 0 Then
Set objent = objss(objss.Count - 1)
sObjNme = objent.ObjectName
Set GmodifiedObject = objent
End If
End If
End Sub

Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
If CommandName = "EATTEDIT" Then
' do Stuff with Modified modifiedObject
End If
End Sub
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes
Message 4 of 7

Anonymous
Not applicable
I believe the object has to be created WithEvents something like

Dim WithEvents oLine As AcadLine

Sub()
Dim SP(2) As Double
Dim EP(2) As Double
Set oLine = ThisDrawing.ModelSpace.AddLine(SP, EP)
End Sub

Then I think when you do something with the line you created the
ObjectModified event will fire.

wrote in message news:5172450@discussion.autodesk.com...
I've never been able to make it work normally.

This is my work around to check an item that has been modified with
Eattedit.

Public ModifiedObject As Variant

Private Sub AcadDocument_BeginDoubleClick(ByVal PickPoint As Variant)
Dim objss As AcadSelectionSet
Dim objent As AcadEntity
Dim sObjNme As String
Set objss = ThisDrawing.PickfirstSelectionSet
If Not objss Is Nothing Then
If objss.Count > 0 Then
Set objent = objss(objss.Count - 1)
sObjNme = objent.ObjectName
Set GmodifiedObject = objent
End If
End If
End Sub

Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
If CommandName = "EATTEDIT" Then
' do Stuff with Modified modifiedObject
End If
End Sub
0 Likes
Message 5 of 7

arcticad
Advisor
Advisor
Ben, I think your mixing up the point of the post. With your code i still have to pre initalize the class before i can use it. And with eattedit the events modified will never be fired. Withevents won't help in this situation.
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes
Message 6 of 7

Anonymous
Not applicable
If memory serves me about the only thing you can do is trap the Begin and
End of a command. However, that's not going to telling you anything about
what changed.


wrote in message news:5173474@discussion.autodesk.com...
Ben, I think your mixing up the point of the post. With your code i still
have to pre initalize the class before i can use it. And with eattedit the
events modified will never be fired. Withevents won't help in this
situation.
0 Likes
Message 7 of 7

arcticad
Advisor
Advisor
This is correct, However when you double click an item the selection is stored in ThisDrawing.PickfirstSelectionSet so you can use this to save it off and use it later.

Also if you want to get the last object inserted in the drawing you can use this to get the last object.

use call GetLastEnt(0) 0 is the last added object so 0 is the last and 1 is the one before the last.

Function GetLastEnt(num As Long) As Object
Dim lastObj As Object
On Error GoTo theend
If IsModelspace Then
If Not ThisDrawing.ModelSpace.Count = 0 Then
Set GetLastEnt = ThisDrawing.ModelSpace(ThisDrawing.ModelSpace.Count - 1 - num)
End If
Else
If Not ThisDrawing.PaperSpace.Count < 1 Then
Set GetLastEnt = ThisDrawing.PaperSpace(ThisDrawing.PaperSpace.Count - 1 - num)
End If
End If
theend:
End Function

Function IsModelspace() As Boolean
Dim document As AcadDocument
For Each document In Documents
If document.Active = True Then
If document.ActiveSpace = acPaperSpace Then
IsModelspace = document.MSpace
Exit For
Else
IsModelspace = True
Exit For
End If
End If
Next
End Function
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes