Hi: How could i apply the measure command programaticaly that i can define a block and aligne it on a polyline at equal distances Thnks -- Nermeen Bakr Project Manager Modern Computing Services web site : www.mcsoil.com Tel: : + 202 4036520 Fax : + 202 4040503
You would need to control it using SendCommand(). An alternative is AcadX, which has a Curve class that exposes Measure and Divide methods, and other related methods. http://www.caddzone.com/acadx
but i don't want the user to feel it whick means i want to give the measure command a block i have already defined and use the blocks which the measure command will insert aligned in other functions -- Nermeen Bakr Project Manager Modern Computing Services web site : www.mcsoil.com Tel: : + 202 4036520 Fax : + 202 4040503
Hi, The "sendcommand" process enables you to do this. You simply have to work out the string required to send, by doing the command at the command prompt. If you are experienced in doing this you will probably get it right by the 10th try. -- Regards Laurie Comerford www.cadapps.com.au
First of all thanks for help. but i still don't know how to access the blocks which had been drawn programatically for an example loop on them and draw a grid inside each one. -- Nermeen Bakr Project Manager Modern Computing Services web site : www.mcsoil.com Tel: : + 202 4036520 Fax : + 202 4040503
Unfortunately, the MEASURE has some requirements that make it difficult to script from VBA, using SendCommand(). The reason is because the MEASURE command requires a selection point, which is used to determine which end of the object it measures from. You can pass a point to the command line, but that does not guarantee the desired object will be selected. You would need to pass a fairly complex LISP expression, like this: (list (handent "xxxxx") '(xxxx.xx yyyy.yy zzzz.zz)) This is the only way to pass a selection point and an entity to AutoCAD from VBA. The objects created by MEASURE can be found in the Previous selection set. The Measure and Divide methods in AcadX do not insert blocks, that is something you need to do yourself, and it's not that difficult. You can use the MeasureEx() method, which returns an array of the first and second derivatives for each resulting point, along with the points. You can use the first derivative to compute the required rotation angle of each insertion, and just do the insertion manually using the InsertBlock() method.
This is the way to pass the measure command parameters to the send command Dim str1 As String Dim strclose As String str1 = "(handent """ + tmpObj.Handle + """" + ")" Dim str As String str = "_measure " str = str & str1 & vbCr & "block" & vbCr & "myblock" & vbCr & "Yes" & vbCr & "500" & vbCr app.ActiveDocument.SendCommand(str) -- Nermeen Bakr Project Manager Modern Computing Services web site : www.mcsoil.com Tel: : + 202 4036520 Fax : + 202 4040503