<?xml encoding=”UTF-8″>By Fenton Webb
Leading on from this post, I thought you guys should at least know how to do the same thing in ObjectARX…
Issue
How can I permit a user to draw a multi-point polyline from ObjectARX? I tried to use the acedCommand to send the ‘_pline’ command to AutoCAD, but it’s impossible to predetermine how many polyline points a user will decide to enter.
Solution
A function can be implemented that first issues the PLINE command and then continually checks if PLINE is still active in the AutoCAD command buffer. If so, command pauses are sent to the command line to allow further user input.
This activity can happen repetitively until the user escapes or presses the Enter key to complete the polyline.
The following code segment does this:
<br>Adesk::Boolean isPlineActive() <br>{ <br> struct resbuf rb; <br> acedGetVar(_T("CMDNAMES"),&rb);<br> if(rb.restype == RTSTR && rb.resval.rstring != NULL) <br> { <br> //"PLINE" contained in CMDNAMES?<br> if(_tcsstr(rb.resval.rstring,_T("PLINE"))) <br> return Adesk::kTrue; <br> } <br> return Adesk::kFalse; <br>}
<p>void mkline() <br>{<br> acedCommand(RTSTR,_T("_.pline"),RTSTR,PAUSE,RTNONE); <br> while(isPlineActive())<br> acedCommand(RTSTR,PAUSE,RTNONE); <br> acutPrintf (_T("nContinue processing")); <br>}</p>

Leave a Reply