Jump to content

MaxStudio

Member
  • Posts

    319
  • Joined

  • Last visited

Posts posted by MaxStudio

  1. Lets say I have a list of 20 radio buttons. 19 of the radio buttons are assigned a specific value. The 20th radio button allows the user to input a custom value via 'GetEditReal'.

    I only want the 'GetEditReal' box to be active when the 20th 'Custom' radio button is selected.

    I achieved this with the following code:

    20:BEGIN

    IF ItemSel(20) THEN SetItemEnable(21,TRUE) ELSE SetItemEnable(21,FALSE);

    END;

    If I click the 'Custom' Radio button the 'GetEditReal' box becomes active and this is where my problem begins.

    If a user then clicks a different radio button the 'GetEditReal' box continues to stay active.

    I want it to return to inactive (or grayed out).

    I know I can accomplish this using the same script above,

    1:BEGIN

    IF ItemSel(1) THEN SetItemEnable(21,FALSE) ELSE SetItemEnable(21,FALSE);

    END;

    2:BEGIN

    IF ItemSel(2) THEN SetItemEnable(21,FALSE) ELSE SetItemEnable(21,FALSE);

    END;

    but I would have to copy the script for each of the 19 radio buttons creating a lot of extra scripting and a lot of extra memory.

    I am only an amateur scripter so I am not always the most efficient

    Is there an easier/shorter script I can use to make this box inactive without duplicating the script over and over again?

    Thanks in advance!

  2. My file looks correct on the screen, but when I print it directly through vectorworks it changes all my fonts to a default font.

    If I preview the file first and then print it through preview the file prints correctly with all the right fonts.

    This problem only appears to happen on older macs before the intel switch.

    I really hate having to print through preview every time I want to print a drawing correctly.

    Does anyone know why this is happening? Is there a solution to this problem?

  3. I figured out this problem. I'm using mac os X I had to reset the printer system under system preferences. This fixed all the new files I created. Unfortunately, any file that I had printed during this problem remained corrupted and continued to print upside down. I had to copy and paste all my work to a new file to drop the printing errors.

  4. I want to know, is it safe to reuse handles within a procedure?

    My scripts usually generate a lot of objects. Once I am done creating and defining the object attributes can I reassign the handle to a new object?

    The really want to limit the number of handles I define at the beginning of my script.

    good idea/bad idea?

    thanks!

  5. Some of my prints are coming out of the plotter rotated 180 degrees and it is messing with my margins.

    My System is as follows:

    Mac OS X 10.5.5

    2.4 GHz Intel Core 2 Duo

    1GB 667 MHz DDR2 SDRAM

    VectorWorks 2008 SP3

    Not all files are rotating only some. I've checked all my printer settings and everything seems to be ok. Is there any other reason this could be happening?

  6. Hey Josh! Thanks a lot for pointing out that section in the language guide. "subroutines" is exactly what I was trying to accomplish.

    Ian, thanks for your help. I'm going to try to keep my scripts more organized using the indentation method you have shared with us.

  7. I got the following test to work using sub-procedures. I get confused about where to put things when there are so many end's... lol

    Procedure ProSub;

    VAR

    id:LONGINT;

    result:LONGINT;

    gA, gB: BOOLEAN;

    A,B,C,D: REAL;

    FUNCTION DED_ProSub(VAR id:LONGINT):BOOLEAN;

    BEGIN

    { initialize dialog creation }

    id := CreateLayout('Procedure/Sub-Procedure',TRUE,'Create','Cancel');

    { Menu 1 }

    CreateStaticText(id,4,'Type:',-1);

    CreateCheckBox(id,5,'A.');

    CreateCheckBox(id,6,'B.');

    { Layout Dialog }

    SetFirstLayoutItem(id,4);

    SetRightItem(id, 4, 5, 0, 0);

    SetRightItem(id, 5, 6, 0, 0);

    DED_ProSub:=VerifyLayout(id);

    END;

    PROCEDURE DD_ProSub(VAR item:LONGINT; data:LONGINT);

    BEGIN; { SET DEFAULTS }

    CASE item OF

    SetupDialogC: BEGIN

    SetItemEnable(5,TRUE);

    SetItemEnable(6,TRUE);

    END;

    1:BEGIN

    IF ItemSel(5) THEN gA:= TRUE ELSE gA:= FALSE;

    IF ItemSel(6) THEN gB:= TRUE ELSE gB:= FALSE;

    END;

    END;

    END;

    { Begin Define Sub-Procedures ------------------------------- }

    Procedure Sub;

    BEGIN

    Rect(A,B,C*2,D*2);

    END;

    Procedure Sub2;

    BEGIN

    Rect(A,B,C*4,D*4);

    END;

    { End Define Sub-Procedures -------------------------------- }

    BEGIN

    IF DED_ProSub(id) THEN BEGIN

    result:=RunLayoutDialog(id,DD_ProSub);

    END;

    IF (result=1) THEN BEGIN

    A:=0;

    B:=0;

    C:=50;

    D:=50;

    IF gA THEN BEGIN

    Sub2;

    END;

    IF gB THEN BEGIN

    Sub;

    END;

    END;

    END;

    RUN(ProSub);

  8. Got it to work using the following...

    SetMarker(H,TRUE,FALSE,0,1000);

    not sure exactly how the last number deals with size...

    when i set it to 1 the arrow was huge.

    when i set it to 100 it was the same size as 1000.

    any further insight would be appreciated

  9. I want to draw a line with an arrow head that is the same color as the line.

    I tried the following...

    Marker(1,0.125,15);

    I expected this to give me a solid arrow at the start of my line, but it gives me a hollow arrow instead. Below is a link to the marker list I have been referencing. Either I am referencing the wrong list or I am forgetting a step.

    I want to be able to fill the arrow head with the line color.

    Thanks for your help!

  10. Thanks Pat!

    check out my first Plugin Object.

    See any problems?

    PROCEDURE Shutter;

    VAR

    l,Offset,PanOffset,PanNumber,X01,Y01,A,B,C,D,E : REAL;

    M01,M02,M03,M04,i :INTEGER;

    result : BOOLEAN;

    objname : STRING;

    oh,rh,wh : HANDLE;

    BEGIN

    { retrieve custom object information }

    result:= GetCustomObjectInfo(objname,oh,rh,wh);

    { if object information was successfully retrieved }

    IF result THEN BEGIN

    { retrieve parameters }

    Y01 := PHEIGHT;

    X01 := PWIDTH;

    Offset := POFFSET;

    PanOffset := PPANOFFSET;

    PanNumber := PPANNUMBER;

    A:=(X01-Offset);

    { B is equal to the size of the panel }

    B:=(Y01-(Offset*(PanNumber+1)))/PanNumber;

    { C is the point relative to the height (Y01) }

    C:=((0+Y01)-(Offset*PanNumber)-(B*(PanNumber-1)));

    { draw Shutter }

    FillPat(1);

    PenPat(2);

    PenSize(4);

    Rect(0,0,X01,Y01);

    M01:=1;

    M02:=0;

    M03:=PanNumber;

    M04:=(PanNumber-1);

    { draw Panels }

    BEGIN

    repeat

    i:=i+1;

    E:=(0+(Offset*M01)+(B*M02));

    D:=(Y01-(Offset*M03)-(B*M04));

    PenSize(4);

    Rect(0+Offset,E,A,D);

    PenSize(2);

    Rect(0+Offset+PanOffset,E+PanOffset,A-PanOffset,D-PanOffset);

    M01:=M01+1;

    M02:=M02+1;

    M03:=M03-1;

    M04:=M04-1;

    until i=PanNumber;

    END;

    END;

    END;

    Run(Shutter);

  11. I created a Linear Plugin Object that creates an a simple rectangular object.

    When ever I use the tool I have to click once and then twice to create the object. I've noticed that clicking once and then twice defines the axis on which the object is created. Is it possible to use the distance between the points as a variable? (such as the length of the object)

    if so, does anyone know how I would go about scripting that?

  12. I've downloaded the sample Rectangle Plugin Object.

    The archive file contains the following:

    Simple Grid.vso

    simplegrid.vss

    i was able to open the file simplegrid.vss in textwrangler. I have tried to compile the simplegrid.vss code in vectorworks but I get an error telling me that specific identifiers are not declared.

    How am I suppose to correctly load these files into vectorworks?

  13. well some of the code I've created in the past has had a problem due to file size. One of the codes I am working on for my office draws a door in elevation. the users have the option to choose what type of door, as well as, the type of panels the door has. I'm always modifying and adding to this code. Depending on what I am adding I create small test scripts (like the one above) so that I do not have to work within the main script. After I get the piece of code working correctly I add the code to the main script.

    I fear that one day, like in the past, I will end up adding too much to the Main script and it will no longer run in vectorworks. So I think the include directive will help me to create a new type of organization that will allow me to keep the main script much much smaller in size. The main problem I see with this organization is getting the file paths correct. One missed link will screw up the entire script.

    Now that I am beginning to understand the Include directive I want to start learning how to create Plugin Objects that will make the objects created by my script interactive via the Object Info Pallete. any good clean examples on that?

  14. Ok I finally got this Include thing working! Now I just have to make sure I use a common file path so it will work on multiple computers.

    I created the following test script. The script creates two rectangles. All the variables are declared and assigned values in the main script. The first rectangle is created in the main script. The $Include directive is then used to call the file named "rectb" which only contains the code to draw the second rectangle. The main script "includes" the code from "rectb" then proceeds to complete the remaining code in the main script.

    The Main Script:

    Procedure CreateRect;

    VAR

    X01, X02, Y01, Y02: REAL;

    X03, X04, Y03, Y04: REAL;

    BEGIN

    X01:=0;

    X02:=10;

    Y01:=0;

    Y02:=5;

    X03:=15;

    X04:=25;

    Y03:=10;

    Y04:=15;

    Rect(X01, Y01, X02, Y02);

    {$INCLUDE Macintosh HD:Users:MyName:Desktop:MiniDrive Sync:Completed Tools:Include Test:rectb}

    END;

    RUN(CreateRect);

    The file "rectb" simply Contains the Following:

    Rect(X03, Y03, X04, Y04);

    I'm guessing that as the long as the code is written correctly and compiles successfully then I can break it into as many pieces as possible. I just have to make sure that all the little pieces are called in the correct order. I'm assuming it doesn't matter where variables are declared as long as they are declared in the correct position in the code. Are my assumptions correct?

  15. I have written a script named door.vsm using the script editor

    I want to call this script from another script named create.vsm

    When I run the create.vsm script I have a dialog box with a check box. If the check box is checked I want $include to run the door.vsm script.

    Does anyone have a simple example on how to do this properly?

  16. This is partial code that deals with creating a saved view.

    { BEGIN VIEW SETUP: Note last layer will be Active Layer }

    V1:=' C Plan';

    V2:=' P/T Plan';

    V3:=' RC Plan';

    View01:=Concat(Y1,V1);

    View02:=Concat(Y1,V2);

    View03:=Concat(Y1,V3);

    { CONSTRUCTION PLAN BEGIN }

    Layer(X1);

    ShowLayer;

    Layer(X2);

    HideLayer;

    Layer(X3);

    ShowLayer;

    Layer(X5);

    ShowLayer;

    Layer(X6);

    HideLayer;

    Layer(X7);

    HideLayer;

    Layer(X8);

    ShowLayer;

    { Legend }

    Layer('Material Legend');

    ShowLayer;

    Layer('P/T Legend');

    HideLayer;

    Layer('RCP Legend');

    HideLayer;

    { Active Layer }

    Layer(X4);

    ShowLayer;

    { Set View }

    SetVCenter(0,0);

    SetZoom(57);

    SetLayerOptions(5);

    { Save View }

    VSave(View01);

×
×
  • Create New...