I want to construct an class derive from "AcedJig" to implement some function like Acad's command "move" . I want to move some entitys(not one), and I don't want to use "acedcomand(rtstr,"move",rtpicks,.....)".
Solved! Go to Solution.
Solved by Balaji_Ram. Go to Solution.
Well, I do not write code in C++, but I did a couple of posts on doing one's own "MOVE" command in ObjectARX .NET API, if it could be any help to you:
http://drive-cad-with-code.blogspot.ca/2011/01/creating-move-command-with-net-api.html
http://drive-cad-with-code.blogspot.ca/2011/01/creating-move-command-with-net-api-take.html
Norman Yuan
can any one give me some code of C++?
Have you downloaded ObjectARX SDK (you must have if you are doing C++ with ObjectARX)?
In the folder "...Samples\database\elipsjig_dg" is the sample code of doing jig to draw an ellipse.
Norman Yuan
thanks for your advice. I have been studied the example. but there are a lot of difference between drawing an entity and moving entities, especialy when the entities moved by you contain AcdbBlockReference.
I have written an class derived from AcedJig. it can move entities without AcdbBlockReference well. but not with AcdbBlockReference.
Perhaps if you explained exactly what you were trying to achieve and what the problem is you're experiencing, then someone would be able to give you the answer you're looking for. Without more information, the best I can do is point you to this old (.NET) post on Kean walmsley's blog :
http://through-the-interface.typepad.com/through_the_interface/2007/05/using_a_jig_fro.html in inserting blocks using a jig.
in the example below I uploaded, there are two commands, jig_pl, jig_insert.
the first command is about drawing an AcdbPolyline simulating Acad's pl command, the question is in the DoIt() or the Sample(), I am unable to get mouse event, eg, the mouse's right click means ending the command, and this is quite Convenient for the users, and in my code ,I have to use keyword "E"。
the second command jig_insert, I want to simulate CAD's command "move" ,"rotate","scale" ,and combine them together, the reason why I don't use the command directly in my code, is "Interact with the user".
the problem is if you select line,polyline, it works well. but if the entities you select contains AcdbBlockference (there is a dwg in the source code directory) , you can try the command . if you select only one AcdbBlockrefernce, no problem. if you select an AcdbBlockrefernce and other entities like polyine、circle, it worked strangely.
the code has been compile under VC8.0 , Windows XP, VS2005, AutoCAD2008.
Hello,
For terminating the jigging on right click of the mouse, you can use the "acedRegisterFilterWinMsg" to setup a message handler and then handle the "WM_RBUTTONUP" to cancel the jigging. This will have the same effect as the "E" option that you are currently using. I have attached the .h and .cpp file with the changes, but not much testing and error checking have gone into it. It is only to demonstrate the method.
Regarding your other query, can you please explain what you mean by "strange behavior" when a block reference is involved ? I have attached a video showing what I see after I tried the "jig_insert" command. It seems ok to me.I have used AutoCAD 2011 for trying this out, not sure if that really matters.
thanks a lot, I will study the code you changed. "strange behavior" happened on my compute, CAD 2008(it means the shape and base point of the AcdbBlockrefernce changes randomly, and you have to use "regen" command , and usually,it not works), I would compile my code in VC9 to test it on CAD 2011.
I have tested the code, the Mouse Right Click works well on CAD 2008. and just as you said ,the jig_insert worked well on CAD 2011, I tested the code on CAD2010, it also works well. the problem should be on CAD2008. we will consider upgrate our platfrom from 2008 to 2010.
thanks a lot for your kind and great help.