.NET

Reply
Valued Mentor
ralstogj
Posts: 615
Registered: ‎10-01-2006
Message 1 of 6 (332 Views)
Accepted Solution

Creating Sliding Grip

332 Views, 5 Replies
01-24-2013 01:55 AM

Hi

 

I am wanting to make a grip that slides along a polyline. Similar to the diamond shaped grips used in Civil3d to slide along alignments and pipe objects to pick stations and insert labels. Does anyone know how this can be done in .net.

 

 

Regards

Justin Ralston
http://c3dxtreme.blogspot.com/

Guys

 

Thanks for the suggestions, I also found this post by Norman that looks good as well. I guess the code final will be a mixer of all these suggestions

 

http://drive-cad-with-code.blogspot.co.nz/2012/03/moving-entity-along-curve.html

 

 

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 2 of 6 (315 Views)

Re: Creating Sliding Grip

01-24-2013 12:45 PM in reply to: ralstogj

Dou you want to draw something similar on this shape?

        public void drawDMShape()
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;
            Line ln = new Line();
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                double[] x = new double[61];
                double[] y = new double[61];
                int i = 0;
                int j = 0;
                int k = 0;
                double theta = 0;
                double t = 100;
                double _pi = Math.PI;
                k = 15;
                theta = 2 * _pi / k;
                for (i = 0; i <= k; i++)
                {
                    x[i] = t * Math.Cos(theta * (i + 1)) + 200;
                    y[i] = 200 - t * Math.Sin(theta * (i + 1));
                }
                for (i = 0; i <= k - 1; i++)
                {
                    for (j = i + 1; j <= k; j++)
                    {
                        ln = new Line(new Point3d(x[i], y[i], 0), new Point3d(x[j], y[j], 0));
                        btr.AppendEntity(ln);
                        tr.AddNewlyCreatedDBObject(ln, true);
                    }
                }
                tr.Commit();
            }
        }

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Valued Contributor
RichardCammeray
Posts: 59
Registered: ‎12-08-2010
Message 3 of 6 (307 Views)

Re: Creating Sliding Grip

01-24-2013 01:57 PM in reply to: Hallex

I am not sure if I understood correctly what you mean.

If you mean grip points then I used ideas from this link

http://www.theswamp.org/index.php?topic=42974.0

 

Richard

Valued Mentor
ralstogj
Posts: 615
Registered: ‎10-01-2006
Message 4 of 6 (299 Views)

Re: Creating Sliding Grip

01-24-2013 03:58 PM in reply to: ralstogj

Guys

 

Here is a picture from Civil3d of the sliding grip for a pipe label used to move the pipe label up and down the pipe.

Basically I want to copy this type of grip and use it to slide up and down the pipe, but instead of a label attached to the grip I will have a short piece of pipe that is the house lot connections angled at 45 degrees to the main pipe line.

Regards

Justin Ralston
http://c3dxtreme.blogspot.com/
Valued Contributor
RichardCammeray
Posts: 59
Registered: ‎12-08-2010
Message 5 of 6 (284 Views)

Re: Creating Sliding Grip

01-24-2013 04:50 PM in reply to: ralstogj

I am not very familiar with C3D but the way how to add new grip point is by using  overrule api.

If I were you I would check this links

-Monitoring grip edit and then move your short pipe

http://through-the-interface.typepad.com/through_the_interface/2009/08/gluing-a-point-to-an-autocad-...

-Add new diamond grip point

http://www.theswamp.org/index.php?topic=42974.0

 

Richard

 

Valued Mentor
ralstogj
Posts: 615
Registered: ‎10-01-2006
Message 6 of 6 (263 Views)

Re: Creating Sliding Grip

01-25-2013 01:58 AM in reply to: ralstogj

Guys

 

Thanks for the suggestions, I also found this post by Norman that looks good as well. I guess the code final will be a mixer of all these suggestions

 

http://drive-cad-with-code.blogspot.co.nz/2012/03/moving-entity-along-curve.html

 

 

Regards

Justin Ralston
http://c3dxtreme.blogspot.com/
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.