<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re : JIG multiple entities in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/3814651#M50328</link>
    <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can build a class which derives from DrawJig.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a little example to drag multiple entities. The entites passed to DragEntitiesJig instance have to be opened within a transaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    class DragEntitiesJig : DrawJig
    {
        Point3d basePoint, dragPoint;
        IEnumerable&amp;lt;Entity&amp;gt; ents;

        public DragEntitiesJig(IEnumerable&amp;lt;Entity&amp;gt; ents, Point3d basePoint)
        {
            this.basePoint = basePoint;
            this.ents = ents;
        }

        protected override bool WorldDraw(WorldDraw draw)
        {
            WorldGeometry wGeom = draw.Geometry;
            Matrix3d disp = Matrix3d.Displacement(this.basePoint.GetVectorTo(this.dragPoint));
            wGeom.PushModelTransform(disp);
            foreach (Entity ent in this.ents)
            {
                wGeom.Draw(ent);
            }
            wGeom.PopModelTransform();
            return true;
        }

        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions options = new JigPromptPointOptions("\nSecond point: ");
            options.BasePoint = this.basePoint;
            options.UseBasePoint = true;
            options.Cursor = CursorType.RubberBand;
            options.UserInputControls = UserInputControls.Accept3dCoordinates;
            PromptPointResult ppr = prompts.AcquirePoint(options);
            if (ppr.Value.IsEqualTo(this.dragPoint))
                return SamplerStatus.NoChange;
            this.dragPoint = ppr.Value;
            return SamplerStatus.OK;
        }
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2013 09:10:24 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2013-03-26T09:10:24Z</dc:date>
    <item>
      <title>JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/3814624#M50327</link>
      <description>&lt;P&gt;Hi Pro,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to Jig multiple entities such as insert a block and add a line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 08:37:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/3814624#M50327</guid>
      <dc:creator>ditran7577</dc:creator>
      <dc:date>2013-03-26T08:37:55Z</dc:date>
    </item>
    <item>
      <title>Re : JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/3814651#M50328</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can build a class which derives from DrawJig.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a little example to drag multiple entities. The entites passed to DragEntitiesJig instance have to be opened within a transaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    class DragEntitiesJig : DrawJig
    {
        Point3d basePoint, dragPoint;
        IEnumerable&amp;lt;Entity&amp;gt; ents;

        public DragEntitiesJig(IEnumerable&amp;lt;Entity&amp;gt; ents, Point3d basePoint)
        {
            this.basePoint = basePoint;
            this.ents = ents;
        }

        protected override bool WorldDraw(WorldDraw draw)
        {
            WorldGeometry wGeom = draw.Geometry;
            Matrix3d disp = Matrix3d.Displacement(this.basePoint.GetVectorTo(this.dragPoint));
            wGeom.PushModelTransform(disp);
            foreach (Entity ent in this.ents)
            {
                wGeom.Draw(ent);
            }
            wGeom.PopModelTransform();
            return true;
        }

        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions options = new JigPromptPointOptions("\nSecond point: ");
            options.BasePoint = this.basePoint;
            options.UseBasePoint = true;
            options.Cursor = CursorType.RubberBand;
            options.UserInputControls = UserInputControls.Accept3dCoordinates;
            PromptPointResult ppr = prompts.AcquirePoint(options);
            if (ppr.Value.IsEqualTo(this.dragPoint))
                return SamplerStatus.NoChange;
            this.dragPoint = ppr.Value;
            return SamplerStatus.OK;
        }
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 09:10:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/3814651#M50328</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2013-03-26T09:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/3814657#M50329</link>
      <description>&lt;P&gt;If you google internet you look many samples. For example:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/NET/Multiple-entities-jig/td-p/2304511" target="_blank"&gt;http://forums.autodesk.com/t5/NET/Multiple-entities-jig/td-p/2304511&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://spiderinnet1.typepad.com/blog/2012/05/autocad-net-use-drawjig-to-move-multiple-entities-as-manyvarious-as-we-like.html" target="_blank"&gt;http://spiderinnet1.typepad.com/blog/2012/05/autocad-net-use-drawjig-to-move-multiple-entities-as-manyvarious-as-we-like.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://through-the-interface.typepad.com/through_the_interface/2007/05/using_a_jig_fro.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2007/05/using_a_jig_fro.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://through-the-interface.typepad.com/through_the_interface/2009/03/jigging-an-autocad-block-with-attributes-using-net.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2009/03/jigging-an-autocad-block-with-attributes-using-net.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 09:14:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/3814657#M50329</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2013-03-26T09:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/3815595#M50330</link>
      <description>&lt;P&gt;Here is code example very limited tested on A2010&lt;/P&gt;&lt;P&gt;see if this works,keep in mind, to change Clone method jn&lt;/P&gt;&lt;P&gt;DeepCloneObjects if your entities have Xdata embedded&lt;/P&gt;&lt;PRE&gt;        // based on Kean Walmsley example (jig mtext)
         [CommandMethod("dej")]
        public void MoveCopyJig()
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Database db = HostApplicationServices.WorkingDatabase;
            Editor ed = doc.Editor;
            try
            {
                using (Transaction tr = doc.TransactionManager.StartTransaction())
                {
                    SelectionSet sset = ed.GetSelection().Value;
                    Point3d basept = ed.GetPoint("\nBase point: ").Value;
                    IEnumerable&amp;lt;Entity&amp;gt; objs = sset.GetObjectIds().Select(x =&amp;gt; (Entity)tr.GetObject(x, OpenMode.ForRead)).ToArray();
                    BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                    foreach (Entity e in objs)
                    {
                        Entity c = (Entity)e.Clone();// you may want to use DeepCloneObjects instead
                        btr.AppendEntity(c);
                        tr.AddNewlyCreatedDBObject(c, true);

                    }
                    ed.SetImpliedSelection(sset);

                    PromptSelectionResult psr = ed.SelectImplied();

                    // drag our jig

                    if (psr.Status == PromptStatus.OK)
                    {
                        // jig whole selection

                        PromptPointResult ppr =
                          ed.Drag(
                            psr.Value,
                            "\nSpecify displacement point: ",
                            delegate(Point3d pt, ref Matrix3d mat)
                            {
                                // If no change has been made, say so
                                if (basept == pt)
                                    return SamplerStatus.NoChange;
                                else
                                {
                                    // Otherwise we return the displacement
                                    // matrix for the current position
                                    mat = Matrix3d.Displacement(basept.GetVectorTo(pt)
                                      );
                                }
                                return SamplerStatus.OK;
                            }
                          );

                        // Assuming it works, transform our MText
                        // appropriately

                        if (ppr.Status == PromptStatus.OK)
                        {
                            // Get the final translation matrix

                            Matrix3d mat = Matrix3d.Displacement(basept.GetVectorTo(ppr.Value)
                              );

                            foreach (Entity en in objs)
                            {
                                en.UpgradeOpen();
                                en.TransformBy(mat);
                            }
                        }
                        // Finally we commit our transaction
                        tr.Commit();
                    }
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage(ex.ToString());
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 19:59:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/3815595#M50330</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2013-03-26T19:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Re : JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/9809016#M50331</link>
      <description>&lt;P&gt;Hello Gile,&lt;/P&gt;&lt;P&gt;I needed this and as&amp;nbsp;usual, you solved it by simplest way.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2020 03:55:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/9809016#M50331</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2020-10-18T03:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Re : JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12105043#M50332</link>
      <description>&lt;P&gt;Giles, Hi&lt;BR /&gt;I was wondering how can I jig multiple block references with one base point using JIG?&lt;/P&gt;&lt;P&gt;I understood that in order to use your method and IEnumerable, I have to use yield return which requires object ID. but my block reference is not created yet to have an objectID.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jul 2023 13:55:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12105043#M50332</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-07-16T13:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Re : JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12105047#M50333</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10854705"&gt;@a.kouchakzadeh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;...I understood that in order to use your method and IEnumerable, I have to use yield return which requires object ID. but my block reference is not created yet to have an objectID.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have to yield return not ObjectId but Entity.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jul 2023 13:59:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12105047#M50333</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2023-07-16T13:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Re : JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12105101#M50334</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10854705"&gt;@a.kouchakzadeh&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;
&lt;P&gt;I understood that in order to use your method and IEnumerable, I have to use yield return which requires object ID. but my block reference is not created yet to have an objectID.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The DragEntitiesJig constructors requires an IEnumerable&amp;lt;Entities&amp;gt; as argument, not an IEnumerable&amp;lt;ObjectId&amp;gt;.&lt;/P&gt;
&lt;P&gt;That said, you can pass this constructor any generic collection type which implements the IEnumerable&amp;lt;Entity&amp;gt; interface such as a List&amp;lt;Entity&amp;gt; or Entity[].&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jul 2023 14:52:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12105101#M50334</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-07-16T14:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Re : JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12105899#M50335</link>
      <description>&lt;P&gt;thanks for the reply to both of you.&lt;BR /&gt;Giles, I modified your code because I didnt want the basepoint option. now I have a problem:&lt;/P&gt;&lt;P&gt;I cant see the block ref moving with my cursor. its only at (0,0,0).&lt;/P&gt;&lt;P&gt;what Im I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;class DragEntitiesJig : DrawJig
    {
        Point3d dragPoint;
        IEnumerable&amp;lt;Entity&amp;gt; ents;

        public DragEntitiesJig(IEnumerable&amp;lt;Entity&amp;gt; ents)
        {
            
            this.ents = ents;
        }

        protected override bool WorldDraw(WorldDraw draw)
        {
            WorldGeometry wGeom = draw.Geometry;
            foreach (Entity ent in this.ents)
            {
                wGeom.Draw(ent);
            }
            wGeom.PopModelTransform();
            return true;
        }

        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            
            var options = new JigPromptPointOptions();
            options.UserInputControls = (UserInputControls.Accept3dCoordinates);
            var result = prompts.AcquirePoint(options);
            if (dragPoint.IsEqualTo(result.Value))
                return SamplerStatus.NoChange;
            else
                dragPoint = result.Value;
            return SamplerStatus.OK;

        }
        
    }&lt;/LI-CODE&gt;&lt;P&gt;and this is my test method:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public class JigTest
    {
        [CommandMethod("test")]
        public void Test()
        {
            var doc = acap.DocumentManager.MdiActiveDocument;
            var ed = doc.Editor;
            var db = doc.Database;

            using (var tr = db.TransactionManager.StartTransaction())
            {
                var blkTable = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                var blk1 = new ObjectId();
                var blk2 = new ObjectId();
                var curSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);

                blk1 = blkTable["1"];
                blk2 = blkTable["2"];

                var blkref1 = new BlockReference(Point3d.Origin, blk1);
                var blkref2 = new BlockReference(Point3d.Origin, blk2);

                var blkList = new List&amp;lt;Entity&amp;gt;()
                {
                    blkref1, 
                    blkref2
                };

                var jig = new DragEntitiesJig(blkList);
                var jigResult = ed.Drag(jig);
                if (jigResult.Status == PromptStatus.OK)
                {
                    curSpace.AppendEntity(blkref1);
                    tr.AddNewlyCreatedDBObject(blkref1, true);
                    curSpace.AppendEntity(blkref2);
                    tr.AddNewlyCreatedDBObject(blkref2, true);
                }
                tr.Commit();
            }
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;also can you tell me how to modify the class driven from EntityJig to get multiple entities?&amp;nbsp; can I remove &lt;STRONG&gt;:base(br)&lt;/STRONG&gt;&amp;nbsp;in the line :&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;public&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;JigBlockReference&lt;/SPAN&gt;(BlockReference&amp;nbsp;&lt;SPAN&gt;br&lt;/SPAN&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;base&lt;/SPAN&gt;(br)&lt;/PRE&gt;&lt;LI-CODE lang="csharp"&gt;public class JigBlockReference : EntityJig
    {
        protected Point3d dragPoint;
        protected BlockReference br;

        public JigBlockReference(BlockReference br)
            : base(br)
        {
            this.br = br;
            dragPoint = br.Position;
        }

        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var options = new JigPromptPointOptions(
                "\nSpecify destination point or rotate 90° [Left/Right]: ", "Left Right");
            options.UserInputControls = (UserInputControls.GovernedByOrthoMode);
            var result = prompts.AcquirePoint(options);
            if (dragPoint.IsEqualTo(result.Value))
                return SamplerStatus.NoChange;
            else
                dragPoint = result.Value;
            return SamplerStatus.OK;
        }

        protected override bool Update()
        {
            br.Position = dragPoint;
            return true;
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 05:18:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12105899#M50335</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-07-17T05:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Re : JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12105918#M50336</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10854705"&gt;@a.kouchakzadeh&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;
&lt;P&gt;Giles, I modified your code because I didnt want the basepoint option. now I have a problem:&lt;/P&gt;
&lt;P&gt;I cant see the block ref moving with my cursor. its only at (0,0,0).&lt;/P&gt;
&lt;P&gt;what Im I doing wrong?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You need a base point to define the displacement from this base to the cursor (dragPoint), and you need to call PushModelTransform passing it this displacement to see the block moving.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10854705"&gt;@a.kouchakzadeh&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;
&lt;P&gt;also can you tell me how to modify the class driven from EntityJig to get multiple entities?&amp;nbsp; can I remove &lt;STRONG&gt;:base(br)&lt;/STRONG&gt;&amp;nbsp;in the line :&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;public&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;JigBlockReference&lt;/SPAN&gt;(BlockReference&amp;nbsp;&lt;SPAN&gt;br&lt;/SPAN&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:&amp;nbsp;&lt;SPAN&gt;base&lt;/SPAN&gt;(br&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;EntityJig is to be used to jig a single entity and the derived class must pass this entity to the base class.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 05:36:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12105918#M50336</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-07-17T05:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Re : JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106003#M50337</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;SPAN&gt;You need a base point to define the displacement from this base to the cursor (dragPoint), and you need to call PushModelTransform passing it this displacement to see the block moving.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;can you please give me an example how to do it?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 06:30:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106003#M50337</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-07-17T06:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Re : JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106443#M50338</link>
      <description>&lt;P&gt;Here's an example inspired your upper one. The "base point" is Point3d.Origin (insertion point of newly created block references).&lt;/P&gt;
&lt;P&gt;To make the Test command safer, it checks if the current drawing block table contains "1" and "2" block definitons, and use s using statements to ensure the disposing of newly created block references in case they're not added to the&amp;nbsp; transaction (i.e. the user cancels the jig).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("TEST")]
        public void Test()
        {
            var doc = acap.DocumentManager.MdiActiveDocument;
            var ed = doc.Editor;
            var db = doc.Database;

            using (var tr = db.TransactionManager.StartTransaction())
            {
                var blkTable = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;

                // check if the block table has "1" and "2" blocks
                if (!(blkTable.Has("1") &amp;amp;&amp;amp; blkTable.Has("2")))
                    return;

                // wrap the newly created block reference in using statements to ensure
                // they're disposed in case the user cancels the jig
                using (var blkref1 = new BlockReference(Point3d.Origin, blkTable["1"]))
                using (var blkref2 = new BlockReference(Point3d.Origin, blkTable["2"]))
                {
                    var blkList = new List&amp;lt;Entity&amp;gt;()
                    {
                        blkref1,
                        blkref2
                    };

                    var jig = new DragEntitiesFromOriginJig(blkList);
                    var jigResult = ed.Drag(jig);
                    if (jigResult.Status == PromptStatus.OK)
                    {
                        var curSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                        blkref1.TransformBy(jig.Transform);
                        curSpace.AppendEntity(blkref1);
                        tr.AddNewlyCreatedDBObject(blkref1, true);
                        blkref2.TransformBy(jig.Transform);
                        curSpace.AppendEntity(blkref2);
                        tr.AddNewlyCreatedDBObject(blkref2, true);
                    }
                }
                tr.Commit();
            }
        }

        class DragEntitiesFromOriginJig : DrawJig
        {
            Point3d dragPoint;
            IEnumerable&amp;lt;Entity&amp;gt; ents;

            public Matrix3d Transform { get; private set; }

            public DragEntitiesFromOriginJig(IEnumerable&amp;lt;Entity&amp;gt; ents)
            {
                this.ents = ents;
            }

            protected override bool WorldDraw(WorldDraw draw)
            {
                var wGeom = draw.Geometry;
                if (wGeom != null)
                {
                    // Update the Transform matrix (displacement from origin to dragPoint)
                    Transform = Matrix3d.Displacement(dragPoint.GetAsVector());
                    wGeom.PushModelTransform(Transform);
                    foreach (Entity ent in this.ents)
                    {
                        wGeom.Draw(ent);
                    }
                    wGeom.PopModelTransform();
                }
                return true;
            }

            protected override SamplerStatus Sampler(JigPrompts prompts)
            {
                var options = new JigPromptPointOptions("\nSpecify destination point: ");
                options.UserInputControls = UserInputControls.Accept3dCoordinates;
                var ppr = prompts.AcquirePoint(options);
                if (ppr.Value.IsEqualTo(dragPoint))
                    return SamplerStatus.NoChange;
                dragPoint = ppr.Value;
                return SamplerStatus.OK;
            }
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 10:18:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106443#M50338</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-07-17T10:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106489#M50339</link>
      <description>&lt;P&gt;thanks Sir.&amp;nbsp;&lt;BR /&gt;I was wondering what happens if we do not dispose blkref? in general, when do we have to dispose some thing?&lt;/P&gt;&lt;P&gt;also, what does&amp;nbsp;blkref1&lt;SPAN&gt;.&lt;/SPAN&gt;TransformBy(jig&lt;SPAN&gt;.&lt;/SPAN&gt;Transform) do?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 10:43:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106489#M50339</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-07-17T10:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106607#M50340</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10854705"&gt;@a.kouchakzadeh&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;
&lt;P&gt;I was wondering what happens if we do not dispose blkref? in general, when do we have to dispose some thing?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you do not dispose newly created DBObjects (or any other disposable object) the memory they occupy cannot be freed, and AutoCAD may crash at an unpredictable moment.&lt;/P&gt;
&lt;P&gt;That said, we have to disposed any newly created or opened disposable object as soon as possible.&lt;/P&gt;
&lt;P&gt;Regarding DBObjects, when we open them with a transaction (transaction.GetObject) or when we add newly created ones to a transaction (transaction.AddNewlyCreatedDBObject) they will be autoamically disposed with the transaction disposing.&lt;/P&gt;
&lt;P&gt;In the upper case,&amp;nbsp; if the jig succeeds (the user specify a point) the newly created block references are added to the transaction and the disposing of the transaction sould take care of disposing them, but if the user cancels the jig, the block references won't be added to the transaction, this is why it's a recommended practice to wrap the 'new BlockReference) expression in a using statement.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 11:41:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106607#M50340</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-07-17T11:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106626#M50341</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10854705"&gt;@a.kouchakzadeh&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;
&lt;P&gt;also, what does&amp;nbsp;blkref1&lt;SPAN&gt;.&lt;/SPAN&gt;TransformBy(jig&lt;SPAN&gt;.&lt;/SPAN&gt;Transform) do?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;DrawJig uses transient graphics to display the entities jigging, but the block references where insrted at Point3d.Origin, so to reflect the jigging result, we need to displace the block references using the last transformation matrix used in the DrawJig class.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 11:51:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106626#M50341</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-07-17T11:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106670#M50342</link>
      <description>&lt;P&gt;nicely explained sir. thank you&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 12:12:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12106670#M50342</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-07-17T12:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Re : JIG multiple entities</title>
      <link>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12107762#M50343</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;Here's an example inspired your upper one. &amp;gt; . .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;very nice !&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 20:10:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/jig-multiple-entities/m-p/12107762#M50343</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2023-07-17T20:10:24Z</dc:date>
    </item>
  </channel>
</rss>

