Bret Posted October 19, 2012 Share Posted October 19, 2012 (edited) In a Command we've written to call out hardware on a plan, we currently use PenSize, PenPat, and FillPat to set visual defaults for a line and some text, but I'd like to force these to be by "By Class" when created. Is there a way to do this? I've taken a look through the forum and the online VectorScript reference, but I haven't run across anything helpful yet. (I see how you can use FFPatByClass etc. to query whether this is the case, but not how to force the setting.) UPDATE: Okay, I've figured out one way to do it by using SetLSByClass(LNewObj) etc. after every created object, but it would be nice to be able to set all of those things globally at the beginning of the code. (It seems that leaving the "Use at Creation" box for the class checked would solve much of this, but it doesn't seem to work for the fill pattern setting if you have it set to "None.") Edited October 20, 2012 by Bret Quote Link to comment
Miguel Barrera Posted October 20, 2012 Share Posted October 20, 2012 PushAttrs; {To save attributes settings} {These will set attributes by class} FPatByClass; FillColorByClass; LSByClass; PenColorByClass; MarkerByClass; OpacityByClass; {Sets the active class for object creation} NameClass('Name of Class'); ...... {Drawing code} ...... PopAttrs; {To restore attributes} Quote Link to comment
Bret Posted October 24, 2012 Author Share Posted October 24, 2012 Miguel, Thanks for reminding me of those. We had actually used those in some old scripts, but I had forgotten about them. After switching to use those, I'm having an issue with text coming out set to solid fill, even when the class setting is for 'None' (not to mention that 'Use at Creation' is checked for the class and that 'Create text without fill' is checked in my VectorWorks Preferences). For some reason, this happens whether or not I include FPatByClass in the code. However, I just discovered that if I turn off 'Create text without fill,' it works correctly and gives me unfilled text set to 'By Class.' I think it's time to file a bug. Quote Link to comment
Miguel Barrera Posted October 24, 2012 Share Posted October 24, 2012 If your preference is to always have text unfilled, I would hard coded with SetFPat(objHdl:HANDLE; fillPattern:LONGINT); where fillPattern = 0 I always assign by class but if I want an object to look somewhat different I hard code the attribute after the object is created. Quote Link to comment
Bret Posted October 24, 2012 Author Share Posted October 24, 2012 My preference is also to have it come out on 'By Class' so that it could be globally edited later should I want to do so. In my case, it should be created with the 'By Class' default fill of 'None' regardless of the 'Create text without fill' setting. Manually setting it to either filled or unfilled doesn't do what I'm aiming for. There is a conflict between FPatByClass and 'Create text without fill,' which I've now reported; the sequence of operations I gave them to replicate the problem is listed below, if you're interested... 1) Create a new blank document 2) Create the XXXXX class referred to below and set its default fill pattern to 'None' 3) Check the VectorWorks 'Create text without fill' option 4) Create a new VectorScript as shown below 5) Run the VectorScript -> the text is incorrectly created with a fill 6) Uncheck the VectorWorks 'Create text without fill' option 7) Run the VectorScript again -> the text is correctly created with fill set to 'By Class' (None) -------------------- BEGIN PushAttrs; NameClass('XXXXX'); FPatByClass; TextOrigin(0,0); BeginText; 'This text should not be solid' EndText; END; Quote Link to comment
Recommended Posts
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.