Line by Bearing Lisp command invalid point

Line by Bearing Lisp command invalid point

Anonymous
Not applicable
1,245 Views
3 Replies
Message 1 of 4

Line by Bearing Lisp command invalid point

Anonymous
Not applicable

I am trying to make a lisp command for C3d 2020.  I load my .lsp and it allows me to type the command, go through the whole process of Line by Bearing, but I get an invalid point error and no line is created.

Here is my .lsp

(defun c:l1 ()
(command "._line" "'bd")
(print)
)

Am I doing something wrong?  

 

Additionally, is there a way to make a command alias for a command followed by a transparent command as I am trying to do with the lisp.

 

Thanks.

0 Likes
1,246 Views
3 Replies
Replies (3)
Message 2 of 4

Ranjit_Singh
Advisor
Advisor

'bd transparent command is designed to return the calculated point back to the line command. However, the lisp evaluator hides the return value and returns nil which is an invalid point. Try sending the command directly to the document

(defun c:l1 ()
(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "._line 'bd "))

I don't think you can add a command and transparent command combination to the acad.pgp file. Maybe this

(defun c:myalias () (c:l1))

However, this is not an alias; just another function calling your l1 function.

0 Likes
Message 3 of 4

Anonymous
Not applicable

The first LISP got rid of the nil message, and now says "Resuming LINE command", but it doesn't create the line. It just sends my starting point to the end of the line I was trying to create.  I can continue the command, and it will create lines from there. Everything I have tried does not create the original line I enter.

0 Likes
Message 4 of 4

Ranjit_Singh
Advisor
Advisor

This is how the command should behave given your sequence of inputs. Try this. In AutoCAD start Line command and then without clicking for a start point, just type 'bd and enter. Now after you supply the quadrant and distance AutoCAD moves the start point to the new calculated location. There's no reason why it should do anything different using LISP.

If you want to pass a starting point and then start the 'bd command then adjust your string into the vla-sendcommand accordingly.

0 Likes