vhector Posted July 17, 2008 Share Posted July 17, 2008 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); Quote Link to comment
Gerrit Posted July 17, 2008 Share Posted July 17, 2008 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); Quote Link to comment
vhector Posted July 17, 2008 Author Share Posted July 17, 2008 (edited) Thanks Gerrit, that looks pretty simple, I got try it out, when i'm back at work. And to add to the parameter you have to name it scalefactor for recognition? Ahwell i try it out, thanks. Edited July 17, 2008 by vhector Quote Link to comment
maarten. Posted July 18, 2008 Share Posted July 18, 2008 You can give the variables (almost) every name that you like. Best is to give it a logic name ofcourse. The list of words that you can not use you can find in the VS Language Guide->Lexical Structures of VectorScrip->Reserved Words 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.