Jump to content

Hello Community!

This Thursday, October 21st, from 6 pm to 7 pm EDT, we will be performing an update on the Vectorworks Community Board. During this time, the site will be unavailable.

basic scripting help


vhector

Recommended Posts

I';m trying to learn a bit of scripting and find the logic within, but withouot luck so far. It think i get allready wrong at refering naming.

I just vectorscript exported an object. how do you refere a parameter with the script, like scaling the object or something.

Here the objectcode

Procedure LoadFile;

VAR

hatchName, gradientName, objectName:STRING;

result, index, segmentIndex:INTEGER;

boolResult:BOOLEAN;

top, left, bottom, right:REAL;

BEGIN

{VectorWorks Version 12.5.1 (64620)}

NameClass('00-aanduiding');

BeginGroup;

NameClass('0');

ClosePoly;

PenSize(10);

PenPat(2);

FillPat(1);

PenFore(4369,4369,4369);

PenBack(65535,65535,65535);

FillFore(0,0,0);

FillBack(65535,65535,65535);

BeginPoly;

CurveTo(-2.679491924311261,-10.000000000000005);

CurveTo(2.679491924311269,-10.000000000000005);

CurveTo(7.320508075688748,-7.320508075688746);

CurveTo(10.000000000000005,-2.679491924311269);

CurveTo(10.000000000000005,2.679491924311261);

CurveTo(7.320508075688748,7.320508075688738);

CurveTo(2.679491924311269,10.000000000000002);

CurveTo(-2.679491924311261,10.000000000000002);

CurveTo(-7.320508075688738,7.320508075688738);

CurveTo(-10.000000000000002,2.679491924311261);

CurveTo(-10.000000000000002,-2.679491924311269);

CurveTo(-7.320508075688738,-7.320508075688746);

EndPoly;

Marker(0,0.078735,35);

MoveTo(0,10.000000000000002);

LineTo(0,-9.999999999999892);

MoveTo(9.999999999999778,-0.000000000000002);

LineTo(-9.999999999999659,-0.000000000000002);

PenSize(2);

MoveTo(0.606217782649082,-0.000000000000002);

LineTo(0.606217782649082,9.981608086876578);

FillBack(8738,8738,8738);

BeginPoly;

ArcTo(0.303387885506254,10.000000000000002,0);

LineTo(0,10.000000000000002);

LineTo(0,-0.000000000000002);

LineTo(0.606217782649082,-0.000000000000002);

LineTo(0.606217782649082,9.981608086876578);

EndPoly;

FillPat(0);

FillBack(52428,65535,65535);

TextFont(GetFontID('KCAPSVtBold'));

TextSize(18);

TextFace([]);

TextFlip(0);

TextRotate(0);

TextSpace(2);

TextJust(1);

TextVerticalAlign(1);

TextOrigin(0.403384191623047,6.457722222222182);

BeginText;

'N'

EndText;

EndGroup;

SetZVals(0,0);

{End of Creation Code}

{Default Attributes}

PenSize(2);

PenPat(2);

FillPat(1);

Marker(0,0.125,15);

PenFore(0,0,0);

PenBack(65535,65535,65535);

FillFore(0,0,0);

FillBack(65535,65535,65535);

{End of Default Attributes}

END;

Run(LoadFile);

Link to comment

Here's a few simple additions, so hopefully you'd get the general idea :

Added a VAR named scalefactor, a simple dialog to enter it's value.

Added a line after the group is created, where scaling takes place.

Procedure LoadFile;
VAR
hatchName, gradientName, objectName:STRING;
result, index, segmentIndex:INTEGER;
boolResult:BOOLEAN;
top, left, bottom, right:REAL;
scalefactor : REAL;



BEGIN
{VectorWorks Version 12.5.1 (64620)}


scalefactor:=RealDialog('Scaling factor :','1');
DSelectAll;
NameClass('00-aanduiding');
BeginGroup;
NameClass('0');
ClosePoly;
PenSize(10);
PenPat(2);
FillPat(1);
PenFore(4369,4369,4369);
PenBack(65535,65535,65535);
FillFore(0,0,0);
FillBack(65535,65535,65535);
BeginPoly;
CurveTo(-2.679491924311261,-10.000000000000005);
CurveTo(2.679491924311269,-10.000000000000005);
CurveTo(7.320508075688748,-7.320508075688746);
CurveTo(10.000000000000005,-2.679491924311269);
CurveTo(10.000000000000005,2.679491924311261);
CurveTo(7.320508075688748,7.320508075688738);
CurveTo(2.679491924311269,10.000000000000002);
CurveTo(-2.679491924311261,10.000000000000002);
CurveTo(-7.320508075688738,7.320508075688738);
CurveTo(-10.000000000000002,2.679491924311261);
CurveTo(-10.000000000000002,-2.679491924311269);
CurveTo(-7.320508075688738,-7.320508075688746);
EndPoly;

Marker(0,0.078735,35);
MoveTo(0,10.000000000000002);
LineTo(0,-9.999999999999892);

MoveTo(9.999999999999778,-0.000000000000002);
LineTo(-9.999999999999659,-0.000000000000002);

PenSize(2);
MoveTo(0.606217782649082,-0.000000000000002);
LineTo(0.606217782649082,9.981608086876578);

FillBack(8738,8738,8738);
BeginPoly;
ArcTo(0.303387885506254,10.000000000000002,0);
LineTo(0,10.000000000000002);
LineTo(0,-0.000000000000002);
LineTo(0.606217782649082,-0.000000000000002);
LineTo(0.606217782649082,9.981608086876578);
EndPoly;

FillPat(0);
FillBack(52428,65535,65535);
TextFont(GetFontID('KCAPSVtBold'));
TextSize(18);
TextFace([]);
TextFlip(0);
TextRotate(0);
TextSpace(2);
TextJust(1);
TextVerticalAlign(1);
TextOrigin(0.403384191623047,6.457722222222182);
BeginText;
'N'
EndText;

EndGroup;

Scale(scalefactor,scalefactor);

SetZVals(0,0);

{End of Creation Code}


{Default Attributes}

PenSize(2);
PenPat(2);
FillPat(1);
Marker(0,0.125,15);
PenFore(0,0,0);
PenBack(65535,65535,65535);
FillFore(0,0,0);
FillBack(65535,65535,65535);

{End of Default Attributes}


END;

Run(LoadFile);

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...