ObjectARX

Reply
Member
FreemanCn
Posts: 4
Registered: ‎02-12-2013
Message 1 of 8 (434 Views)

How to set the dogleg direction of a creating multileader permanently vertical?

434 Views, 7 Replies
02-12-2013 05:36 AM

Dear Pals,

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~

Spoiler

 

 

AcDbMLeader *pEnt=new AcDbMLeader();
AcGePoint3d ptStart(0,0,0);
AcGePoint3d ptEnd1(-30,-10,0);
AcGeVector3d vec(0,-1,0);
int i;

pEnt->setContentType(AcDbMLeaderStyle::kBlockContent);
pEnt->addLeader(i);
pEnt->addLeaderLine(ptStart,i);
pEnt->addLastVertex(i,ptEnd1);
pEnt->setDoglegLength(10);
pEnt->setDoglegDirection(i,vec);

pEnt->setBlockConnectionType(AcDbMLeaderStyle::kConnectBase);

////////////////////////////////////////////////////////////////

 

......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

PostToModelSpace(pEnt);

pEnt->close();

ADN Support Specialist
Balaji_Ram
Posts: 660
Registered: ‎03-21-2011
Message 2 of 8 (404 Views)

Re: How to set the dogleg direction of a creating multileader permanently vertic

02-14-2013 06:56 AM in reply to: FreemanCn

Hello,

 

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.

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Member
FreemanCn
Posts: 4
Registered: ‎02-12-2013
Message 3 of 8 (394 Views)

Re: How to set the dogleg direction of a creating multileader permanently vertic

02-15-2013 07:32 AM in reply to: Balaji_Ram

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::kBlockContent);
pEnt->addLeader(i);
pEnt->addLeaderLine(ptStart,i);
pEnt->addLastVertex(i,ptEnd1);
pEnt->setDoglegLength(10);
pEnt->setDoglegDirection(i,vec);
pEnt->setBlockConnectionType(AcDbMLeaderStyle::kConnectBase);
////////////////////////////////////////////////////////////////
 
......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();

 

ADN Support Specialist
Balaji_Ram
Posts: 660
Registered: ‎03-21-2011
Message 4 of 8 (370 Views)

Re: How to set the dogleg direction of a creating multileader permanently vertic

02-18-2013 08:33 AM in reply to: FreemanCn

Hello,

 

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.

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Member
FreemanCn
Posts: 4
Registered: ‎02-12-2013
Message 5 of 8 (302 Views)

Re: How to set the dogleg direction of a creating multileader permanently vertic

03-01-2013 06:15 AM in reply to: Balaji_Ram

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").

 

Best Regards

ADN Support Specialist
Balaji_Ram
Posts: 660
Registered: ‎03-21-2011
Message 6 of 8 (262 Views)

Re: How to set the dogleg direction of a creating multileader permanently vertic

03-05-2013 06:55 AM in reply to: FreemanCn

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 :smileyhappy:

 

 

 

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

ADN Support Specialist
Balaji_Ram
Posts: 660
Registered: ‎03-21-2011
Message 7 of 8 (252 Views)

Re: How to set the dogleg direction of a creating multileader permanently vertic

03-07-2013 12:51 AM in reply to: FreemanCn

Hello,

 

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.

 



Balaji
Developer Technical Services
Autodesk Developer Network

Member
FreemanCn
Posts: 4
Registered: ‎02-12-2013
Message 8 of 8 (229 Views)

Re: How to set the dogleg direction of a creating multileader permanently vertic

03-09-2013 05:30 AM in reply to: Balaji_Ram

Hi, Mr. Balaji,:smileyhappy:

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~:smileywink:~

 

Best Regards~

Lib

 

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
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

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

Ask the Community