Jump to content

Script to set attributes to by class?


Recommended Posts

  • 1 year later...

The addition of the item on the attributes pallete is great, but I still can't find whatever Vectorscript function selects Fill or Pen Style. I'm making series of tools containing different text styles, and always want all elements to be by class. I can easily set the colors by class, but not the styles it seems. Everything I've tried, the style always automatically goes to "No Fill" or "Solid"...not "by class". Am I missing something, or is it more obvious and I'm thinking too hard?

VW2010 Spotlight w/ Renderworks on Mac OS 10.5.8

Edited by SamIWas
Link to comment

LSByClass did work on the Line Style. FPatByClass defines the Fill Pattern, but not the style. It appears that you can call everything by class, EXCEPT Fill Style. I did a search all the way through the Function Reference, and there is no function which effectively sets Fill Style by Class in advance of running a procedure.

The way I'm set up is so that I have a Pallet of tools which change all of the text attributes based on what I'm using (Notes, Room Name, etc)...this assigns classes to everything so that they can be colored/filled as required. Unfortunately, it just doesn't seem to work. So I may have to go with a different workaround. Even if I set everything by class in advance, the procedure seems to change it to "No Fill" no matter what.

SetTool(-200);
TextFont(GetFontID('Arial Narrow'));
TextSize(6);
TextFace([bold,Italic]);
TextSpace(2);
TextJust(2);
TextVerticalAlign(1);
NameClass('Text-Position');
LSByClass;
LWByClass;
PenColorByClass;
FillColorByClass;

Oh well.

Link to comment

OK, I think I found the issue. If the "No Fill Behind Text" option is checked in preferences, the script has no effect on the text fill. The options will work on other objects, but not text. You can still manually change the text fill, just not with the script. One the option is unchecked, the script works perfectly. Honestly, I'm not even sure why that is a preference, since it doesn't seem to do anything in particular.

Thanks for the help!

Edited by SamIWas
Link to comment

Sam,

Have you looked into SetPrefInt and SetPrefLongInt?

You'll find the index/selector numbers in the appendix.

There are selectors for Fill Style and Type.

Maybe something like SetPrefLongInt(528,0).

I think the second value would be the number corresponding to the place in the drop-down of the style, so maybe by class is zero, or -1 or....

It *seems* this should set the default value in attributes.

edit: Or maybe use SetPref(8,False) to make sure that fill behind text is off.

Link to comment

To the Moderator(s),

???There was a post between my post (131369) and SamIWas' post (131366). It was posted 22 minutes after 131366, but I don't know whose it was.

???I hit the Reply button at the bottom of 131366 and when I hit Submit, the previous post disappeared. I don't know if the original poster deleted it or if it vanished as a result of the way I replied. Can you tell me if it was removed legitimately? This post is submitted using the Quick Reply pane at the bottom of the page.

Thanks,

Raymond

Link to comment
If the "No Fill Behind Text" option is checked in preferences, the script has no effect on the text fill.

Nice find. So, it's not a bug. That preference is an override for fill behind Text objects that predated Class Attributes. It still works as it was originally implemented and I use it all the time. It only affects text as it is created. You can turn it off in your script with:

SetPref(8, False);

or toggle it with another one line script:

SetPref(8, not GetPref(8));

Raymond

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...