Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

DRAGMODE on/off toggle with Macro (or LISP?)

Haider_of_Sweden
Collaborator

DRAGMODE on/off toggle with Macro (or LISP?)

Haider_of_Sweden
Collaborator
Collaborator

Hello,

 

could someone please help me to create DRAGMODE ON / OFF toggle with Macro, or maybe LISP

 

Thank you in advance!

0 Likes
Reply
Accepted solutions (1)
2,084 Views
16 Replies
Replies (16)

john.vellek
Alumni
Alumni

Hi @Haider_of_Sweden

 

Why not create three buttons in your CUI?  I added one to one of the menus.

 

This is the syntax:

 

Capture.PNG

 

 

Please select the Accept as Solution button if my post solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes

imadHabash
Mentor
Mentor

Hi,

 

if i understand your need right ... i suggest to try this :

  • from MANAGE ribbon tab select RECORD or type in the command line ACTRECORD . 
  • a red ball will appear beside your cursor to notify you that you're under record action.
  • now type in the command line DRAGMODE and select ON.
  • from MANAGE ribbon tab select STOP or type in the command line ACTSTOP . 
  • a dialog will appear -----> in Action Macro Command Name enter any unique name that meet your need.

repeat the previous steps to record DRAGMODE = OFF. NOW you have a customize commands name will be active and always whenever you need it.

 

Hope that it's help haider ..

Imad Habash

EESignature

0 Likes

tramber
Advisor
Advisor
'dragmode $M=$(if,$(and,$(getvar,dragmode),2),0,$(+,$(getvar,dragmode),1)) 

This one togles between the 3 values DRAGMODE can have. and transparently

tramber
Advisor
Advisor
'dragmode $M=$(if,$(or,$(and,$(getvar,dragmode),1),$(and,$(getvar,dragmode),2)),0,1)

Even simplier !

0 Likes

Haider_of_Sweden
Collaborator
Collaborator

@tramber wrote:
'dragmode $M=$(if,$(or,$(and,$(getvar,dragmode),1),$(and,$(getvar,dragmode),2)),0,1)

Even simplier !


 

Yes, this looks like what I am searching for.

 

However, if I put it in an .SCR file and drag it into AutoCAD, it wont work. Do you really start with 'dragmode?

0 Likes

tramber
Advisor
Advisor

' before DRAGMODE allows you to click as you excecute any command. But the fact is that it wont show the effect during a draging.. action.

 

Nevertheless, Il should learn you that scripts are pretty different and don't allow any toggling, dont' they ?

' doesn't exists either in a script, as far as I know.

 

My solution stands for a buttton. Scirpting DRAGMODE is strange to me but you are welcome to do it with no DIESEL, no '

!

0 Likes

tramber
Advisor
Advisor

Well, sory to publish again but the question of the transparency in script may be asked. I should remember but it's time for me to go and we 'll talk about later on.

Hope I helped.

B

France

Haider_of_Sweden
Collaborator
Collaborator

@tramber wrote:

' before DRAGMODE allows you to click as you excecute any command. But the fact is that it wont show the effect during a draging.. action.

 

Nevertheless, Il should learn you that scripts are pretty different and don't allow any toggling, dont' they ?

' doesn't exists either in a script, as far as I know.

 

My solution stands for a buttton. Scirpting DRAGMODE is strange to me but you are welcome to do it with no DIESEL, no '

!


Unfortunately, this worked neither a shortcut nor button.

Maybe it is not working because of the transparent command? Although, I think transparent DRAGMODE might be rather cool instead of using ^C^C

0 Likes

tramber
Advisor
Advisor

It's about midnight where I live, I have to go Smiley Happy

Yes it works good at my place.

Don't know what is going on...

 

^c^c is not an obligation.

' is cool

Again, I don't know what could be wrong for you with this humble macro

0 Likes

Haider_of_Sweden
Collaborator
Collaborator
Accepted solution

Your code resulted in "Invalid option keyword."

GETVAR gives us 0,1 and 2, but the input should be AUTO or OFF. 

 

This is how I solved it;

^C^Cdragmode $M=$(if,$(and,$(getvar,dragmode),2),OFF,AUTO)

A note regarding transparent command in this context. The DRAGMODE effect won't be actualized until next time anyway, so using a transparent command is unfortunately of no use here. I was hoping it actually toggled DRAGMODE on the fly, not toggling it for next time's use.

 

Thank you for laying the ground for me.

0 Likes

tramber
Advisor
Advisor

Well, at least it is a solution.

let's dig it before i fall asleep !

What version are u running ? I'm on 2015 (edited).

And i like to try my 'macro. Look, it's funny to draw a polyline and to click on your button.

 

God. How is it that it doesn't work as I thought it would on any version ?

0 Likes

Haider_of_Sweden
Collaborator
Collaborator
I am on 2016.

For me it's not interesting using it while drawing polylines, but rather when moving heavy objects. Therefore I don't need the command on the fly but just a quick hotkey under my fingertips instead of typing the command manually.

Toggles are my favorites 🙂
0 Likes

tramber
Advisor
Advisor

Why don't you put the macro in an accelerator then, rather than in a button ?

Anyway, it is still a mystery to me that you seem not to be able to get the same result

Ni______(on)ce We       (off)ek-end !

0 Likes

Haider_of_Sweden
Collaborator
Collaborator

What is an accelerator?

By the way, I put it in a button, just for test purpose. Now I run it as a shortcut.

0 Likes

tramber
Advisor
Advisor

My solution is intended for a button. Not for a script. This is why the ' should work.

Did we misunderstood ?

 

An accelerator is found in the CUI interface and corresponds to a CTRL+C, for exemple.

You may know CTRL+L or CTRL+B, that's an accelerator too (I'm not under English version but I think that it is the word)

Have a look in CUI, it is easy to find.

You can create one, with a '

 

Smiley Wink

0 Likes

tramber
Advisor
Advisor

Apologize,

It's named Shortcut, probably what you've done.

Accelerator is the technical word.

0 Likes