.NET

Reply
Valued Mentor
joantopo
Posts: 676
Registered: ‎04-25-2010
Message 1 of 5 (142 Views)
Accepted Solution

transient line with dist command

142 Views, 4 Replies
06-02-2014 07:14 AM

Hi, I have my own "dist" command.

 

I pick 2 points and I show it in command line(by prompt).

 

However, I would like to show the line (graphicsInterface.Transient) during the process. When I pick the first point and finally pick the second point exactly as "dist" command of AutoCAD.

 

Thanks in advance.

 

Regards.

Autocad Civil 3D 2014 +SP1 // Civil 3D 2015
Quad Core Intel i7 3770-cpu 3.40Ghz.
ssd samsung 840 pro 512gb+ssd samsung 840 pro 256 gb+1tb hdd
32gb RAM 1600 Mhz.
nVidia Quadro 2000.
Win 7 Pro 64bit

Hi,

 

Look at the PromptPointOptions.BasePoint and PromptPointOptions.UseBasePoint properties.

 

Here's a little sample:

 

 [CommandMethod("Dist")]
public void GetdDstance()
{
Editor ed = AcAp.DocumentManager.MdiActiveDocument.Editor;
PromptPointOptions opts = new PromptPointOptions("\nSpecify the first point: ");
PromptPointResult reslt = ed.GetPoint(opts);
if (reslt.Status == PromptStatus.OK)
{
Point3d p1 = reslt.Value;
opts.Message = "\nSpecify the second point: ";
opts.BasePoint = p1;
opts.UseBasePoint = true;
reslt = ed.GetPoint(opts);
if (reslt.Status != PromptStatus.OK)
{
Point3d p2 = reslt.Value;
ed.WriteMessage("\nDistance: " + Converter.DistanceToString(p1.DistanceTo(p2)));
}
}
}

 

*Expert Elite*
Jeff_M
Posts: 4,387
Registered: ‎07-22-2003
Message 2 of 5 (132 Views)

Re: transient line with dist command

06-02-2014 07:56 AM in reply to: joantopo

Both the PromptPointOptions and PromptDistanceOptions have the properties "BasePoint", "UseBasePoint", & "UseDashedLine". This is what you use to get that rubberband line.

Jeff_M, also a frequent Swamper
*Expert Elite*
_gile
Posts: 2,086
Registered: ‎04-29-2006
Message 3 of 5 (129 Views)

Re : transient line with dist command

06-02-2014 08:04 AM in reply to: joantopo

Hi,

 

Look at the PromptPointOptions.BasePoint and PromptPointOptions.UseBasePoint properties.

 

Here's a little sample:

 

        [CommandMethod("Dist")]
        public void GetdDstance()
        {
            Editor ed = AcAp.DocumentManager.MdiActiveDocument.Editor;  
            PromptPointOptions opts = new PromptPointOptions("\nSpecify the first point: ");
            PromptPointResult reslt = ed.GetPoint(opts);
            if (reslt.Status == PromptStatus.OK)
            {
                Point3d p1 = reslt.Value;
                opts.Message = "\nSpecify the second point: ";
                opts.BasePoint = p1;
                opts.UseBasePoint = true;
                reslt = ed.GetPoint(opts);
                if (reslt.Status != PromptStatus.OK)
                {
                    Point3d p2 = reslt.Value;
                    ed.WriteMessage("\nDistance: " + Converter.DistanceToString(p1.DistanceTo(p2)));
                }
            }
        }

 

Gilles Chanteau
Valued Mentor
joantopo
Posts: 676
Registered: ‎04-25-2010
Message 4 of 5 (121 Views)

Re : transient line with dist command

06-02-2014 08:30 AM in reply to: _gile

Is this:

http://spiderinnet1.typepad.com/blog/2012/03/autocad-net-entityjig-jig-line-by-start-and-end-points....

 

But I don´t want to use a specific class;

 

I want to jig the temporary line until click the second point.

Autocad Civil 3D 2014 +SP1 // Civil 3D 2015
Quad Core Intel i7 3770-cpu 3.40Ghz.
ssd samsung 840 pro 512gb+ssd samsung 840 pro 256 gb+1tb hdd
32gb RAM 1600 Mhz.
nVidia Quadro 2000.
Win 7 Pro 64bit

Valued Mentor
joantopo
Posts: 676
Registered: ‎04-25-2010
Message 5 of 5 (106 Views)

Re : transient line with dist command

06-02-2014 09:07 AM in reply to: joantopo

Yes.

It is ".UseBasePoint".

 

Thanks.

Autocad Civil 3D 2014 +SP1 // Civil 3D 2015
Quad Core Intel i7 3770-cpu 3.40Ghz.
ssd samsung 840 pro 512gb+ssd samsung 840 pro 256 gb+1tb hdd
32gb RAM 1600 Mhz.
nVidia Quadro 2000.
Win 7 Pro 64bit

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.