Macro (during a command) stops after user input?

Macro (during a command) stops after user input?

yuceldemir1
Participant Participant
1,216 Views
9 Replies
Message 1 of 10

Macro (during a command) stops after user input?

yuceldemir1
Participant
Participant

Hello everybody,

I created the following macro as a toolbar button and initialize it during any command, 'stretch' in my case.

_from;_per;\ ^O _non

My goal is to relocate a door at a certain distance from a grid line.

Everything goes fine but after i select the _from base point as user input, the rest of the macro doesn't run. I couldn't figure it out why.  Any idea to solve the problem?

 

Update: I figured out that the rest of the macro after the user input character executes after the command ends. But i want it to execute after i click the temporary _from base point.

 

Thank you,

 

 

 

 

0 Likes
Accepted solutions (1)
1,217 Views
9 Replies
Replies (9)
Message 2 of 10

ВeekeeCZ
Consultant
Consultant

Would you visually ilustrate the workflow and the issue by recording a video capture? Thanks.

You could use Autodesk's  SCREENCAST , it's free.

0 Likes
Message 3 of 10

pendean
Community Legend
Community Legend
Did you really intend what you typed in the macro?

Your macro does:

start FROM
set PERP <<<<<<<<<<<<<<<<odd choice for an object selection?
pause for a user selection <<<<<<presumably when you click on the object?
turn off ortho
turn off running osnaps

then presumably it continues on.


0 Likes
Message 4 of 10

yuceldemir1
Participant
Participant

I initialize the macro after entering a command (move, stretch etc.) as you see in the screencast via a toolbar button. By the way please ignore my user interface and button icons 🙂 they are totally different from default.

 

_from;_per;\ ^O _non

I want my macro to be conitinued after i click the green horizontal line (toggle ortho and disable snaps). But in my case it executes after i relocate the door. I hope I expressed my problem this time. Thanks!

 

 

0 Likes
Message 5 of 10

ВeekeeCZ
Consultant
Consultant

I see your point but don't know how to fix your macro.

I can imagine that I would solve it using LISP. Are you on LT?

0 Likes
Message 6 of 10

yuceldemir1
Participant
Participant

No, i use version 2015. Any LISP solution will also be appreciated. 

0 Likes
Message 7 of 10

ВeekeeCZ
Consultant
Consultant

The first one just mimics your macro. You need to set a tool's macro to 'FromPer. Note the apostrophe.

What would bother me is that it won't allow you a quick repetition by RT click. That is what the second routine is good for.

 

(defun c:FromPer (/ *error* osm ort)

  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if osm (setvar 'osmode osm))
    (if ort (setvar 'orthomode ort))
    (princ))

  ; ------------
  (setq osm (getvar 'osmode)
	ort (getvar 'orthomode))
  
  (setvar 'orthomode 1)
  (setvar 'osmode 0)
  (command "_from" "_per" pause)
  (*error* "end")
  )



(defun c:StretchFromPer (/ *error* osm ort)

  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if osm (setvar 'osmode osm))
    (if ort (setvar 'orthomode ort))
    (princ))

  ; ------------
  (setq osm (getvar 'osmode)
	ort (getvar 'orthomode))
  (command-s "_.select")
  (command "_.stretch" "_p" "" pause)
  (setvar 'orthomode 1)
  (setvar 'osmode 0)
  (command "_from" "_per" pause)
  (*error* "end")
  )
0 Likes
Message 8 of 10

yuceldemir1
Participant
Participant

Ok, your first suggestion works well except one thing. I dont want to turn on ortho mode before clicking the guide line which i showed in the screencast. Your routine sets the system variable  1 before clicking the guide line. Other than that, it works like a charm. I don't care repetition by RT click.
I didn't now an apostrophes meaning in a macro. I assume it interprets a lisp into a macro, right? Anyway, my last question is what i mentioned at the beginning. Can we turn ortho on after clicking the guide line? Since we still couldn't edit the gap between the from point selection and the end of the command. I suppose it's not possible.

 

I really appreciate your effort, i will accept your solution after your reply. 

Thank you,

 

0 Likes
Message 9 of 10

ВeekeeCZ
Consultant
Consultant
Accepted solution

Perhaps like this.

 

(defun c:FromPer (/ *error* osm ort pnt)

  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if osm (setvar 'osmode osm))
    (if ort (setvar 'orthomode ort))
    (princ))

  ; ------------
  (setq osm (getvar 'osmode)
	ort (getvar 'orthomode))
  
  (setvar 'osmode 128)
  (setq pnt (getpoint "\nSpecify base point: " (getvar 'lastpoint)))
  (setvar 'orthomode 1)
  (command "_from" "_non" pnt pause)
  (*error* "end")
  )
0 Likes
Message 10 of 10

yuceldemir1
Participant
Participant

Perfect! Thank you for dealing with my very personal problem.

0 Likes