Point Group Order

Point Group Order

jroot
Advisor Advisor
1,396 Views
10 Replies
Message 1 of 11

Point Group Order

jroot
Advisor
Advisor

Is there a way to automate the elevation of the "_All Points" point group from either the command line, LISP, or Action Recorder?  I want to quickly move it to the top without going through the dialog box.

0 Likes
Accepted solutions (1)
1,397 Views
10 Replies
Replies (10)
Message 2 of 11

Kevin.Spear
Advisor
Advisor
Not that i am aware of. But there are survey add-ons to c3d that provide a saved sort order of point groups that you could then recall, like a saved view. One add-on is the Sinc-pac from Quux software.

Thanks
Kevin

Kevin Spear, PE
0 Likes
Message 3 of 11

Jeff_M
Consultant
Consultant
Accepted solution

Although I am partial to the tool @Kevin.Spear mentioned in the Sincpac, here is a small .NET program you can load and run the command MoveAllPointsToTop . Before unzipping the file, be sure to Unblock it by going to the file's properties and click the Unblock button. Then save the dll wherever you wish. Use NETLOAD to load the dll into C3D. This dll should work in most versions of C3D, tested in 2016 & 2018. You could even create a small lisp to load and run the command.

 

For anyone interested, the entire c# code for this tool is:

using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.Civil.ApplicationServices;

namespace PointGroupTools
{
    public class Class1
    {
        [CommandMethod("MoveAllPointsToTop")]
        public void moveallpointstotop()
        {
            var civdoc = CivilApplication.ActiveDocument;
            var ptgrps = civdoc.PointGroups;
            var allpts = ptgrps["_All Points"];
            var neworder = new ObjectIdCollection();
            neworder.Add(allpts);
            foreach(ObjectId id in ptgrps.DrawOrder)
            {
                if (!neworder.Contains(id))
                    neworder.Add(id);
            }
            ptgrps.DrawOrder = neworder;
        }
    }
}
Jeff_M, also a frequent Swamper
EESignature
Message 4 of 11

jefflambert9091
Advisor
Advisor

How about taking it back down? 🙂

Jeff
Civil 3D 2024
0 Likes
Message 5 of 11

Jeff_M
Consultant
Consultant

And here is a new dll which includes two commands: MoveAllPointsToTop and MoveAllPointsToBottom

 

The code for the second command is:

        [CommandMethod("MoveAllPointsToBottom")]
        public void moveallpointstoBottom()
        {
            var civdoc = CivilApplication.ActiveDocument;
            var ptgrps = civdoc.PointGroups;
            var allpts = ptgrps["_All Points"];
            var neworder = new ObjectIdCollection();
            foreach (ObjectId id in ptgrps.DrawOrder)
            {
                if (id != allpts)
                    neworder.Add(id);
            }
            neworder.Add(allpts);
            ptgrps.DrawOrder = neworder;
        }
Jeff_M, also a frequent Swamper
EESignature
Message 6 of 11

jefflambert9091
Advisor
Advisor

Thanks! 

Jeff
Civil 3D 2024
0 Likes
Message 7 of 11

jroot
Advisor
Advisor

This has been a huge help @Jeff_M  and I need to ask another huge favor.

Could you compile another dll for me that moves a group called "No_Display" to the top? (to go along with MoveAllPointsToTop)

I started fumbling my way through Visual Studio but kept getting glassy-eyed.

0 Likes
Message 8 of 11

Jeff_M
Consultant
Consultant

@jroot here ya go.

Jeff_M, also a frequent Swamper
EESignature
Message 9 of 11

jroot
Advisor
Advisor

Beautiful!  Thank you for your time and talent @Jeff_M !

Message 10 of 11

Anonymous
Not applicable

Hi @Jeff_M,

 

I've been getting into the lisp routines to simplify my processes but now trying to do something similar for ordering the point group. This C# and dll is a bit over my head, but the code works great for "_All Points". Would you be able to find the time to tweak the code for my specific point groups.  I've given it a shot but clearly missing one specific line in the attached.

 

 

0 Likes
Message 11 of 11

Jeff_M
Consultant
Consultant

@Anonymous sorry I missed seeing your message until now. Your code was close, just need that highlighted line to be like so:

if (targetpg != ptgrps.DrawOrder[0]); then <<<<<<<<<<<<<<<<<<<<<<<

Jeff_M, also a frequent Swamper
EESignature