.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add new grip point with GripOverrule

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
RichardCammeray
3112 Views, 6 Replies

Add new grip point with GripOverrule

Hi,

Before I will explore Grip Overrule world I have one question.

Is it possible to add new grip points into Entity?

 

 

Thank you,

Richard.

6 REPLIES 6
Message 2 of 7
jeff
in reply to: RichardCammeray

Yes

You can also find your answers @ TheSwamp
Message 3 of 7
RichardCammeray
in reply to: jeff

Finally I have finished my grip overrule with success but I have one question (there are not many examples for grip overrule on the net).
Below is described what I did
 
1)Use grip overrule for BlockReference with subentities Lines and DBText (form a pair)
2)Use GetGripPoints to draw grips at each Line starting point.
3)Inside MoveGripPointAt is called my method which is moving pair of Line and Text in BlockTableRecord of overruled BlockReference
 
My worry is that with grip point selected with each mouse move BlockTableRecord is modified. Surprisingly its is working but I'm not very happy with that.
Should I use Subentity overrule if so I could not find any examples.
 
Thanks,
Richard
Message 4 of 7

Hi Richard,

 

Here is a sample on GripOverrule by Stephen Preston :

http://adndevblog.typepad.com/autocad/2012/05/draw-overrule-and-grip-overrule-sample.html

 

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 ?

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 7

Hi Balaji,

 

I have used for my project a sample found in Kean’s  blog but also learn from Stephen samples.

http://through-the-interface.typepad.com/through_the_interface/2012/09/overriding-the-grips-of-an-au....

 

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.

 

Thank you,

Richard

Message 6 of 7

Hi Richard,

 

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.



Balaji
Developer Technical Services
Autodesk Developer Network

Message 7 of 7

Hi Balaji,

 

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.

 

Thank you,

Richard

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost