@Anonymous wrote:
I hope this is helps...
Whereas BeekeeCZ's Command:-line trace, with the reporting that they built into the code, reads things like:
Select Line at which to add Shear Posts: (0.0 20.0 0.0)(10.0 20.0 0.0)
Pick to side of Line on which to add shear posts: (2.0 15.0 0.0)(2.0 20.0 0.0)4.71239270.0_.insert ....
yours reads things like:
Select Line at which to add Shear Posts: (-8.10417e-010 -6.1302 0.0)nil
Pick to side of Line on which to add shear posts: (2.0 15.0 0.0); error: bad argument value: AcDbCurve 47
The former is reporting both ends of the selected Line [p1 and p2], but the latter only one and a nil. Then the former reports the side-selection point, the closest point on the Line, and the angle between those [rot], in its original radians and then converted to degrees., whereas yours reports only the side-selection point before the error message.
That nil suggests to me that your "line" isn't a Line entity, but perhaps a Polyline which has no code-11 entry in its entity data [hence the nil return]. It could be made to allow a Polyline, but it should presumably be limited to allow only a one-straight-segment Polyline [that can be done], and it would need to find the other end in a different way.
But why it fails on finding the closest point is harder to imagine. The error message suggests that the selected object is not among those classified as "curves" [even if they're not curved] for purposes of (vlax-curve-...) functions, though I don't know what the 47 means. It should be able to work with a Polyline, even if the p2 variable is nil, in which case I would expect it to run into trouble with the Insertions later, but not this early in the process.
I guess the first question is, what is the actual entity type of the "line" you're selecting? It appears to be something that's not a "curve"-class object, and with a code-10 entry in its entity data but not a code-11 entry [which rules out, for example, Text or an Mline that would be examples of non-"curve"-class objects -- they have both 10 & 11 entries].
Kent Cooper, AIA