.NET

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

Selecting and Moving grips on dynamic blocks?

117580 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
Posts: 6
Registered: ‎12-17-2012
Message 2 of 7 (117,560 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
Posts: 6
Registered: ‎12-17-2012
Message 3 of 7 (117,546 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
Posts: 6
Registered: ‎12-17-2012
Message 4 of 7 (97,304 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
Posts: 6
Registered: ‎12-17-2012
Message 5 of 7 (32,223 Views)

Re: Selecting and Moving grips on dynamic blocks?

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

Anybody out there?

Active Member
Posts: 6
Registered: ‎12-17-2012
Message 6 of 7 (2,795 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,345
Registered: ‎04-09-2008
Message 7 of 7 (234 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community