Julian Carr
-
Posts
320 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Articles
Marionette
Store
Posts posted by Julian Carr
-
-
Thank Josh. Yeah I tried that already but unfortunately it doesn't do anything in this case and the function returns false.
-
Actually, one more. Any ideas for an equivalent to InsertSymbolInFolder() for shifting imported resources to a designated resource folder? InsertSymbolInFolderN() seems to be accepted by the compiler, but doesn't do anything and is not in the Function Ref.
-
Brilliant - thanks Josh.
-
Has anyone figured out how to create a resource folder (other than a symbol folder [type 92]), and if so, what are the Object Type numbers for the various types of resource folders?
[Edit]: Actually all resource folders are type 92, and I have tried using SetParent(), but that doesn't work to put resources into resource folders.
Thanks!
-
Hi Markus,
I don't know about your command but I do use DeselectAll in a lot of scripts and it continues to work there. Do you know you can also deselect all by holding the Spacebar down then double tapping the X key? The Spacebar preserves the current tool selection. If you don't need this, then just double tapping X will suffice.
Julian
-
OK thanks for the confirmation Nicolas. Interesting that Vw can write to the Libraries folder though. I guess that's a slightly different mechanism though.
-
Thanks guys.
Nicolas: I am the admin user on both machines and if it works on a Mac then, should it not work on a PC? Still, maybe you are right.
Pat: Message(GetFolderPath(-1)); also returns the path to application folder on Mac and PC.
Sam: If you run Message(GetFolderPath(1)); you will see it does return a separator at the end of the path name.
-
Anyone know why this code:
Procedure T;
VAR
s1 : STRING;
BEGIN
s1 := Concat(GetFolderPath(1), 'Test.txt');
ReWrite(s1);
WriteLn('test');
Close(s1);
END;
Run(T);
works fine on a Mac but returns this error on a PC:
Error on line=6: T S1 - File operation returned error.
Error on line=8: T S1 - Bad file name. C:\Program Files\Vectorworks 2018\Test.txt
Thanks!
-
Thanks Nicolas. Yes I tried a few different combinations including this:
{$INCLUDE MessageScriptTesting/MessageScript.vss}
but none of them worked.
-
Thanks again Nicolas. Unfortunately I can't get it to work. A full path such as this will work:
{$INCLUDE /Users/juliancarr3/Desktop/MessageScriptTesting/MessageScript.vss }
but then something like this (or variations thereof), does not work:
{$INCLUDE /MessageScriptTesting/MessageScript.vss }
The Vectorworks file with the saved views is also in the MessageScriptTesting folder.
The following also doesn't work on the Mac which is unusual because I normally use backslashes in include names:
{$INCLUDE \Users\juliancarr3\Desktop\MessageScriptTesting\MessageScript.vss }
-
Thanks for the suggestion Nicolas. Do you know if there is any documentation on how to create relative paths?
-
We are using a lot of saved views in our training and have added a script to each saved view to open the message window with some instructions that pertain to each particular step. This allows users to be able to work in the file while still having the instructions visible and unaffected by view changes, panning or zooming. The notes for each of the message strings come from a worksheet within the file. There are two things that would make this process better.
1. Being able to get the name of the current saved view that is running the script.
2. Being able to access the script via an include file.
Can anyone think of a way to do either of these things? Because we run training courses at a 3rd party training venue, we generally can only install the training files in a folder on the Desktop of each machine, so the potential path to any include file will be different on each machine.
Thanks for any ideas.
Julian
PS. I discovered that you can get around the limitation of 256 characters in a message, by concatenating a series of sub 256 character strings together within the message call.
-
Move3DObj() is definitely the one to use. Call it right after EndXtrd; I use this extensively in exactly the same context.
-
Dunno Sam. Maybe is it working of the active layer and not the layer you specify. Try making each layer active before getting the layer into. If you do this, then you only need to use GetDrawingSizeRect() which returns info from the active layer.
-
Scale factor is only there to demonstrate the script. If you run the script with the default setting, it should make the page size 1.5 times larger.
If you are the only one using your script then I agree units should not be an issue. If it is anyone else, then the values you are storing should have unit marks so they allow for it. People will always to the unexpected.
-
It works for me Sam. Try this script as a test:
Procedure T;
VAR
x1, y1, x2, y2, ScaleFactor : REAL;
BEGIN
ScaleFactor := RealDialog('Scale Factor:', '1.5');
GetDrawingSizeRectN(ActLayer, x1, y1, x2, y2);
SetDrawingRect((x2 - x1) * ScaleFactor, (y1 - y2) * ScaleFactor);
Message((x2 - x1) * ScaleFactor, chr(13), (y1 - y2) * ScaleFactor);
END;
Run(T);Make sure you get the units right tool. Can't remember if it uses document units, mm or inches.
-
You can use GetDrawingSizeRect() to establish the current page size, and SetDrawingRect() to set a new page size.
-
Thanks Josh. I had a bit of a play with it but as you implied, it makes Vectorscript even more of a black box than it is already. Lots of unexplained crashes and mystery. Two things I have built up immunity to over the years, but I still got the bug with this one.
-
Does anyone have a sample script for a VST that uses buttons in the tool bar?
Thanks!
-
Well blow me down Pat - thanks. I need to get out more.
-
You will need something like this, which only counts object whose parent is a layer:
PROCEDURE xxxxx;
VAR
gNumObjects : INTEGER;
Procedure CountThem(h1 : HANDLE);
BEGIN
IF GetType(GetParent(h1)) = 31 THEN gNumObjects := gNumObjects + 1;
END;
BEGIN
gNumObjects := 0;
ForEachObject(CountThem, (Sel = True));
Message(gNumObjects);
END;
RUN(xxxxx); -
really? I just assumed they had to be Python as all the default ones were so. That opens a lot more possibilities. Thanks Pat.
-
Thanks Pat and Josh. I think Josh has nailed it with his last suggestion, which seems to work with any units. The script I am working on is for a worksheet and will populate a single cell with all the door IDs that match a particular door type (and optionally width), comma separated. A door type could be an internal door, an external door, the front door of an apartment, or a patio door of a particular style. Sometimes the doors can vary in size but are otherwise the same type. Something like this:
TYPE ID WIDTH ETC
| Type A | D01, D04, D07 | 1000 | |
| Type A | D02, D03, D05 | 900 | |
| Type B | D06, D11, D12 | 1000 | |
| Type B | D08, D09, D13 | 900 | |
The RunScript() function is so powerful it has prompted me to dip my toes into the python pit.
-
I have never been able to get things like OPTION, COMMAND, etc to work, however I recall using AUTOKEY in some scripts successfully. It would be good to have reliable modifier key support.
- 1
Applying a Tile Resource to a Polygon
in Vectorscript
Posted
Anyone have a code snippet for applying a Tile resource to a polygon? Not having much luck.
TIA.