I'm faced with a problem when creating a multileader with a vertical dogleg using the code below. when creating, the dogleg is vertical. But when you move dogleg to the leftside, its direction turns to horizontal unexpectly(I want it keeping vertical). Is there any points wrong with my codes? Please give a hand~ Much appreciate~
AcDbMLeader *pEnt=new AcDbMLeader();
......Got the inserted content block and arrow block for the Mleader
pEnt->setArrowSymbolId(arrowDefId); // 'arrowDefId' inputs the ID of arrow block to be inserted
pEnt->setBlockContentId(blkDefId); // 'blkDefId' inputs the ID of content block to be inserted
Sorry, I could not find the code snippet that you mentioned about.
As you have mentioned that the dog leg direction is initially right and then it changes when it is manually moved, I dont thing this behavior has anything to do with your code.
After the leader was created, the dog leg direction can still be changed manually just as any other entity.
Are you using handling any events to stop such a change ?
Can you please share the complete sample code for me to reproduce the behavior.
Thank you very much for your kind help, Mr. Balaji_Ram~
so you mean that I define a reactor to stop the change of the direction?
Sorr y, my mistake~ I didn't give the code correctly~ you can find it here~
AcDbMLeader *pEnt=new AcDbMLeader(); AcGePoint3d ptStart(0,0,0); AcGePoint3d ptEnd1(-30,-10,0); AcGeVector3d vec(0,-1,0); int i; pEnt->setContentType(AcDbMLeaderStyle::kBlockConte
nt); pEnt->addLeader(i); pEnt->addLeaderLine(ptStart,i); pEnt->addLastVertex(i,ptEnd1); pEnt->setDoglegLength(10); pEnt->setDoglegDirection(i,vec); pEnt->setBlockConnectionType(AcDbMLeaderStyle::kCo nnectBase); ////////////////////////////////////////////////// ////////////// ......Get the inserted content block and arrow block for the Mleader ////////////////////////////////////////////////// /////////////// pEnt->setArrowSymbolId(arrowDefId); // 'arrowDefId' inputs the ID of arrow block to be inserted pEnt->setBlockContentId(blkDefId); // 'blkDefId' inputs the ID of content block to be inserted PostToModelSpace(pEnt); pEnt->close();
I created a sample project based on the code snippet that you shared.
The direction of the dog leg always remained vertical. Can you please try the sample project to see if there is anything different from what you are trying ?
I have attached the sample project and a test drawing that contains the arrow and the content blocks for the MLeader.
The sample project also demonstrates the use of a persistent reactor. This will print a message if the direction of the dogleg changes from its vertical position which you can then use to set the direction right.
To try the sample :
1) Start AutoCAD 2013
2) Open the attached drawing.
3) Appload the arx
4) Run the "Test" command and select the MLeader points
If you are using a previous version of AutoCAD, then you can create a simple drawing that has two blocks named "Arrow" and "Content" for use with this code.
Sorry for my late reply, Mr. Balaji_Ram. And thank you for your patient answer~ I have tried several times these days according to your guid, but failed. I use AutoCAD 2011.Is the version making trouble?. I got the arx successfully. And it create the mleader. But when you move the dogleg. Its direction would change to horiziontal again and the message "MLeader modified !" was printed. Please help to check if there is anything wrong with my code~ Thank you very much~( The command is "leadertest").
Sorry for the delay. I missed out on the update notification that I received.
I have been trying this with AutoCAD 2013. As the dogleg direction was vertical without any need for the reactor, I did not implement the code to set the direction right from the modified callback.
This is the reason, you will only find it printing a message "MLeader modified" without doing anything.
The sample code was to demonstrate a way to monitor the MLeader for any changes so you can change the direction if needed.
I will try it with AutoCAD 2011 and update you based on what I find.
I hope it is ok if I update you about this by tomorrow as I have messed up my AutoCAD 2011 by trying my hand with some registry settings
I tried the "LeaderTest" command in AutoCAD 2011 and it worked ok. The dogleg remained vertical while I tried to move the leader.
Have you ensured that all the service packs have been installed ? The "_vernum" command displays
"E.208.0.0 (UNICODE)" on my system.
The drawing that you shared has an educational stamp in it. I am not sure if this behavior is specific toa drawing created in an education version of AutoCAD.
Hi, Mr. Balaji,
I test it on my workstation with a genuine version AutoCAD 2011 installed today. But the problem is there still. I think you are right that there must be some problems with the configuration of my VS IDE. I will check it. Or maybe I'll have to use the reactor as a solution.
Heartfelt thanks to you for all your patient help~ Actually, I'm just a freshman about the ObjectArx. And I will do my best~~
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.