Macro problem


#1

I haven’t studied scripting at all. :roll_eyes: I know I should, but all my time goes to modeling stuff manually in Rhino + some Grasshopper. I have made small macros now and then and been happy with that.
Now I have a problem with this macro (both in Windows and OS X):

_-Sketch pause enter sellast _-Rebuild pause points=4 degree=3 enter

I can’t get it to set the point count correctly - only the degree (like to have single span curves, obviously). The point count always seems to be whatever I used previously in “Rebuild.”

Where’s the problem? Is it me or Rhino…? :thinking: :confused:
TIA!

Philip


#2

I think you need this:

_-Sketch pause enter sellast _-Rebuild pointcount=4 degree=3 enter

i.e. pointcount and not points… you also don’t need the second pause…

HTH, --Mitch


#3

Ah yes, pointcount of course! :+1: Why didn’t I try that… I actually took the whole Rebuild-part from the helpfile (with ‘points’ and ‘pause’). This is the macro from help: ! -_Rebuild _Pause _Points=10 _Degree=3 _Enter
"Points" is obviously wrong then.
I wondered why I would need ‘pause’ and tried yesterday without - but it didn’t work for some reason. I might have had something else in that macro that made it fail, perhaps a missing space or something… I don’t know. I was experimenting a lot.
Anyway, now it works! Thank you Mitch! :smiley:

Philip


#4

Hmmm, actually it doesn’t… The pointcount still seems to be whatever was used in a previous ‘rebuild.’ I have to run the macro twice for it to work. That’s strange…

Philip


#5

Dunno, maybe a bug in Mac Rhino? Here it works fine in V5 and V6 for Windows, don’t have my Mac here today to test… maybe someone else can?

–Mitch


#6

I can’t get it to work in Win Rhino either… Try this: open a fresh instance of Win Rhino (V5 here), draw a line, rebuild the line to, for instance, degree 5, 10 points. Then run the macro and draw an s-like shape. If I check the it afterwards it’s degree 3 (like the macro says) - but with 10 points (not 4). If I run the macro once more I get the right result (degree 3, 4 points).
Are you getting the expected result in this little test?

Philip


#7

OK, I got it now - I didn’t try starting out with a setting of degree 5 in Rebuild…

So, the explanation is pretty simple - given the order of the options in the macro, it first tries to set the number of points to 4. But only 4 points with a degree 5 curve is not allowed (you need at least 6), so it doesn’t set them. Then it does manage to set the degree to 3 afterward, so you get a 10 point degree 3 curve. The second time you run it 4 is accepted for the number of points, because you are now at degree 3 in Rebuild. Voila… :stuck_out_tongue:

The solution? Simple - invert the points and degree setting in the macro so it sets the degree first…

! _-Sketch _Pause _Enter _SelLast _-Rebuild _Degree=3 _Pointcount=4 _Enter

Does that work for you now?

–Mitch


#8

Of course Mitch! That’s it!
Thanks! :+1:

Philip


#9

Oh no… It’s not over yet… I have two macros now - one for left click and one for right click (put them in a button).

Left click:
! _-Sketch _Pause _Enter _SelLast _-Rebuild _Degree=3 _Pointcount=4 _Enter

Right click:
! _-Sketch _Pause _Enter _SelLast _-Rebuild _Degree=2 _Pointcount=3 _Enter

This works as i should in Win Rhino - but not in Mac Rhino - so this is probably for @dan
The left click macro works on both platforms, but the right click macro doesn’t work in Mac Rhino (both work in the windows version). I get the same point count error I explained earlier.

Making new buttons is also quite buggy on the OS X version, but that’s another story… Even if I finally got the right macro also on the right click(I had to try many times) it still doesn’t work.

Philip


Grease pencil tool (like in Blender...)
#10

Can you check the command feedback in the inspector panel? Maybe the right click is repeating the left button command instead of launching the right button command…

–Mitch


#11

I don’t think so (I haven’t checked though - I’ll do that tonight) - it sets the degree correctly…

Philip


#12

Hmm, that’s odd…

How I debug this stuff under Windows is I run the command and then hit F2, then look at the command prompts and see the responses. Usually you see right away where an option was not accepted and why… Keep changing, running and F2’ing until you get it right.

I think you can do this in Mac Rhino as well, but maybe better to have the command history window undocked so you can really see the whole line…


#13

Yes, I have to check more carefully…

Yeah… :smiley: I get the whole history window by hitting the bottom screen edge.

Philip


#14

Alright, this is weird. I deleted the right click command/macro - and redid it with the exactly the same macro - and now it works (at least today)… :face_with_raised_eyebrow:

Philip