YZ 发表于 2022-7-6 23:31:08

'spacetrans works until I

Any ideas why this works:
 

SetEnv;TextUnderLine;'spacetrans;0.776;
but this doesn't: 

SetEnv;TextUnderLine;'spacetrans;0.776;UCS;Object;Last;
 
It works perfectly when it is the last command in a macro. But as soon as I try to continue the macro, the spacetrans is ignored as if it were a standalone query, and the next command is entered as the value of the SetEnv.

steven-g 发表于 2022-7-6 23:43:34

I can only offer a guess, in my experience other transparent commands behave the same, my guess is that calling a transparent command internally calls up a sort of subroutine, and that action causes the macro to stop at that point. I would love to find a solution, for me the problem is the 'cal command, so I hope someone else has more insight.

BIGAL 发表于 2022-7-6 23:49:21

"Resuming SETENV command" Looks like you need an extra return to exit setenv
 
Snuck in Steven

steven-g 发表于 2022-7-6 23:58:49

BIGAL could be. I haven't actually figured out yet what 'spacetrans does, its a new command for me. Anyways I have a slight revision to my answer above, I checked back to the problem I have with 'cal and what actually happens is that the results don't actually come back until after the macro finishes, so where you expect the results in the middle of a macro it doesn't happen, and therefore mucks up the order of things.

YZ 发表于 2022-7-7 00:10:12

 
Yeah that is what I observe. It works in command line, but sometimes the results are not available immediately. Steven do you mostly find it with diesel?
 
('spacetrans is very similar to 'cal, but it calculates the difference between papaerspace and your viewport, to return the value you'd have to draw a line at in your model space to appear in paperspace the length you specified.)

steven-g 发表于 2022-7-7 00:14:25

Yup, probably because diesel sends the macro off to the diesel interpreter, and everything works differently there.
At least in diesel you can to some extents control the program sequence by using brackets (but that is a whole other story of frustration)
I have in the past had to use 2 or more macro's or scripts to get the results I want, and haven't managed yet to find a way to get around that (even calling 2 scripts from within a single macro results in the same odd behaviour)

steven-g 发表于 2022-7-7 00:22:41

Without seeing the rest of your macro, would it not be possible to rearrange the macro, so you change the UCS first and then set the value of TextUnderLine as the last command.

YZ 发表于 2022-7-7 00:37:32

No, the macro will be longer than just this. I want to use the value as the displacement of a move command.
 
I have created the spacetrans result using a diesel calculation:
 

^C^CSetEnv;TextUnderLine;$M=$(/,0.8,$(GetVar,CANNOSCALEVALUE));
 
Having better success with that now.
页: [1]
查看完整版本: 'spacetrans works until I