@Anonymous wrote:
....Error given:
Path for measurement:
Location of first measurement point on it:
Spacing of locations along measurement path: 15000
Path for object placement: Unknown command "M1O2". Press F1 for help.
Unknown command "M1O2". Press F1 for help.
; error: bad argument type: 2D/3D point: nil
....
If you have command echoing off [CMDECHO System Variable], turn it on and run it again -- I'd be interested in what point in the process it reaches before getting that error. Is it after it has put in some Blocks, or before it gets any of them in? Is it at an end of the object path, as opposed to somewhere in the middle? It's hard to evaluate from your drawing, without knowing whether it's the Ex2 or the MI2 Block you're placing, therefore which of the paths [grey or red] is the measurement path and which the object path, or which portion of them it failed on.
An unknown-command error with the command name you're in usually means an Enter [""] is coming at the command prompt, after some internal command, for which the Enter is supposed to be a valid input, has ended prematurely. The Enter recalls [or tries to] the latest command entered at the command prompt, which is the one you're in, but that is not recognized within a (command) function, because that allows only native AutoCAD commands.
My guess: If it's at an end [whether the beginning or the tail end], and the perpendicular projection from the measurement path doesn't quite hit the object path, then it won't find an insertion point, and if that kills the Insert command, it would mean both of those Enters intended for the scale factors would be causing the two unknown-command errors you got. And the 2D/3D point: nil error would be consistent with its trying to do the next thing in the code [calculate the rotation angle] with no point having been found [even though it's sitting at the command prompt, not within an Insert command -- it will still run the calculation].
What happens if you LENGTHEN the end of the object path a little, at whichever end the problem occurs at? If you do it by the Delta option with some nice round number, and that gets it to work, you could then un-Lengthen it back again with a negative Delta of the same round number, to restore it to its original length.
Or, if you join the multiple portions of object path into one Polyline, even if you keep the measurement path in several pieces, you won't run into such a not-quite-there end condition at the intermediate current ends of the pieces [because they won't be ends any more], but only possibly at the very ends.
Here's a question: If the perpendicular projection from the measurement path misses the end of the object path, should a Block be placed at the end? Or is there some requirement of what's being done that says only a true perpendicularly-projected location should get a Block placed at it? The routine could check whether a point is found before trying to Insert, which would avoid the error but might miss Inserting a Block that you want Inserted. If the two always nearly line up, and it's just a matter of slight divergence of angle that makes the projection miss, it could be made to put one at the end of the object path even when that's a hair short of meeting the perpendicular projection, if that doesn't violate something.
Kent Cooper, AIA