Creating a Pause in my Lisp

Creating a Pause in my Lisp

cdavis
Advocate Advocate
5,799 Views
10 Replies
Message 1 of 11

Creating a Pause in my Lisp

cdavis
Advocate
Advocate

OK, so I am trying to create a 3 key command to fire the Line by Bearing and Distance. It is a pull down, but I am a keyborad masher and it helps me be more produtctive. I tried the following for the routine, the problem is that when I run it, it seems to fire off just fine, but the first set of coordinates and distance I enter does nothing and it prompts me for a start point again and then works like it should. I am guessing that I need a pause for the line command to let me pick my point first, but have been unsuccessful at putting one in.

 

 

(defun c:tra ()
 (command "line" "'BD")
 (princ)
)

 

Thanks,

Chris M Davis

 

0 Likes
5,800 Views
10 Replies
Replies (10)
Message 2 of 11

Satoews
Advocate
Advocate

INSERT

 

PAUSE

WHERE YOU WANT YOUR PAUSE.

Shawn T
0 Likes
Message 3 of 11

cdavis
Advocate
Advocate

I have, but it does not work. I have tried the following variations with no luck

 

(defun c:tra ()
 (command "line" "pause" "'BD")
 (princ)
)

 

(defun c:tra ()
 (command "line" pause "'BD")
 (princ)
)

(defun c:tra ()
 (command "line" \\ "'BD")
 (princ)
)

(defun c:tra ()
 (command "line" pause)

 (command "'BD")
 (princ)
)

(defun c:tra ()
 (command "line" \\)

 (command "'BD")
 (princ)
)

0 Likes
Message 4 of 11

Ranjit_Singh
Advisor
Advisor

Seeme like this works for me

(defun c:tra ()
 (command "._line" "'bd")
 (princ)
)
Message 5 of 11

marko_ribar
Advisor
Advisor

When you specify \\ syntax, specify it with "\\" - this is eqvivalent to pause...

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 6 of 11

cdavis
Advocate
Advocate

Still not working from the beginning. I get and Invalid Point and then it has me specify a starting point and then works like it is supposed to.

 

This is what happens:

Command: TRA ._line
Specify first point:
>>Select starting point or [.P/.N/.G]:
>>Select starting point or [.P/.N/.G]: Quadrants - NE = 1, SE = 2, SW = 3, NW = 4
>>Specify quadrant (1-4): 4
Current direction unit: degree, Input: DD° MM' SS.SS" (spaced)
>>Specify bearing: 12.3255
>>
>>Specify distance: 1200
Resuming TRA command.
Specify first point:
Invalid point.
Specify first point:
Specify first point:
Specify next point or [Undo]:
Quadrants - NE = 1, SE = 2, SW = 3, NW = 4
>>Specify quadrant (1-4): 4
Current direction unit: degree, Input: DD° MM' SS.SS" (spaced)
>>Specify bearing: 12.3255
>>
>>Specify distance: 1200
Resuming LINE command.
Specify next point or [Undo]:
(2305.7 2520.48 0.0)
Specify next point or [Undo]:
Quadrants - NE = 1, SE = 2, SW = 3, NW = 4
>>Specify quadrant (1-4):
>>
Resuming LINE command.
Specify next point or [Undo]

0 Likes
Message 7 of 11

Satoews
Advocate
Advocate

I see what you are getting at, but for the life of me I can't get it to work in lisp like it dose in a macro. Maybe this will work for you though:

 

How to shortcut a macro

 

^C^C_LINE;\'BD 

in the command string, see if that fits your needs.

 

Shawn T
Message 8 of 11

hmsilva
Mentor
Mentor

@Anonymous wrote:

OK, so I am trying to create a 3 key command to fire the Line by Bearing and Distance. It is a pull down, but I am a keyborad masher and it helps me be more produtctive. I tried the following for the routine, the problem is that when I run it, it seems to fire off just fine, but the first set of coordinates and distance I enter does nothing and it prompts me for a start point again and then works like it should. I am guessing that I need a pause for the line command to let me pick my point first, but have been unsuccessful at putting one in.

 

 

(defun c:tra ()
 (command "line" "'BD")
 (princ)
)

 

Thanks,

Chris M Davis

 


Hi Chris,

I'm not a Civil/Map 3d guy, and I can´t test it, but to start a Line by Bearing and Distance you'll have to enter the start point, correct?

Untested

(defun c:tra nil
    (command "_.line" "\\" "'BD")
    (while (> (getvar 'cmdactive) 0)
        (command "\\")
    )
    (princ)
)

 

EDIT: @ВeekeeCZ did test the code in C3D and it error... 😞


Henrique

EESignature

Message 9 of 11

Kent1Cooper
Consultant
Consultant

I don't have Civil/Map software either, but if BD is a function defined in those overlays that operates within other commands, and not something you would enter at the Command prompt, try something like this [the standard way of calling for a (defun)'d non-Command function within another]:

 

(defun c:tra ()

  (command "_.line" pause); leaves you in Line command after first point

  (BD)

)

 

But to help me understand it better:  Since you are showing BD with an apostrophe prefix, it looks like maybe it is something that can be entered at the Command: prompt.  What happens when you do that, when not within something like a Line command?  It looks from Post 6 as though BD asks for a first point within itself, but is that just as starting reference for the Bearing/Distance, or is that first point actually fed out from there into something like a Line command when you're in one?  If the latter, do you perhaps not need the pause for the User to give a point prior to calling up BD?

 

I don't suppose you have access to the code that defines BD, if it's embedded in Civil/Map software, but if you do, it may be apparent how to get it to do what you want.

Kent Cooper, AIA
Message 10 of 11

ВeekeeCZ
Consultant
Consultant

Hi, I'm very new with C3D so I needed to dig around this issue little more.

 

Only working solution I have found:

 

Spoiler
(defun C:tra () (command "_.LINE" pause (c:bd) "") (princ)) 	; single line


;Or for multiple lines:

(defun C:tram ()						; multiple lines - single ENTER terminates BD command, but LINE command is still running. Second ENTER terminates LINE command.
  (command "_.LINE" pause)
  (while (> (getvar 'cmdactive) 0)
    (command (c:bd)))
  (princ)
)


(defun C:tram2 ( / a)						; multiple lines - single ENTER terminates the whole TRAM lisp command.
  (command "_.LINE" pause)
  (while (> (getvar 'cmdactive) 0)
    (command (if (= (type (setq a (c:bd))) 'STR)		; if not, it's 'SYM
	       a
	       "")))
  (princ)
)

Very useful is this old thread.

 

It works like... it takes 'LASTPOINT sysvar and returns relative distance

!(c:bd) 

"@2.0000,2.0000"

 

 

 

fyi

lisp form (command "line" pause "'bd") under "C3D as AutoCAD" profile returns "Unknown command" for 'bd. But using 'BD in autocad command line is possible.

lisp form (command "line" pause "'bd") under "CIVIL" profile prompts correct point as list (2 2 0) in the command line, but it's not possible to use this as proper line point (as far as I tried).

Message 11 of 11

cdavis
Advocate
Advocate

The Command itself is a transparent one. if I were to type it in at the command line, it would be:

LINE

pick my start point

'BD (this is the transparent commend for bearing and distance)

at this point I run trhough as many BD lines as I want and then hit enter twince.

 

I will probably just stick with the button command on this one. Does not seem to want to play well in the lisp environment as easily as other compound cammands.

 

Thanks,

Chris

0 Likes