Message 1 of 1
callback_ObjectModified with OFFSET command
Not applicable
01-22-2009
07:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a Joist class that contains a member that is from the Autodesk.Aec.Structural.DatabaseServices.Member class. When the user performs a Copy, Mirror, or Array on one of the Joist objects in the drawing the callback_ObjectModified function is called and the e.DBObject that is available contains all of the XRecord data of the original object.
When the user does a Trim or Break command that splits one Joist into two, the XRecord data is not copied, but the original Joist object is passed in first so I can capture its properties and then copy them to the newly created objects.
However, when the user calls the Offset command on one of the Joist objects, the callback_ObjectModified does not get called for the original Joist object nor does it copy the original XRecord data to the newly drawn object.
My question is how can I get the originally selected object in this callback so that I can copy the XRecord and properties to the newly created object?
When I do Array, Copy and Mirror, I set the flag for InCopy to be true, but it doesn't work for Offset. So, again, how do I get the original object that is being Offset? Thank you for your time.
When the user does a Trim or Break command that splits one Joist into two, the XRecord data is not copied, but the original Joist object is passed in first so I can capture its properties and then copy them to the newly created objects.
However, when the user calls the Offset command on one of the Joist objects, the callback_ObjectModified does not get called for the original Joist object nor does it copy the original XRecord data to the newly drawn object.
My question is how can I get the originally selected object in this callback so that I can copy the XRecord and properties to the newly created object?
if (e.DBObject is Member)
{
BXCDBObject bxcObj = ownerDrawing.GetFramingObject(e.DBObject.Handle); //returns any object that is already defined as one of our objects
BXCJoist jst = null;
if (bxcObj is BXCJoist)
jst = (BXCJoist)bxcObj;
if (ownerDrawing.InCopy )
{
if (jst == null)
{
//Load the copied object from the drawing. It should contain the XRecord data from the original
ownerDrawing.ReadThisObject(e.DBObject);
jst = (BXCJoist)ownerDrawing.GetFramingObject(e.DBObject.Handle);
//jst.UpdateJoistOnModify();
}
}
if (ownerDrawing.InTrimBreak)
{
if (jst != null)
{
if (!ownerDrawing.TrimBreakObjects.Contains(e.DBObject))
ownerDrawing.TrimBreakObjects.Add(e.DBObject); //this keeps track of the original objects that were broken or trimmed
}
else if (ownerDrawing.TrimBreakObjects.Count > 0)
if (jst == null)
{
int index = ownerDrawing.TrimBreakObjects.Count - 1;
BXCJoist exJst = (BXCJoist)ownerDrawing.GetFramingObject(ownerDrawing.TrimBreakObjects[index].Handle); //gets the original object
jst = new BXCJoist(ownerDrawing, e.DBObject.Handle); //creates a new object
jst._properties.copy(exJst._properties);//copies the properties from the original to the newly created copy
ownerDrawing.AddFramingObject(jst.Handle, jst);
jst.Save();
ownerDrawing.TrimBreakObjects.RemoveAt(index);
jst.UpdateJoistOnModify();
}
}
if (jst != null)
{
if(!ownerDrawing._modifiedObjects.Contains(jst))
ownerDrawing._modifiedObjects.Add(jst);
}
}
When I do Array, Copy and Mirror, I set the flag for InCopy to be true, but it doesn't work for Offset. So, again, how do I get the original object that is being Offset? Thank you for your time.