Before I will explore Grip Overrule world I have one question.
Is it possible to add new grip points into Entity?
Solved! Go to Solution.
Here is a sample on GripOverrule by Stephen Preston :
The problem that you are having now is not clear to me. What do you mean by "grip point selected with each mouse move BlockTableRecord is modified" ?
Can you please provide a simple buildable project to reproduce the problem ?
I have used for my project a sample found in Kean’s blog but also learn from Stephen samples.
I have written a code as simpler as possible for you just to show you my approach how to modify BlockReference (and its BlockTableRecord) by using grip overrule.
Attached is BlockRefGrip.txt and Test.dwg with block MYTESTBLOCK. There is only one line and one text in the block. If you run GOO command you should be able to modify position of line and text of the block by grip point at line starting point.
This code works (in my machine), but I do not like the point in MoveGripPointsAt() method where MoveLineAndText() method is called to relocate line and text. If I understood it correctly this method is fired by every mouse move of grip point.
Is my approach of editing BlockReference(and its BlockTableRecord) by grip overrule correct?
For simplicity I did not include in attached sample handling situation if user abort grip point or use UNDO command.
Sorry for the delay. I got engaged with other activities last week.
I tried the sample project that you had shared.
Inside the "MoveGripPointsAt" method, you do have to modify the entity based on the offset vector. In Stephen's sample that I was referring to in my previous reply, the "MoveWorker" method modifies the entity.
The entity in your sample project is a block reference so you should be using the offset vector to do some transformation on the block reference and not the block table record as the sample seems to be doing.
Although modifying the block table record using the grip will work, the changes would also affect other block references that refer to this block table record. You may have some good reason for modifying the block table record this way but please note that the grip are meant for entity level transformations.
Thank you for your advice.
Yes you are right, any changes in block table record will affect other block references, so one part of my code ensures that block table record has only one reference.
My code mimics creating of the custom object the way that it creates anonymous block.
I was just curious if it is possible to use grip overrule to modify this block reference via its block table record (surprisingly it works but there are some downsides), but as you said, grip overrule is meant for entity level.