Author Topic: Calling revcloud in macro  (Read 755 times)

0 Members and 1 Guest are viewing this topic.

57gmc

  • Bull Frog
  • Posts: 365
Calling revcloud in macro
« on: February 23, 2023, 06:29:11 PM »
This is my macro to call a rectangular macro, which is what the palette button on the Home tab has.
Code - Lisp: [Select]
  1. (command "_revcloud" "_R")
This is the error I get.
Quote
Command: (command "_revcloud" "_R")
Minimum arc length: 5.3552"   Maximum arc length: 10.7103"   Style: Normal   Type: Freehand
Point or option keyword required.
; error: Function cancelled
Specify start point or [Arc length/Object/Style] <Object>:
What am I missing?
If I type REVCLOUD, and then R at the command line it works. I've tried several variations but it doesn't work.

Ketxu

  • Newt
  • Posts: 109
Re: Calling revcloud in macro
« Reply #1 on: February 24, 2023, 12:52:20 AM »
Try this :
Code: [Select]
(defun c:rr ()
  (initcommandversion 2) 
  (vl-cmdf "._revcloud" "_R")
)

57gmc

  • Bull Frog
  • Posts: 365
Re: Calling revcloud in macro
« Reply #2 on: February 24, 2023, 10:46:17 AM »
That almost works. I don't get the same error. I do get the prompt correctly, but I can't pick LL and UR.
If I type REVCLOUD, the prompt looks like this:
Quote
Command: REVCLOUD
Minimum arc length: 1"   Maximum arc length: 2"   Style: Normal   Type: Rectangular
Specify first corner point or [Arc length/Object/Rectangular/Polygonal/Freehand/Style/Modify] <Object>: R
Specify first corner point or [Arc length/Object/Rectangular/Polygonal/Freehand/Style/Modify] <Object>:
Specify opposite corner:

But using your code, the prompt looks like this, and when I click on the screen to select points, it does nothing. Notice the extra "T" entry? It looks like it's evaluating the defun and returning T. I threw in a (princ). It still had a third line, but no T. However, I still can't pick points.!?#
Quote
Command: RR
._revcloud
Minimum arc length: 5 13/16"   Maximum arc length: 11 41/64"   Style: Normal   Type: Rectangular
Specify first corner point or [Arc length/Object/Rectangular/Polygonal/Freehand/Style/Modify] <Object>: _R
Specify first corner point or [Arc length/Object/Rectangular/Polygonal/Freehand/Style/Modify] <Object>: T
Specify first corner point or [Arc length/Object/Rectangular/Polygonal/Freehand/Style/Modify] <Object>:
Specify opposite corner:
Invalid shape to create revision cloud.
« Last Edit: February 24, 2023, 10:53:08 AM by 57gmc »

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Calling revcloud in macro
« Reply #3 on: February 26, 2023, 09:31:08 AM »
You'll need to pause for user input, e.g.:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:rr ()
  2.     (initcommandversion 2)
  3.     (vl-cmdf "._revcloud" "_R")
  4.     (while (= 1 (logand 1 (getvar 'cmdactive))) (vl-cmdf "\\"))
  5.     (princ)
  6. )

57gmc

  • Bull Frog
  • Posts: 365
Re: Calling revcloud in macro
« Reply #4 on: February 27, 2023, 12:15:26 PM »
Thanks Lee. That worked. I haven't had time to figure out why yet. But the previous code worked on my amep version at home. So I'm not sure where the difference is. And apparently it worked for other users in the past. So what has changed???  What's even more confusing is that the command macro (see below) just issues the command name and argument the same as (command-s) does, but it doesn't work for lisp.
« Last Edit: February 27, 2023, 12:21:36 PM by 57gmc »

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Calling revcloud in macro
« Reply #5 on: February 27, 2023, 02:02:48 PM »
In your code, the vl-cmdf function is returning T when evaluated, which is then being passed to the active command when the your custom command completes its evaluation; whereas in my code, the function is issuing a pause to the active command until the command has completed, at which point it doesn't matter what is returned to the command line, as no command is active.

57gmc

  • Bull Frog
  • Posts: 365
Re: Calling revcloud in macro
« Reply #6 on: February 27, 2023, 02:17:47 PM »
Thanks for the explanation. I was mostly wondering why execution of the same code works differently for some user and/or pc's. For example, I pasted just "(vl-cmdf "revcloud" "r") to the command line on both my work pc and home pc. It failed at work, but not on my home laptop. Other users in revious postosts also submitted similar code that worked for them, but not for me.  :thinking:
Of course, your code should work, no matter what. I was just trying to figure out if there was an explanation for this inconsistency.