.NET

.NET

Reply
Active Member
geeThanks
Posts: 6
Registered: ‎12-17-2012
Message 1 of 7 (117,674 Views)

Selecting and Moving grips on dynamic blocks?

117674 Views, 6 Replies
12-17-2012 07:33 AM

I apologize if this has been answered before, I took the time to search and was unable to find anything that seemed relevant. I have also had trouble figuring out the documentation.

 

Is there a way to select a specific grip within a dynamic block and then update its position?

Would some one be kind enough to share an example, or point me in the right direction?

 

Thanks!

Active Member
geeThanks
Posts: 6
Registered: ‎12-17-2012
Message 2 of 7 (117,654 Views)

Re: Selecting and Moving grips on dynamic blocks?

12-17-2012 10:11 AM in reply to: geeThanks

This is what I am trying currently.

 

public void MoveGrip(Point3d gripPoint, Vector3d offset)
        {
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Transaction tr = db.TransactionManager.StartTransaction();
            using (tr)
            {
                BlockReference br = null;
                Entity ent = (Entity)tr.GetObject(_oBlockRefId, OpenMode.ForWrite);
                br = ent as BlockReference;
                if(br != null)
                {
                    GripDataCollection grips = new GripDataCollection();
                    GripDataCollection updateGrip = new GripDataCollection();
                    double curViewUnitSize = 0;
                    int gripSize = 0;
                    Vector3d curViewDir = doc.Editor.GetCurrentView().ViewDirection;
                    GetGripPointsFlags bitFlags = GetGripPointsFlags.GripPointsOnly;
                    br.GetGripPoints(grips, curViewUnitSize, gripSize, curViewDir, bitFlags);
                    foreach (GripData grip in grips)
                    {
                        if (grip.GripPoint == gripPoint)
                        {
                            updateGrip.Add(grip);
                        }
                    }
                    br.MoveGripPointsAt(updateGrip, offset, MoveGripPointsFlags.Polar);
                }
            }
        }

 Stepping through it, it looks like I do get a collection of points, and one does match with the position passed in.

What does not work is "MoveGripPointsAt", I have tried using the different enums available. No luck so far.

 

 

Active Member
geeThanks
Posts: 6
Registered: ‎12-17-2012
Message 3 of 7 (117,640 Views)

Re: Selecting and Moving grips on dynamic blocks?

12-17-2012 12:57 PM in reply to: geeThanks

Just to clarify what I am trying to accomplish,

I have pipes that need to be streched and rotated to have their ends pined to a specified point.

I can manually select the polar grip and pin it to the point.

What I want is to avoid having to calculate the angles and strech values.

Some of the dynamic blocks have different property names, some rotations are offset, and some blocks are inverted.

 

Please any suggestions would be much appreciated.

Active Member
geeThanks
Posts: 6
Registered: ‎12-17-2012
Message 4 of 7 (97,398 Views)

Re: Selecting and Moving grips on dynamic blocks?

12-18-2012 09:15 AM in reply to: geeThanks

Im being told its not possible to get a grip, and update its postition? I find it hard to believe.

Would really appreciate some some input.

 

Trying to find any information on GetGripData, and MoveGripPointsAt has been a huge pain.

I feel like It should not be this difficult.

 

This looks like its the only documentation out there, http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html

Active Member
geeThanks
Posts: 6
Registered: ‎12-17-2012
Message 5 of 7 (32,317 Views)

Re: Selecting and Moving grips on dynamic blocks?

12-19-2012 07:11 AM in reply to: geeThanks

Anybody out there?

Active Member
geeThanks
Posts: 6
Registered: ‎12-17-2012
Message 6 of 7 (2,889 Views)

Re: Selecting and Moving grips on dynamic blocks?

12-20-2012 01:13 PM in reply to: geeThanks

bump

Moderator
Alexander.Rivilis
Posts: 1,406
Registered: ‎04-09-2008
Message 7 of 7 (328 Views)

Re: Selecting and Moving grips on dynamic blocks?

12-20-2012 01:31 PM in reply to: geeThanks

There is only one documented way of modifying dynamic blocks - ObjectARX SDK Docs-> Dynamic Blocks, Protocol Reactors, and Evaluation Graphs-> Dynamic Block API


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

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