Ok, I understand, but to create extension dictionary to set associativity
will be spend a lot of work
Here is simple way:
[CommandMethod("assocdim")]
public void CreateAssocDim()
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
PromptEntityOptions peo = new PromptEntityOptions("\nSelect line: ");
peo.SetRejectMessage("\nYou have to select line only!");
peo.AddAllowedClass(typeof(Autodesk.AutoCAD.DatabaseServices.Line), true);
PromptEntityResult res = ed.GetEntity(peo);
if (res.Status != PromptStatus.OK) return;
ObjectId id = res.ObjectId;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
try
{
Autodesk.AutoCAD.DatabaseServices.Line ln = trans.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Line;
Point3d p1 = ln.StartPoint;
Point3d p2 = ln.EndPoint;
Point3d txpt = p1;
Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("dimassoc", 2);
doc.SendStringToExecute("_dimlinear end " + p1.X.ToString() + "," + p1.Y.ToString() + "," + p1.Z.ToString() +
" end " + p2.X.ToString() + "," + p2.Y.ToString() + "," + p2.Z.ToString() + " " +
txpt.X.ToString() + " " + txpt.Y.ToString() + "," + txpt.Z.ToString() + " ", true, false, false);
trans.Commit();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
} If this is not enough so say me about
~'J'~
_____________________________________
C6309D9E0751D165D0934D0621DFF27919