Article | 60001001 |
Type | Wish |
Product | Engine |
Version | 6017 |
Date Added | 11/13/2009 |
Fixed | Yes [2/5/2010] |
Submitted by | Markus Persson |
Keywords |
In 6018 a new event OnFilterOsnap was added in vdDocument object.
OnFilterOsnap is fired before an OsnapPoint added into the active selected Osnap collection.
The event method has the following form.
void
OnFilterOsnap( object sender, vdEventArgs.FilterOsnapEventArgs args)sender : represents the active Document object
args : An object that contains the event data like Osnapoint and cancel property as boolean
The cancel will info VectorDraw to cancel or not its default implementation after the fire of the event.Default value is false
Set it to true in order the Osnapoint not to be added in osnaps
C# Example (Description: Osnap points of an Insert subentities are not added into osnaps collection.Only the OsnapMode.INS are added for the vdInsert object.)
doc.OnFilterOsnap += new vdDocument.FilterOsnapEventHandler(doc_OnFilterOsnap);//Enable event Implementation inside doc_OnFilterOsnap method
void doc_OnFilterOsnap(object sender, VectorDraw.Professional.vdEventArgs.FilterOsnapEventArgs args) { OsnapPoint pt = args.ObjectSnap;//get the Osnappoint that is going to be added in default osnappoints collection if (pt == null) return;//If it is not a valid OsnapPoint exit from method and do nothing vdFigure fig = pt.ObjectSnap as vdFigure;//Get the vdFigure where the OsnapPoint belongs if (fig == null) return;//If it is not a valid vdFigure exit from method and do nothing//Do not add the OsnapPoints that belongs on a vdInsert subentities
if (fig.Owner != null && fig.Owner.Owner != null && fig.Owner.Owner is vdBlock) args.Cancel = true;
}