script

script

keshishian
Contributor Contributor
1,551 Views
12 Replies
Message 1 of 13

script

keshishian
Contributor
Contributor

Hello,

 

My script below to change the color of an entity to red is not working. Any suggestion on where my error is will be appreciated.

 

thank you.

 

^C^C^Cchange;\;p;;c;1;

0 Likes
Accepted solutions (1)
1,552 Views
12 Replies
Replies (12)
Message 2 of 13

pendean
Community Legend
Community Legend
Too many <enter> between P and C if I simply try to test it at the commandline here in LT2016.
0 Likes
Message 3 of 13

Emmsleys
Alumni
Alumni

Hi @keshishian

 

Were able to try the suggested steps? 

Please post back in the thread if you are still having an issue with your script.



Sarah Emmsley
Technical Support Specialist

0 Likes
Message 4 of 13

keshishian
Contributor
Contributor

Thank You for the suggestion. I tried that and many other combinations and still can't make it work.

0 Likes
Message 5 of 13

pendean
Community Legend
Community Legend
What other combinations?

Try an upgrade while you wait: use CHPROP command instead of the old CHANGE command if all you want to do is change properties settings.
0 Likes
Message 6 of 13

keshishian
Contributor
Contributor

The suggestion did not work. Thank You.

 

^C^C^CCHPROP;\;C;1;;

0 Likes
Message 7 of 13

steven-g
Mentor
Mentor

Run MACRO1 - 

^C^C^Cchange;\;p;;c;1;


then press F2 you should see this in the command history

Macro1.JPG

Run MACRO2 - 

^C^C^Cchange;\;p;c;1;;


and then press F2 and you should have this result in the command history (and the picked object should be red).

Macro2.JPG

If you get different results then make a copy of what you see in the command history and post it here, then someone might be able to figure out what is going wrong

0 Likes
Message 8 of 13

Victoria.Studley
Autodesk
Autodesk

Hi @keshishian,

 

I just sent you an email via your 1:1 support case, but want to follow up here as well, since I see you've asked the same question here in the community. I tested this and it worked here on my system. Could you please try the following command macro syntax?

 

^C^C_CHPROP \;C;RED;;

 

To explain what this is doing:

^C^C is a special control character sequence that is similar to pressing the Esc key twice.

_CHPROP invokes the command to change properties. The space after this is equivalent to hitting the Spacebar to invoke the command.

\ pauses for user input, so that you can select the object you want to change.

; is equivalent to hitting ENTER.

C chooses the Color option in the CHPROP command after you've selected your object.

; is equivalent to hitting ENTER after you type the command.

RED inputs the color you want to change the object to.

;; is equivalent to hitting ENTER to accept the color and ENTER again to end the command.


Victoria Studley
Principal Experience Designer - Fusion Configurations
Join us in the Fusion Insider Program
Fusion Learn & Support | Fusion Documentation
Message 9 of 13

keshishian
Contributor
Contributor

Hello,

It only works when a single entity is picked. It does not work when multiple entities are chosen thru fence or other means. This might be an LT limitation.

 

The LISP below (or the screenshot attached)  is what I used to use with non LT AutoCAD and am bascially trying to make it work with LT.

 

Thank You.

 

 

(Setvar "cmdecho" 0) (setvar "menuecho" 1)
(Defun C:chred (/ A)
     (print)
     (Prompt "--- change selected objects to color RED ---") (terpri)
     (Setq A (ssget))
     (command "change" A "" "P" "C" "1" "")
     (prin1))
;
(Defun C:chyel (/ A)
     (print)
(Prompt "--- change selected objects to color YELLOW ---") (terpri)
     (Setq A (ssget))
     (command "change" A "" "P" "C" "2" "")
     (prin1))
;
(Defun C:chgrn (/ A)
     (print)
     (Prompt "--- change selected objects to color GREEN ---") (terpri)
     (Setq A (ssget))
     (command "change" A "" "P" "C" "3" "")
     (prin1))
;
(Defun C:chcyn (/ A)
     (print)
     (Prompt "--- change selected objects to color CYAN ---") (terpri)
     (Setq A (ssget))
     (command "change" A "" "P" "C" "4" "")
     (prin1))
;
(Defun C:chblu (/ A)
     (print)
     (Prompt "--- change selected objects to color BLUE ---") (terpri)
     (Setq A (ssget))
     (command "change" A "" "P" "C" "5" "")
     (prin1))
;
(Defun C:chmag (/ A)
     (print)
(Prompt "--- change selected objects to color MAGENTA ---") (terpri)
     (Setq A (ssget))
     (command "change" A "" "P" "C" "6" "")
     (prin1))
;
(Defun C:chwht (/ A)
     (print)
     (Prompt "--- change selected objects to color WHITE ---") (terpri)
     (Setq A (ssget))
     (command "change" A "" "P" "C" "7" "")
     (prin1))
;
(Defun C:ch11 (/ A)
     (print)
     (Prompt "--- change selected objects to color #11 ---") (terpri)
     (Setq A (ssget))
     (command "change" A "" "P" "C" "11" "")
     (prin1))
;
(Defun C:ch143 (/ A)
     (print)
     (Prompt "--- change selected objects to color #143 ---") (terpri)
     (Setq A (ssget))
     (command "change" A "" "P" "C" "143" "")
     (prin1))
;
(Defun C:ch252 (/ A)
     (print)
     (Prompt "--- change selected objects to color #252 ---") (terpri)
     (Setq A (ssget))
     (command "change" A "" "P" "C" "252" "")
     (prin1))
;

0 Likes
Message 10 of 13

Victoria.Studley
Autodesk
Autodesk

Hi @keshishian,

 

I see the problem now. I think you may be able to use .select in the macro expression to select multiple objects. Here is a resource for that if you want to read up on it while I adjust the macro I created here on my system, to see if it works.

 

I'll post my results once I finish testing.


Victoria Studley
Principal Experience Designer - Fusion Configurations
Join us in the Fusion Insider Program
Fusion Learn & Support | Fusion Documentation
0 Likes
Message 11 of 13

Victoria.Studley
Autodesk
Autodesk
Accepted solution

Hi @keshishian,

 

It looks like the answer to this is actually listed as an example right in the Help topic I linked in my previous post. Could you try this syntax please?

 

^C^C_.select \_.change previous ;properties color red ;


Victoria Studley
Principal Experience Designer - Fusion Configurations
Join us in the Fusion Insider Program
Fusion Learn & Support | Fusion Documentation
0 Likes
Message 12 of 13

keshishian
Contributor
Contributor

Thank you so much!

Message 13 of 13

sthompson1021
Advisor
Advisor

I see you already have your answer but another way to do it if you want to use a crossing window is to use two \ in a row to pick the corners of the window. Your original macro would look like this, ^C^Cchange;\\;p;c;1;;

0 Likes