Jump to content

Tere

Member
  • Posts

    13
  • Joined

  • Last visited

Posts posted by Tere

  1. Hi everyone, I need to write a script that finds all objects with a specific RGB fill, and for these objects sets a specific pen thickness (like an outline).

     

    Below is my first attempt and attached what it says the errors are. Thanks a lot for helping!

     

    PROCEDURE LWUpdate;


    FUNCTION ChangeThickness(h :HANDLE) :BOOLEAN;

        CONST { substitute these with the required values }
        ToLW = 0.35; {mm}
        
        VAR
        r, g, b :LONGINT;
        VToLW:REAL;

        BEGIN

            GetFillBack(h,r,g,b);

            IF (r = 34952) & (g = 34952) & (b = 34952) THEN

                SETLW(h, VToLW);
                        
            GetFillFore(h,r,g,b);

            IF (r = 34952) & (g = 34952) & (b = 34952) THEN

                SETLW(h, VToLW);

            
        END;


    BEGIN

        { Each object option here is set to affect all objects, on all layers, using a deep traversal}
        VToLW := ToLW / 25.4 * 1000;
        ForEachObjectInLayer(ChangeThickness,0,2,1);

    END;


    Run(LWUpdate);

    Screenshot 2021-06-10 at 20.12.09.png

  2. Hi everyone, 

     

    I would like to be able to write scripts that change objects on a given layer/class. I will want to do things like: changing fill or pen colour/thickness or switching a particular layer/class off. Can you please advise me whether there is a good example of a similar script out there that I could have a look at and use as a guideline when adjusting to fit my needs?

     

    Thank you very much!!

  3. Hi everyone, I cannot seem to work out why my lines won't change thinckness. Might I be setting the values in the script wrong?

     

    The attached screenshot shows attributes of an example line I need to change. It's thickness is 0.25, and just to see the change clearly, the new thickness would be 1. 

     

    What am I doing wrong please?? The script otherwise compiles.

     

    PROCEDURE LineWeightChange;

    { © Petri Sakkinen 2008 }

    CONST { substitute these with the required values }

    oldWeight = 0.25;

    newWeight = 1;

    PROCEDURE ChangeIt (h : HANDLE);

    BEGIN

    SETLW(h, newWeight);

    END;

    BEGIN

    FOREACHOBJECT(ChangeIt, LW = oldWeight);

    END;

    RUN(LineWeightChange);

     

     

    Thanks for helping! 

    Screenshot 2021-06-01 at 19.27.20.png

  4. Hi everyone, I would like to start automating some tasks I am performing in VW using Vectorscript but am new to it. The first task I would like to automate is SELECTING ALL OBJECTS OF A CERTAIN FILL FORE COLOUR (rgb values, in this case specifically 255, 255, 204) AND CHANGING THE FILL FORE COLOUR TO DIFFERENT COLOUR (rgb values 187, 209, 96, ideally, but not necessarily also 40% opacity). It is important to perform all at once, since I want to be able to perform multiple such specific colour and line colour/weight changes all at one go. 

     

    From studying tutorials and adjusting the script in 'Setting/Changing Object color' thread, this is what I have:

     

    PROCEDURE GreenUpdate;


    FUNCTION MakeItGreen(h :HANDLE) :BOOLEAN;

        VAR
        r, g, b :LONGINT;

     

        BEGIN

            GetFillBack(h,r,g,b);

            IF (r = 255) & (g = 255) & (b = 204) THEN

                SetFillBack(h,187,206,96);

                

            GetFillFore(h,r,g,b);

            IF (r = 255) & (g = 255) & (b = 204) THEN

                SetFillFore(h,187,206,96);

            
        END;


    BEGIN

        { Each object option here is set to affect all objects, on all layers, using a deep traversal}

        ForEachObjectInLayer(MakeItGreen,0,2,1);

    END;


    Run(GreenUpdate);

     

     

     

    The script compiles but does not do anything! I tried to delete as little from the original as possible not to mess it up..

     

    Thanks so much for helping 🙂

×
×
  • Create New...