Code Red > .NET

Using 1 entity to control another?

<< < (2/3) > >>

Jeff_M:
I save the Handle of each object in the other's Xdata so there's a link between them. Although, since the arc is invisible it is not selectable with normal selections (it can be obtained in code, but most users wouldn't have a need for that) it really doesn't need to know about the line. Selecting the line shows the grips where the arc grips would be (those are not the arc's actual grips) and then the arc is recalculated based on the movement of the grip. You will see in the code that if the line is erased I also erase the invisible arc so it's not left behind to pollute the drawing.

As for the copy issue, for the final version of this with the C3D labels, they cannot be copied anyway so I shouldn't have any problems with that.

The GripOverrule has the GetGripPoints and MoveGripPoints methods which are connected with the selection of the Line which, by default, is opened by Autocad for write. However, to work with the Arc, it must be opened for write in both of those methods in order show it and then modify it. These methods fire multiple times during a grip edit. I just made 1 edit to the arc in a test and there were 76 undo entries added for that 1 edit. That is about 75 too many. :-)

Jeff_M:
I ended up posting this over on the Autodesk .NET forum. Virupaksha Aithal suggested that the culprit of the multiple Undo entries was likely the Open.ForWrite call on the arc in the GetGripPoints. Sure enough, changing that to ForRead, and moving the 2 calls to modify the display of the arc to the MoveGripPointsAt method solved the Undo issue. Here's the final result for the intended application.
 

kdub_nz:

Well done Jeff.

MP:

--- Quote from: kdub on January 17, 2019, 05:09:55 PM ---Well done Jeff.
--- End quote ---

x 2!!

Atook:
Wow Jeff, that looks great! Looks like a great UI enhancement.


--- Quote from: Jeff_M on January 17, 2019, 03:55:29 PM ---...likely the Open.ForWrite call on the arc in the GetGripPoints. Sure enough, changing that to ForRead, and moving the 2 calls to modify the display of the arc to the MoveGripPointsAt method solved the Undo issue...

--- End quote ---

Were these changes to  Arc.GetGripPoints.OpenForWrite done via the overrule, an extension or some other kind of override?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version