You may want to use command using API invoke method acedCmd
e.g. open desired block in block editor then perform this code
(it's not mine though)
// Replace "accore.dll" by "acad.exe" for AutoCAD versions prior to 2013
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acad.exe", EntryPoint = "acedCmd", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
extern static private int acedCmd(IntPtr resbuf);
[CommandMethod("offpl")]
public void cmdOffset()
{
ResultBuffer rb = new ResultBuffer();
// RTSTR = 5005
rb.Add(new TypedValue(5005, "_.OFFSET"));
// start the insert command
acedCmd(rb.UnmanagedObject);
bool quit = false;
// loop round while the insert command is active
while (!quit)
{
// see what commands are active
string cmdNames = (string)Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("CMDNAMES");
// if the INSERT command is active
if (cmdNames.ToUpper().IndexOf("OFFSET") >= 0)
{
// then send a PAUSE to the command line
rb = new ResultBuffer();
// RTSTR = 5005 - send a user pause to the command line
rb.Add(new TypedValue(5005, "\\"));
acedCmd(rb.UnmanagedObject);
}
else
// otherwise quit
quit = true;
}
}